A wat to preserve language files when updating themes and plugins
In the current situation when I update a theme or plugin all files are deleted before the updated software is being put in place. This means that language files which are not incorporated in the theme or plugin are gone after update.
I have two suggestions:
- Search for translation files in the languages folder in wp-content and wp-includes.
- Let the update script check for extensions .po and .mo before deleting all files.
I see the problem. But what if the plugin includes updated translation files?
The best method would probably be to overwrite existing .po and .mo files.
BTW The reason I submitted this idea is that I rarely use the easy update feature in WordPress. So I'm still stuck with the old fashioned downloading, unpacking, FTP uploading, etc.
Best thing would be to submit your translation to GLOTPRESS
available at http://translate.wordpress.org/projects which is also completely in sync with the main repositories and the preferred method for translating WordPress into your language.
This way your translation will be incorporated into plugin
I'd suggest that /wp-content/languages/plugin-name.mo be the first place where a plugin/theme search for its language files.
Then it's up to the user to sync new versions with his translated files.
Sometimes, you update something (in development or production site) and then "ups..., forgot to backup my translations..."
Why not make a child theme to preserve the custom language? For me that seems to be the best solution...
@Binary, only if there were child plugins too :)
The perfect world is supposed to be that the plugin dev will add any language packs you send them. Doesn't always happen.
Option 1 would be best, IMO. Just totally separate it, so if you have to delete a plugin due to bug sillyness, it's easier to replace.
I think you should encourage plugin developers to use GlotPress.
At the same time, the framework should provision for "child translations" for GlotPress (the few fields where site owner can specify a custom translation different from the GlotPress version)
Just found an excellent article: Loading WordPress language files the right way, by Geert de Deckere.
My conclusion from 4 lines of code is that it is up to plugin and theme developers to do it the right way: check first inside WP_LANG_DIR and fallback to defaults if not found there.
IMO, now it's a matter of getting this info in the Codex and related documents. Encourage plugin/theme authors to implement this concept and give a clear advice to users where to put his/hers translated files.
Just tested with one of my plugins and it works!
RSS feed for this topic
You must log in to post.