How to Translate Your Theme by Poedit?

Table of Contents

1. What is Poedit?

Poedit is an software used for translating the content of website into different languages. Traveler theme can be translated manually so that they work in any language. To translate them, you need to use PoEdit software to translate the .po language file

Click here to download PoEdit Software(only free version on desktop OS is enough): https://poedit.net/

NOTICE:  

  1. To keep your website safe, we suggest translating its content and putting it into a child theme instead of changing the parent theme directly.
  2. Translation can also be used to replace specific text in the same language. For instance, you can change “tour” to “excursion” or “hotel” to “resort” 

Here is the video to show you how to translate your website into different language

2. Translation

  • Set your site language by navigating to WPAdmin > Settings > General > Site Language
  • Going to the folder wp-content > themes > traveler > language > traveler.pot and download to your computer.
  • Open this file traveler.pot after you’ve downloaded it with Poedit software
  • Create a new translation .po from traveler template

Kindly note that the .pot file is template only and don’t contain any translation themselves. Do not edit .pot file. To make a translation, create a new .po file based on the template by click Create New translation.

Translation Image 1
  • Choose the Translation Language. For example, we choose the Chinese(Simplified) language
Translation Image 2
  • Start to translate by input into Translation column
  • Click Save to finish your translation. The filename must be followed the WordPress Locale Code.

For example, Chinese (China) is zh_CN while Chinese (Taiwan) is zh_TW or English is en_US

Translation Image 3

Note:

To translate correctly, you must keep the original formula when translating to other languages. For example, you are going to translate the name of a car into other languages. So, the correct formula should be %s Car to %s ABC ( ABC – the name you want ), not to %ABC

Poedit Error

Note:

PoEdit will highlight yellow (Needs work) on the texts that are suspicious. If you are sure about your translation, kindly uncheck “Needs work” to let Poedit allow this translation

  • Upload your language file to the server.

    The .po file is used for editing and reading by humans, while the .mo file is used for reading by the system. Once you’ve saved the .po file, PoEdit software automatically generates the .mo file. For instance, you might have zh_CN.po and  zh_CN.mo file.

    Upload both files to either /themes/traveler/language or /themes/traveler-childtheme/language (if you’re using a child theme).

Note for WPML: Beside what’s mentioned above, you need to upload also into wp-content/languages/wpml with filename format traveler-locale.mo and .po

For example: traveler-en_US.mo and traveler-en_US.po

3. Updating full words

With each new version release, Traveler may add more words that need to be translated. You should update these new words in your .po language files.

  • Download the latest theme package and locate to \traveler\language\traveler.pot. This file contains all words from the latest update
  • Download and open your current .po language files
  • In the Poedit application, go to Translation > Update from POT file
Translation Image 4
  • Locate the latest traveler.pot file from step 1. Now you can translate the latest updated word
Translation Image 5

4. Translation when use child-theme

Generally, the admin puts the language file in the /themes/traveler/language folder if they’re only using the Traveler theme and not a child theme. However, these files can be overwritten when the theme updates.

To prevent this, you should put your language file in the /themes/traveler-childtheme/language folder. This way, your language file will be saved when the theme updates. Here’s what you need to do:

  1. Activate your traveler-childtheme theme.
  2. Create the language directory inside /themes/traveler-childtheme/ if it doesn’t already exist
  3. Put your language file in the /themes/traveler-childtheme/language folder.

5. Translating Plugin

To translate the text of an addon, plugin, or extension, you can do so by using the .pot file located in the plugin folder. For instance, you might find the file traveler-smart-search.pot in the Traveler Search Hotel VueWP plugin folder.

Once you’ve translated the text, you should name the .po language file traveler-smart-search-localecode, where “localecode” is the language code you’re translating to.

For example, if you’re translating to French, the file name would be traveler-smart-search-fr_FR.po.

After translation, put .po .mo files into wp-content/languages/plugins

6. Translating text of child-theme

This section is for developers only, for translating text in childtheme 
Insert these codes into traveler-childtheme/functions.php. The system will know to read language files from traveler-childtheme, instead of traveler.

				
					function child_theme_slug_setup() {
    load_theme_textdomain( 'traveler', get_stylesheet_directory() . '/languages' );
    load_child_theme_textdomain( 'traveler-childtheme', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'child_theme_slug_setup' );
				
			

$79