We are hear a lot about localization, and recently I come through a question about how to change site language in WordPress, and that was the only reason which stopping this user to migrate from Joomla to WordPress. So let me cover answer here, changing Site Language in WordPress is pretty simple, and its inbuilt functionality of WordPress.
(I am assuming you using WordPress Version >4.0) For Changing Site Language, Login in to WordPress Admin Panel (WP-admin), Go to Settings>General, on bottom on this page, you will be seeing an option to Change your site language, choose your language and you done, yes it’s that simple.
Now All the WordPress Core strings will be changed to your new selected language. Like we take example for German language e.g. deutsch which locale code is de_DE, (you can find for all language here locale code here http://wpcentral.io/internationalization/.), So once Change to deutsch, your all WordPress core strings will be changed to deutsch or German language but there is definitely chance that your themes has its own custom strings and they don’t get changed, So now we will discuss how we can translate those strings. If your theme is translation ready ( all our themes are translation ready), you will be finding a lang or languages forlder in your theme, and in that your will be having one .po and .mo file which will be most of the time en.po and en.mo. Using these files we can translate your site in any language.
So to get done translation for theme, we will need PoEdit software; it’s Open Source software for translation and can be downloaded from here for free, https://poedit.net/.
Now to proceed with translation we need to know theme Text Domain. For most of our themes its ‘navthemes’. If you’re using any other theme, open your style.css of theme and it should be in comments, check image.
And if you not find it there, contact theme author else you need to look for this function in your theme files, most probably it should be in functions.php
load_theme_textdomain( 'navthemes', get_template_directory() . '/languages' );
First argument e.g. ‘navthemes’ is your text domain. Last argument e.g. ‘languages’ is the folder where yours .po and .mo files are.
So now to translate theme in German or deutsch, we will rename .po file as textdomian-locale.po like for our themes it would be navthemes-de_DE.po. Notable is that you should always have backup of your original en.po and en.mo. So now we have a .po file which is navthemes-de_DE.po. Now open this file in Poedit. Now once open you will be seeing a screen something like this
Now go to Catalog > Properties, check image
Once click on it you will seeing a window something like below image and from this window change language to your language like for German I will change it to German. And click ok.
So now you can see all source texts in left rows. you can update a translation like below image. When you select a source code text this Poedit edit shows you suggestions of that string as per language selected on most right bar (Translation suggestions), you can click on it to use it, it will be showing on Translation-German Column (as per image), or you can write your own translation, for a string in bottom Translation box and it will appear in respective row in Translation-German Column.
So this is how you can update translation for all theme strings. And once you done save it, once you save, Poedit automatically generates .mo file as well, if not you can do it from file> Compile to MO. Now once saved both files, your theme strings on web page will change as well, you can refresh page to see, if not you might need to copy both files and paste them in your
Sometime WordPress takes locale Files from there. So that’s all about translating a theme. Let me know your feedback in comments 🙂
Image Credit : wplang.org (http://wplang-1109.kxcdn.com/wp-content/uploads/2014/06/Wordpress-Internationalization-Localization.png)