How to Translate Your Theme by Poedit?

Table of Contents

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

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

Translation

  • Choose your site language by navigating to WPAdmin > Settings > General > Site Language
  • Going to the folder wp-content > themes > traveler > language > traveler.pot and download it.
  • Open this file traveler.pot after you’ve downloaded it with Poedit software
  • Create a new translation. Remember that the Pot files are only templates and don’t contain any translation themselves. To make a translation, create a new PO file based on the template. Click Create New translation.
Translation Image 1
  • You have to choose the Translation Language you want. For example, we choose the Chinese(Simplified) language
Translation Image 2
  • Click Save to finish your translating text.
  • The filename must be followed the WordPress Locale Code. For example, zh_CN.po 
Translation Image 3

Note:

To translate your text correctly, you must keep the “%s” 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
  • 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 a zh_CN.po and a zh_CN.mo file.

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

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

Translating from 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. Put your language file in the /themes/traveler-childtheme/language folder.

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.

Translating text of child-theme

This section for developer only
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