Opened 3 years ago
Closed 3 years ago
#6270 closed defect (bug) (worksforme)
Translated text specified in JavaScript is not translated
Reported by: | shimotomoki | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Translate Site & Plugins | Keywords: | |
Cc: |
Description
The following plugins are hosted on WordPress.org.
Plugin Directory
https://wordpress.org/plugins/vk-block-patterns/
Source Code
https://github.com/vektor-inc/vk-block-patterns
I am having trouble getting my JavaScript translated text to translate.
Translating WordPress contains the text translated by JavaScript.
(This is an example of Japanese)
https://translate.wordpress.org/projects/wp-plugins/vk-block-patterns/dev/ja/default/
However, when I install the plugin and set the language to Japanese, the translation is not done.
Is this a problem with the plugin code?
Or is there a problem with the WordPress.org translation (GlotPress) ?
Change History (4)
#2
@
3 years ago
I think it will work if you move this line directly below your wp_enqueue_script() line here.
According to the Block Editor Handbook (https://developer.wordpress.org/block-editor/how-to-guides/internationalization/) you need to use
wp_set_script_translations()
(https://developer.wordpress.org/reference/functions/wp_set_script_translations/) so that the translations are loaded.Edit: Sorry, the GitHub search is sometimes a little bit buggy … I couldn’t find your
wp_set_script_translations
in the first try.