Skip to main content

How to Translate the Theme?

The three ways below translate the theme's own words: the labels, buttons and dates Foxiz prints around your content. None of them translates the posts and pages you write. To publish your posts in more than one language, you need a multilingual plugin: see How to Translate Your Posts into Other Languages.

You can translate Foxiz into your language in three ways:

  • Quick Translation, a screen in the Foxiz admin: a fixed list of front end strings, typed in one by one, with no file.
  • Loco Translate, a plugin that writes PO and MO files for every string, from inside WordPress.
  • Poedit, a program on your computer that does the same from the theme's POT file.

When a string is translated both in Quick Translation and in a PO file, Quick Translation wins. A string left empty in Quick Translation uses the PO file's translation.

So translate the whole theme with Loco Translate or Poedit first, then use Quick Translation only for the strings you want to word differently.

Before you pick one, two things are worth knowing, because all three routes below run into them.

There are two text domains, not one. The theme's strings belong to foxiz and the Foxiz Core plugin's strings belong to foxiz-core.

A good part of what a reader sees on the front end is printed by the plugin, so a site translated only under foxiz comes out half English. The theme includes languages/foxiz.pot and the plugin includes languages/foxiz-core.pot, one template each.

Where you save the files decides whether they survive an update. Foxiz looks for the theme's translation in three places, in order: wp-content/languages/loco/themes/, then wp-content/languages/themes/, then the languages folder inside the theme.

Only the first two are outside the theme, and only the first two are still there after the theme updates. The plugin works the same way with wp-content/languages/loco/plugins/ and wp-content/languages/plugins/.


Setting the Default Language of WordPress​

Translations only show once WordPress runs in your language, so set that first. Navigate to Settings > General, pick your language in the Site Language field and click Save Changes.

The Site Language field on Settings > General set to Français

note

Changing this option tells WordPress you want to use translation


Quick Translation​

The theme supports quick translation, that allows you to quickly translate text via the Foxiz admin, under Extra Features > Quick Translation. It is not part of Theme Options.

Please refer to Quickly Translate Theme for further information.


Translate via LOCO translate plugin​

The easiest way to translate your entire website is to use Loco Translate plugin. Please follow the steps below:

  • Tell WordPress what language to use. Navigate Settings > General and select your language in Site Language.
  • Download the plugin: https://wordpress.org/plugins/loco-translate/
  • Follow the instruction steps of the plugin, create a .PO file and translate text you want.

You can continue reading the article below for further information: How to Use Loco Translate Plugin to Translate the Theme.


Translate theme Using Poedit (.POT file)​

Poedit is easy to use open-source program available for Mac OS X, Windows and UNIX/Linux.

  1. Install Poedit, and copy the two POT files to your computer. They are on your server at wp-content/themes/foxiz/languages/foxiz.pot and wp-content/plugins/foxiz-core/languages/foxiz-core.pot: download them with FTP or your host's file manager (What is FTP?), or take foxiz.pot from the languages folder inside the theme zip.

  2. Open Poedit and go to File > New from POT/PO File and select the foxiz.pot you copied (it comes from the theme's languages folder). The file is foxiz.pot. The Foxiz Core plugin keeps its own foxiz-core.pot in the plugin's languages folder, and you need both to translate the whole front end.

  3. A catalog properties box will pop up asking for information about what you are translating. Enter the language you want to translate here.

  4. After you hit “OK,” you’ll be asked what you want to name your translation file. The name is important and there’s a particular format you will need to follow. A theme translation is named for the text domain as well as the locale, so for Español the file is foxiz-es_ES.po and for Français it is foxiz-fr_FR.po. The Foxiz Core files are named foxiz-core-es_ES.po and so on.

    note

    Check out the GNU `gettext’ utilities to find your language and country codes.

  5. Save your file in wp-content/languages/themes/, not in the theme's own languages folder. The theme reads that location, and unlike the folder inside the theme it survives a theme update. Foxiz Core files go in wp-content/languages/plugins/.

  6. Now you can start translating the strings you want. Poedit has a simple and straightforward interface that doesn’t involve a steep learning curve. The space at the top will display all the text ready to translate, and any completed translations will display to the right. The boxes underneath show the source text you’ve selected to translate, your translation and any notes for translators. Translating a line of text is really easy: just select a word or phrase, enter your translation and click “Update.”

  7. When you’ve finished translating, simply save your file. Poedit will automatically create both .po and .mo files beside it. The .mo file is the one WordPress reads.

  8. If you worked on your own computer, upload both files to wp-content/languages/themes/ over FTP or through your host's file manager. Do not zip the theme up again and reinstall it: putting the files inside the theme is what loses them at the next update.

That's all.