We are hear a lot about localization, and recently I come through a question about how to change WordPress website language, and that was the only reason which stopping a user to migrate from Joomla to WordPress. So let me cover answer here, changing site language in WordPress is pretty simple, and its a inbuilt functionality of WordPress.
For changing WordPress site language, login in to admin panel (wp-admin) > go to Settings > General > on the bottom of this page, you will be seeing Site Language option > choose your language and you’r done, yes it’s that simple.
Now all the WordPress core strings will be changed to newly selected language. Like we take example for German language e.g. deutsch, it’s locale code is de_DE, (you can find locale code of language here: http://wpcentral.io/internationalization/) So once website language is changed 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, you will see 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 WordPress theme in any language.
So to get done translation of theme, we will need PoEdit software; it’s open source software for translation and can be downloaded for free, https://poedit.net/
Now to proceed with translation we need to know theme Text Domain. For this open style.css of theme and it should be in comments, check image shown below:
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 located.
So now to translate WordPress theme in German or deutsch, we will rename .po file as textdomian-locale.po (for our themes it would be navthemes-de_DE.po). Notable thing is that you should always have backup of your original en.po and en.mo. So now we have a .po file which is textdomian-de_DE.po. Now open this file in Poedit. Once the file is open you will be seeing a screen something like this:
Now go to Catalog > and select Properties, as shown in the image below:
Once you click on it you will seeing a window something like below image and from this window change the language and click OK button.
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 or you can write your own translation for a string in bottom Translation box and it will appear in respective row in Translation column.
So this is how you can update translation for all theme strings and once you are done save it. When you save it, Poedit automatically generates .mo file as well, if not you can do it from file > compile to mo. Now when you save 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
Sometime WordPress takes locale files from there. So that’s all about how to change WordPress website and theme language. Let me know your feedback in comment section below 🙂