You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good morning! I'm experiencing some problems with the translation of my plugin and I can't seem to get to the bottom of it!
My plugin is completely custom, it's an quote-generator for a client of mine.
I used @wordpress/scripts to develop the form that is displayed on the fronted I used @wordpress/element. The rendering is through react.
It is not a block as my client is still using shortcodes.
I created the po and mo files, through Poedit. Both files are generated correctly. On the admin side where I display a wp-list-table there are no problems, the translation is loaded and displayed correctly.
Fronted side on the form instead I use @wordpress/i18n (__()) for translations.
I then created with wp cli wp i18n make-json languages the json.
Here I encounter the first problem, only 4 of the strings in the .po file are displayed.
When I then use wp_set_script_translations (which returns true) the json file is not loaded on the fronted.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Good morning! I'm experiencing some problems with the translation of my plugin and I can't seem to get to the bottom of it!
My plugin is completely custom, it's an quote-generator for a client of mine.
I used @wordpress/scripts to develop the form that is displayed on the fronted I used @wordpress/element. The rendering is through react.
It is not a block as my client is still using shortcodes.
I created the po and mo files, through Poedit. Both files are generated correctly. On the admin side where I display a wp-list-table there are no problems, the translation is loaded and displayed correctly.
Fronted side on the form instead I use @wordpress/i18n (__()) for translations.
I then created with wp cli wp i18n make-json languages the json.
Here I encounter the first problem, only 4 of the strings in the .po file are displayed.
When I then use wp_set_script_translations (which returns true) the json file is not loaded on the fronted.
`
foreach ($this->get_scripts() as $script) {
`
I anticipate that I use wp_set_script_translations after queuing the script, and the script has i18n as a dependency.
Where could the problem be?
Beta Was this translation helpful? Give feedback.
All reactions