Opened 2 years ago

Closed 2 years ago

#6270 closed defect (bug) (worksforme)

Translated text specified in JavaScript is not translated

Reported by: shimotomoki's profile shimotomoki Owned by:
Milestone: Priority: normal
Component: Translate Site & Plugins Keywords:


The following plugins are hosted on

Plugin Directory
Source Code

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)

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 translation (GlotPress) ?

Change History (4)

#1 @kittmedia
2 years ago

According to the Block Editor Handbook ( you need to use 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.

Last edited 2 years ago by kittmedia (previous) (diff)

#2 @ocean90
2 years ago

I think it will work if you move this line directly below your wp_enqueue_script() line here.

#3 @shimotomoki
2 years ago

Thanks for the comment.

I took @ocean90's advice and fixed where wp_set_script_translations runs and the translations worked!

#4 @ocean90
2 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

Glad to hear it's working now.

Note: See TracTickets for help on using tickets.