Where applicable, please strive for making all strings available for translation. Consider the following guidelines when doing so:
PHP
- Instead of
__,_e,_xand similar functions, use their safe versions:esc_html__,esc_html_e,esc_html_xand others where possible. - Use an appropriate unique text domain in your plugin or Composer package.
- Make use of our Automattic/jetpack-composer-plugin and related packages to ensure i18n works in the published plugin.
JavaScript
- Use Gutenberg’s @wordpress/i18n package.
- Use an appropriate unique text domain in your JS code.
- Make use of @automattic/babel-plugin-replace-textdomain when building to ensure i18n works in the published plugin.
- When using TypeScript in Webpack, use
@babel/preset-typescriptrather thants-loader.- To generate
.d.tsfiles, eitherfork-ts-checker-webpack-pluginortsc --emitDeclarationOnlymay be used.
- To generate