Site icon NavThemes

How to Change Website and Theme Language in WordPress

How to Change Website and Theme Language in WordPress

Site localization is a big thing nowadays. It makes the site seem more authentic and improves the user experience. So it comes at no surprise that a lot of people want to know how to translate their site from the default English language to their local one.

Changing the language in WordPress really isn’t that big of a hassle since it is a built-in functionality, it’s also very convenient since WordPress is fully translated into 65 languages.

Your #WordPress site and theme are by default in English and you want to translate them to another #language? Learn exactly how you can do that in this article! Share on X

But there is one thing that should be pointed out before we get into explaining the process, and that is that changing the WordPress site language translates the display language and some of the text in the theme, but of course. it does not translate post or page content.

With that out of the way, let’s get into how you can change the site language in WordPress!

Changing the language through the Admin dashboard

To change the site language in WordPress you will first have to access the Admin dashboard. After doing so, go into the Settings tab and then the General section.

Somewhere around the middle of the General section will be the conveniently named Site Language setting.

To configure that setting to your liking you will be offered a dropdown list containing installed and available languages.

Simply pick your language of choice, click on the Save Changes button at the bottom of the page, and you’re done. Yup, it’s that easy!

Manually installing a language

Depending on how commonly used your language of choice is, it might not be included in your installation. In that case, you have to first download the language file and then complete a manual installation.

Let’s demonstrate this with Irish for example.

Go to the official blog of the WordPress translators team, find Irish (or whichever language you need), and click the percentage value in the row dedicated to the language

On the page you are taken to next, in the column named Set/Sub Project click on the version number. For Irish, the version is named 5.4.x – Development (29%). The development (29%) status indicates that the translation is 29% ready and has not been tested yet.

Next, go to the end of the page, find the export option shown in the image below, and select Machine Object Message Catalog (.mo) as the export file type. By doing this you will initiate the downloading of the file to your computer.

Now to install the language, log in to cPanel, and click the file manager option. Using the file manager, locate the wp-content/languages folder (if you don’t have a folder named languages, just click on New Folder and create it), open it, and click Upload.

Finally, using the Upload option, upload into cPanel the Machine Object Message Catalog (.mo) file you downloaded earlier. Once the upload is complete, just log out of cPanel and your installation should be complete!

Now when you go into the WordPress Settings page, the newly installed language should be available for selection on the Site Language dropdown list.

Changing the language of your theme

After you change your site language through the Settings tab in WordPress, all the WordPress core strings will be changed to the newly selected language. But there is a chance that the theme you have installed on your site has its own strings which won’t get changed.

For that reason, we will now talk about how you can translate the strings in your theme. So let’s get started!

Some themes are translation ready, and some, unfortunately, aren’t. The ones that are will contain a “lang” or “languages” folder, and within that folder should be two files one with a “.po” and a folder with a “.mo” extension (“en.po” and “en.mo” for example). These two files are used to translate a WordPress theme in any language. How?

Well, to start doing the translation, you will need to download and install a free open-source software solution called Poedit. Once you have done that, you will need to find out your theme’s Text Domain. This info is stored away in the “style.css” file of your theme which you can open using any text editor.

Upon opening it, you will be presented with something similar if not the same as shown in the image below.

If in the file you can’t find the Text Domain information, then you should contact the author of the theme and ask where else should you look. In most cases, if its’s not in the “style.css” file, then it might be in the “functions.php” one and should look something like this:

load_theme_textdomain( ‘navthemes’, get_template_directory() . ‘/languages’ );

The first argument in the function will be your text domain, which is in our case “navthemes”. The last argument which for us as you can see is “languages” is the name of the folder where your .po and .mo files are located.

Now, in order to translate a WordPress theme that is, for instance, currently in German, we will rename the .po file (its format should be “yourtextdomian-locale.po”) which for us is called “navthemes-de_DE.po”.

Note that before making any changes to either the “.po” or “.mo” file you should always create a backup of them first so you can go back to the original if ever needed.

To rename the file, you need to open it using the already-mentioned Poedit tool. After you do so, you should see a screen like the one in the image below.

On that screen, click the Catalog tab and then select Properties.

Once you click on Properties you should be promoted by a popup in which you will be able to enter a project name. Enter the name and click the OK button.

Now, all of your theme’s source text will be shown, along with its translation. You can update this translation by clicking on a particular piece of the source text and writing your own translation for it in the Translation box.

Of course, you only need to do this if you aren’t happy with the suggested translation generated by Poedit.

If you do make any changes to the suggested translations of the source text be sure to save the file.

Once you save it, Poedit will automatically generate a “.mo” file as well, but if by any chance it doesn’t, you can do so yourself by clicking on the File tab and then the “Compile to .mo” option.

The last thing you need to do is save both files and refresh your page to see the changes in your theme strings and web pages as well.

If no changes have occurred, then you will need to copy the two files and paste them in the “wp-content\languages\themes” folder. That should do the trick!

Conclusion

And that ladies and gents was a demonstration of how you can change your WordPress site and theme language.

We hope these methods work as well for you as they did for us. But in case you have any questions, concerns, etc., please let us know in the comments below!

Exit mobile version