Language translation in wordpress (tips)

Its important to think of language translation when creating plugins, hence is important. Use __ or _e whenever possible.

I strongly recommend poedit for text translation. In poedit, open an existing language file and save it again under your locale but named differently eg woocommerce-zh_AU.po – see 2 files will be created, ie .mo and .po in the default plugin directory. The trick though is not to save them in the plugin directory or else it is possible that your files could be gone upon plugin updates. Where do you save it then? save it in /wp-content/languages/{plugin_name}/{translated_file}, in my example, it will be /wp-content/languages/woocommerce/woocommerce-zh_AU.po and

Next, define your new locale in wp-config.php

// how about some australian chinese
define ('WPLANG', 'zh_AU');

All done.

Like it.? Share it:

Comments are closed.