TownHub - Listing & Directory WP Theme

⌘K
  1. Home
  2. TownHub – Listing &...
  3. Theme & Plugin Translation

Theme & Plugin Translation

The theme and its plugins come localization ready out of the box – all that’s needed is your translation, if the theme does not come bundled with one for your language.

There are several methods to create a translation, most of which are outlined in the WordPress Codex. However, we find the easiest method is to use a plugin called Loco Translate. More advanced users can use PoEdit. Both methods are covered in this doc.

Before you begin

The theme includes a language file (.po or .pot file) which contains all of the English text. You can find this language file inside the theme folder in \public_html/wp-content/themes/theme_name/languages/.

Set up WordPress

WordPress needs to be told which language it should run under.

  1. Go to: Dashboard > Settings > General and change the Site language.

Once this has been done, the theme will be displayed in your locale if the language file exists. Otherwise you need to create the language files (process explained below).

Translate with Loco Translate

Loco Translate is a free plugin that you can download here. You can also add directly from the WordPress administration, in Plugins > Add New.

Once you downloaded and installed Loco Translate, a new “Loco Translate” menu item is created with two sub-sections. By default the “Manage Translations” section will list all your themes and plugins and will display all available translations for each of them:

You can easily add new languages to a theme or a plugin using the Add New Language link:

Then choose the language to add in the list, or enter the language ISO code (ex: fr_FR, en_US etc…), and select the folder to add the translation files to, and hit Start Translating:

NOTE: don’t save your translation into Author folder, which will be replaced when update theme/plugin

Finally start translating, and save when you finish:

Theme Update

TownHub theme and its Add-Ons plugin are frequently updated with new texts added. So after update theme, plugin you have to use Sync button on Loco Translate plugin to get new texts

For existing translations, you can use Copy button to make a System saved version. And the system version is loaded first.

Can’t find translation texts?

If you can’t find texts to translate, edit theme/plugins template file ( .pot file ) to get texts from theme/plugin files.

Don’t forget change the plugin’s settings to get texts from large file

Then edit your translation ( .po file ) and click to Sync button to get newly imported texts to translate, as mentioned in Theme Update section.

Translate with PoEdit

PoEdit is a more advanced alternative to Loco Translate. Only advanced users should attempt this method.

CityBook comes with a POT file which can be imported into PoEdit to translate

To get started open PoEdit and go to File > New catalog from POT file. Once you have done this, choose citybook.pot and PoEdit will show the catalog properties window:

Enter your name etc so other translators know who you are and click ‘ok’. After this you will be prompted to save your .po file – name it based on what you are translating to, for example, a GB translation would be saved as en_GB.po . Now the strings will be listed.

After translating all strings you can save – the .mo file will also be generated automatically.

Translate the strings

Update your translation

After updates, you can update your po file by opening it and then going to Catalog > Update from POT file. Choose the file and it will be updated accordingly.

Articles

How can we help?