[wp-trac] [WordPress Trac] #60999: Issues with new i18n logic when handling translation files (MO/PHP)
WordPress Trac
noreply at wordpress.org
Fri Apr 12 14:19:35 UTC 2024
#60999: Issues with new i18n logic when handling translation files (MO/PHP)
-------------------------------+------------------------------
Reporter: fengyintseng | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version: 6.5
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by swissspidy):
> But it's the formal method suggested by almost all the plugin developers
that if we would like to put our customized translations in use, it's
better to put it under /wp-content/languages/plugins/ instead of /wp-
content/plugins/plugin-name/languages/ as it won't be changed during an
update.
> Take Tutor LMS as example, please refer to its instruction about how to
translate the plugin offline:
https://docs.themeum.com/tutor-lms/tutorials/how-to-translate-tutor-lms
/#translating-tutor-lms-offline
This is really bad advice.
You should not manually edit plugin files in `wp-content/plugins/tutor/*`,
as the files will be overridden whenever you update a plugin.
Similarly, you should not manually edit translation files in `wp-
content/languages`, as the files will be overridden whenever WordPress
updates translations.
This is not new behavior in 6.5. It has always been this way.
> And there is indeed requirement for user to use their own customized
translations, take membership or eLearning sites for example, though
people use similar plugins to build up their sites, the critical
difference between their sites would be the designs and wordings they used
in their sites.
If you need customized translations, use a custom location like you did
with your `load_translation_file` filter example. Alternatively, there are
also plugins such as Loco Translate that allow this.
> I did some experiments to double check the behavior.
I used PHP with old translations & MO with new translations, both files
under /wp-content/languages/plugins/, and the translations displayed on
Front/Back ends are from the PHP file.
> I used code snippets plugin WPCodeBox to insert the codes.
I think your code is running to late. If the Tutor plugin loads
translations too early, then it might do so before your code is even
loaded.
Try putting it in an mu-plugin.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60999#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list