Major Localization Issue: React UI Cannot Be Translated Due to Non-Standard Script Loading

Ticket for: User Verification
0
Major Localization Issue: React UI Cannot Be Translated Due to Non-Standard Script Loading 1
jayroncastro
Jul 29, 2025 08:26 AM 0 Answers
Member Since Jul 2025
Subscribed Subscribe Not subscribe
Flag(0)

Hello Developer,

I am writing to report a critical localization issue with the User Verification plugin. The new React-based settings page cannot be translated into other languages (in my case, Portuguese - pt_BR).

After an extensive debugging process on a clean, local WordPress installation (using a default theme and no other plugins), we have isolated the root cause of the issue.

Summary of Findings:

  1. Standard PHP translation is partially working: The main admin menu title ("User Verification") is correctly translated via the .mo file. This confirms that the text domain is being recognized at a basic level.
  2. load_plugin_textdomain Failure: A diagnostic test revealed that the plugin's load_plugin_textdomain function is failing silently and returning false. We bypassed this by loading the text domain manually from the theme's functions.php, which was successful for PHP but did not solve the React UI issue.
  3. React UI remains untranslated: Despite having perfectly synced and valid .po, .mo, and a manually generated JED .json translation file in the /languages directory, the React interface remains entirely in English.
  4. wp i18n make-json Fails: The standard WP-CLI command wp i18n make-json correctly reports Success: Created 0 files.. This happens because it cannot find any scripts registered for translation within the plugin's code.
  5. The Root Cause: A final diagnostic test confirmed the fundamental problem. The main JavaScript for the React settings page is not enqueued via the standard wp_enqueue_script function. The script handle does not appear in the global $wp_scripts->queue on the admin page.

Conclusion:

The reason the React UI cannot be localized is a fundamental architectural issue. Because the application script is not properly enqueued, it is impossible to attach translations using the standard WordPress function wp_set_script_translations. The entire WordPress JavaScript localization system is being bypassed.

Could you please update the plugin to ensure that the React application's main script is enqueued using standard WordPress best practices? This will allow the localization system to function as intended and for users worldwide to translate your plugin.

Thank you for your time. I look forward to a fix in a future version.

1 Subscribers
Major Localization Issue: React UI Cannot Be Translated Due to Non-Standard Script Loading 1
Submit Answer
Please login to submit answer.
0 Answers
Sort By: