[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 10:55:37 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 fengyintseng):

 Hi @swissspidy

 > There was an issue with empty strings in the wp i18n make-php command.
 Use wp cli update --nightly to get the latest version, and then run wp
 i18n make-php again.

 Thanks, I saw your reply in the comment, thought that it will be delivered
 along with 6.5 as well. Let me try.

 > That's why putting your custom translations there is not a good idea.
 You should contribute your translations on translate.WordPress.org :-)

 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.

 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.

 And it's the only way for us to decorate the plugins and let our visitors
 feel our branding. Otherwise, all the sites with same plugin will just
 look like replicas

 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
 That's why I put the MO files under /wp-content/languages/plugins/

 And it works fine under version 6.5

 > If you use the filter like this, WordPress will always use the MO file,
 not the PHP file. Are you saying this is not the case for you?

 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.

 > Hmm that doesn't sound right. This filter should work perfectly. Where
 did you put it? It might be running too late.

 I used code snippets plugin WPCodeBox to insert the codes. Please refer to
 screenshot https://d.pr/i/2k30Uy for the configurations.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60999#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list