How to Translate WordPress Theme (In Multiple Languages)

Translate WordPress theme tutorial

Need a way to translate your WordPress theme in other languages?

WordPress theme localization and internationalization are important because WordPress is used by people all around the world. Having a theme only available in a single language limits where it can be used and makes it more difficult to create a multilingual WordPress site.

However, not all WordPress themes are translation ready. And even if a theme is translation ready, there are some quirks, like user-generated content, that can make it difficult to create a fully multi language WordPress theme.

To help you fully understand WordPress theme translation, we’re going to cover two things in this post:

  1. What it means for a WordPress theme to be “translation ready” and how theme internationalization works.
  2. How to use TranslatePress, a WordPress translation plugin, to translate any WordPress theme, even if it’s not 100% translation ready.

What Makes a WordPress Theme Translation Ready? How to Make Theme Strings Translatable

Don’t worry if this section seems complicated – we’ll show you a simpler way to translate WordPress themes in the next section.

Additionally, if you’re a WordPress user (rather than a developer), you probably won’t have to interact with these concepts, especially if you use the TranslatePress plugin.

The Nitty-Gritty on How WordPress Theme Translation Works

The standard method for making WordPress theme strings translatable involves:

When a developer creates a theme, they need to use something called gettext when adding text that will be displayed by the theme (like the “next page” link on your blog list page).

Developers can accomplish this by wrapping text strings in a localization function, rather than hard-coding in the text.

Here’s a simple example of hard-coded content vs a WordPress theme with proper internationalization:

Hard-coded text (not translation ready):

<p>Next Page</p>

Gettext/localization function (translation ready):

<p><?php _e( 'Next Page' ); ?></p>

If you’re not sure what’s going on there, here’s the basic difference in plain English:

  • No gettext – the theme tells WordPress, “hey, this text string is always ‘Next Page'”. It doesn’t think about language at all – it’s just “Next Page” no matter what.
  • With gettext – the theme tells WordPress “hey, display whatever the equivalent of ‘Next Page’ is in the selected language.” For example, if the language is Spanish, it displays the Spanish equivalent.

To go along with the theme being properly coded, you also need a MO or PO file. Essentially, this file contains a list of all the theme’s gettext strings in the target language. The base file is usually in English, but developers or contributors can add more language files for other languages.

For example, when the theme needs to display the equivalent of “Next Page” in Spanish, it will go to the Spanish language file to get the proper translation.

You can create and edit a theme language pack using software like POedit. Many WordPress themes also already include language files for a good number of languages already.

If you’re looking at a theme at WordPress.org, you can look for the Translation Ready tag to verify that the theme follows proper internationalization standards.

Then, if you click on the Translate [Theme Name] option in the sidebar, you can see a list of all translations that are already included in that theme’s language pack:

Translation Ready WordPress theme

In the translations section, you’ll be able to see each language, as well as how complete its translations are:

WordPress theme translation languages

Different Types of WordPress Theme Content

So far, we’ve focused on WordPress theme localization with gettext. Again, this is the way to make what would be static theme content translatable. By “static theme content”, we mean stuff that’s always present like:

However, a lot of themes also let you add your own user-generated content, which requires a different approach. For example, the Hestia theme lets you build your own homepage design using options in the WordPress Customizer:

Example of user-generated content

All of this content will be different for each site, so it wouldn’t be stored in a theme’s translation file or use the gettext filter.

So…how can you translate this user-generated content? Well, with many WordPress translation plugins, you’d need to manually mark each string of user-generated content as translatable, which adds complexity and time to localizing your theme. So if the theme developers don’t add support for the translation plugin you’re using, it just won’t work at all.

However, with the TranslatePress plugin, which we’ll show you in the next section, you can translate this dynamic, user-generated theme content right out of the box. It will work with any WordPress theme, no extra compatibility needed.

How to Translate WordPress Theme Strings with TranslatePress

For the easiest way to translate a WordPress theme, you can use the TranslatePress plugin. Not only is it a WordPress theme translation plugin, but it will also let you translate the rest of your WordPress site, too, including plugin content and even AJAX strings.

TranslatePress will work for all themes, including both themes that are translation ready and those that aren’t.

In more technical terms, this means that you can translate:

  • gettext content (the “proper” way to code for internationalization in WordPress themes).
  • Content from themes (and plugins) that aren’t using gettext.
  • User-generated content from theme options, user meta, or even a custom database table.

Basically, whether your theme is or isn’t translation ready, you’ll be able to manage all of your theme translation efforts using a visual interface that looks a lot like the familiar WordPress Customizer:

Example of how to translate a WordPress theme

If your theme comes with its own language pack, TranslatePress will automatically detect and use those translations for theme gettext strings. But you’ll still be able to manually edit translations from the language pack if you’d prefer to use different translations.

Here’s a quick guide to how to translate a WordPress theme with TranslatePress…

TranslatePress Multilingual

TranslatePress is the easiest way to translate your WordPress site. It's fast, won't slow down your website, works with ANY theme or plugin and it's SEO friendly.

Get the plugin

1. Set Up Basic TranslatePress Settings

Before you can start translating your WordPress theme, you need to set up a few basics.

First, install and activate the free TranslatePress plugin from WordPress.org. Then, go to Settings → TranslatePress to choose the language(s) into which you want to translate your WordPress theme (and the rest of your site’s content):

Choose languages for theme translation

TranslatePress also gives you the option of automatically translating your website (and theme) using Google Translate or DeepL.

If you opt to enable automatic translation, TranslatePress will automatically translate your entire theme. Then, you still have the option to go back and make manual changes.

To set up automatic translation, go to the Automatic Translation tab in the TranslatePress settings:

Automatic translation settings

2. Open the TranslatePress Editor

Once you’ve set up the basics, you can open the visual translation editor by:

  • Visiting the page with content that you want to translate.
  • Clicking the Translate Page button on the WordPress toolbar.

How to open WordPress theme translate editor

You should see a live preview of the page. To translate any element on the page, you can hover over it and click the pencil icon. That will open the translation in the sidebar where you can add your translations:

Example of how to translate a WordPress theme

Let’s go through how to translate different parts of your theme.

How to Translate WordPress Theme Gettext

If you recall from earlier, many WordPress themes already include language packs for popular languages. If this is the case for your WordPress theme, TranslatePress will automatically use those translations for gettext strings – you aren’t forced to translate everything from scratch.

However, you still have the option of manually editing your theme’s gettext strings.

So how can you tell whether a string is gettext or not?

It’s easy:

If the pencil icon is green when you hover over a string, that means the string is gettext. Here’s what it looks like for the “Next” pagination button:

Translating theme gettext strings

If your theme has the relevant language pack, TranslatePress will automatically fill in its translation. You also have the option of “translating” the gettext string in the original language, as well.

Any translations that you save here will apply to all instances of that string (even beyond this page).

How to Translate WordPress Theme User-Generated Content

Being able to translate gettext content will cover most of your WordPress theme’s content. But what about user-generated content, like the Hestia example from above?

Well, the basic process is exactly the same. You just hover over the text and click the pencil icon.

The main difference is that, since this user-generated content isn’t coming from gettext, it won’t have the green indicator. Instead, the pencil icon will be blue.

Here’s what it looks like for the user-generated theme content in Hestia:

How to translate WordPress theme user-generated content

You Can Translate the Rest of Your WordPress Site, Too

The great thing about TranslatePress is that it’s not just for WordPress theme translation – you can also use it to translate your pages, blog posts, forms, plugin content, and lots more.

It’s the easiest way to create a multilingual WordPress site.

We have detailed tutorials on how to translate popular types of WordPress content including:

Translate Your WordPress Theme Today

WordPress theme internationalization and localization is an important part of making your WordPress theme accessible to visitors from all around the world.

For an easy way to translate both WordPress themes that are translation ready and those that aren’t, you can use the free TranslatePress plugin.

TranslatePress will automatically detect your theme’s gettext strings, while also giving you the ability to edit those existing gettext strings and the rest of your theme and site’s content.

TranslatePress Multilingual

TranslatePress is the easiest way to translate your WordPress site. It's fast, won't slow down your website, works with ANY theme or plugin and it's SEO friendly.

Get the plugin

The free version lets you translate your theme into one new language, while the premium version adds support for unlimited languages as well as:

  • Improved multilingual SEO
  • DeepL integration for automatic translations
  • Dedicated translator accounts
  • Separate navigation menus based on user language
  • The option to browse your site (and translate content) as different user roles

Get started today!

Leave a Reply

Your email address will not be published. Required fields are marked *