WordPress is awesome, but there is something that is driving me crazy.
Whenever a plugin or a theme is updated, all files are deleted and replaced.
So if I have custom code or a translation in one plugin, it will get lost!
I’ve seen some solutions suggesting to change the textdomain of the plugin to load language files from wp-content/languages, but if I write a custom function to load the *.po and *.mo from wp-content, directly in the plugin code, it will get overwritten too.
So I was wondering how I can update my plugins, without losing the translation or the custom code.
I ended up with WPML strings that do the job, by saving translation in DB, ( I’m not sure if is the way) but WPML is a very heavy plugin, and I will have to install it in all sites, which makes it difficult to maintain.
Is there any function to overwrite all textdomains of a plugin, so I can have all of the translations in wp-content/languages, without changing plugin code?
Here is a patch for 3.5 to use this with plugins.
Use
wp-content/languages/plugins/textdomain-pt_BR.po
Apply this via SSH with:
patch -p1 < no_plugin_overwrite.patch
Hopefully its gonna be released in 3.6.