This project was bootstrapped with Create Guten Block.
Below you will find the steps how it was built.
- npx create-guten-block callout-cgb
- apply this fix: ahmadawais/create-guten-block#183
- npm start
- Copy & paste code from the non-cgb, plain ES5 version of the plugin's block.js (that works fine)
- Adding load_plugin_textdomain() and wp_set_script_translations() to src/init.php
- npm run build to generate distributable .js (__ exposed as expected after applying the fix)
- md languages
- wp i18n make-pot ./ languages/callout-cgb.pot --exclude="/js/,/src/block/" (using wp-cli V2.2)
- the generated .pot contains both i18n string of build.blocks.js as expected
- generate .po and .mo files with PoEdit V2.2.3
- wp i18n make-json callout-cgb-de_DE.po --no-purge
- rename the .json file to callout-cgb-de_DE-callout_cgb-cgb-block-js.json so that it follows the ${domain}-${locale}-${handle}.json pattern
- Checking the plugins screen while WP admin is set to german confirms the path provided in the code is ok as the plugin name and description gets translated
- However the placeholder of the RichText component does not get translated despite the same method works if implemented in pure ES5 and without any dev tools.
I have no clue why this happens...any solution is welcome!