Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - Translations - MO file cannot be found #504

Open
jaymcp opened this issue Nov 28, 2024 · 0 comments
Open

Bug - Translations - MO file cannot be found #504

jaymcp opened this issue Nov 28, 2024 · 0 comments
Assignees
Labels
bug Something isn't working epic This groups related issues together

Comments

@jaymcp
Copy link
Contributor

jaymcp commented Nov 28, 2024

Describe the bug
When not using the translation management plugin (i.e. when the translations are loaded from the theme's languages directory, not WP's languages directory), theme translations fail to load correctly.

This is because of the way WordPress looks for translation files to load. If the source is a theme / child theme directory, it does not want a text domain prefix on the file name; if the source is WP's languages directory, it does want a text domain prefix on the file name.
This purely applies to .mo files, though (and possibly the new l10n.php files); for script translations (.json), it does want a text domain prefix on the file name always.

Unfortunately, because WP CLI generates the JSON files based on the PO file names, we can't rename the theme PO/MO files without breaking script translations.

To Reproduce
Steps to reproduce the behaviour:

  1. install and activate the Query Monitor plugin, to make it easier to see which text domains are being loaded
  2. view the frontend of a site
  3. open Query Monitor to the Languages tab
  4. look for the amnesty text domain
  5. see that all searched-for files show Not Found

Expected behaviour
The site should be able to load the amnesty text domain from a found .mo file

Actual behaviour
The site cannot find an appropriate .mo file to load

Screenshots

Platform:
N/A

Additional context
The issue can be worked around by installing the Humanity Translation Management plugin, then saving the translations from its admin panel. This is because the plugin clones the translation files (.mo and .json) to WP's languages directory, in which every file is expected to be prefixed with the text domain.

@jaymcp jaymcp added the bug Something isn't working label Nov 28, 2024
@AmnestyAM AmnestyAM added the epic This groups related issues together label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working epic This groups related issues together
Projects
Status: To do
Development

No branches or pull requests

2 participants