New performant translation upgrade safe
-
I used to make my custom translations upgrade safe with this function:
https://developer.woocommerce.com/docs/making-your-translation-upgrade-safe/But this doesn’t work anymore since the use of performant translation files (.l10n.php) and I can’t find a fix. Could you help me on this issue?
-
Hi @lqdmbr
Currently, custom translations should be placed in the
wp-content/languages/pluginsdirectory to ensure they’re upgrade-safe as indicated on the doc you shared. Instead of the .po and .mo files, you’ll need to use .json files that match the text domain of the plugin, followed by the locale, likewoocommerce-de_DE.jsonfor German.For creating these .json files, one suggestion is to use plugins like Loco Translate which handle the new format and keep your custom translations intact through updates. This way you minimize the technical hassle of creating and updating translation files, as it takes care of the file creation and placement for you.
Hope this helps.
Hi @reynierc
Thanks for the answer. What I don’t quite understand, however, is that if I place translations in wp-content/languages/plugins, they are not protected from updates and are automatically updated at the first opportunity.
Apart from that, is there no way to load a custom version of woocommerce-de_DE.l10n.php?Hello bjobst,
Thank you for your reply.
What I don’t quite understand, however, is that if I place translations in wp-content/languages/plugins, they are not protected from updates and are automatically updated at the first opportunity.
It is the opposite. Placing translation files in translations in wp-content/languages/plugins makes sure the files are not overwritten when a plugin is updated.
Please note that custom is not covered by our support policy.
For more customization queries, I suggest you contact a professional WooCommerce developer.
You can find one at Codeable.io or WooExperts.comI hope this helps. 🙂
Best regards.
I’m sorry, but that’s not true. I modified the file “woocommerce-de_DE_formal.l10n.php” slightly and saved it in the folder “wp-content/languages/plugins”. As soon as the translations are updated by WordPress, the adjustments disappear and the plugin’s standard translation for German is loaded. One can also check this directly on the file’s modification date on the server.
Where do I have to save my customized file “woocommerce-de_DE_formal.l10n.php” so that it is loaded correctly and not overwritten?
Hi @lqdmbr,
Thank you for the details! To ensure your custom translation file isn’t overwritten during updates, you’ll need to save it in the following location:
wp-content/languages/woocommerce/
Here’s how to proceed:
1. Create a folder named woocommerce inside the wp-content/languages/ directory if it doesn’t already exist.
2. Save your custom translation file (woocommerce-de_DE_formal.mo, not .l10n.php) in this folder. Make sure the file has a .mo extension, as WordPress uses this format to load translations.
Files placed in wp-content/languages/plugins/ are managed by WordPress and can be overwritten during updates. Storing your custom translations in wp-content/languages/woocommerce/ ensures they are upgrade-safe and loaded correctly.
Let me know if you have further questions!
This approach used to work, but since WooCommerce now automatically loads Performant Translations (.l10n.php), it no longer does. Even if the .php file is removed from
wp-content/languages/plugins/, it gets reloaded and prioritized during every translation update in WordPress.
I’ve now customized individual strings using the plugin “Say What.” This seems to work and withstand updates.hI @lqdmbr
It’s great to hear that you’ve found a solution with the “Say What” plugin for customizing individual strings.
Using a translation management plugin like what you mentioned is definitely the safer option. These plugins help you manage translation updates and make sure your custom translations remain intact, even after major WooCommerce or WordPress updates.
Most of them are easy to use and don’t need any technical skills or custom code.
The topic ‘New performant translation upgrade safe’ is closed to new replies.