There was a problem loading the comments.

Theme Translation

Support Portal  »  Knowledgebase  »  Viewing Article

  Print
Each of our Themes could be translated by:

  • One of available free to use WordPress plugins like: Loco translate and Polilang.There are many different free to use plugins that will help translating the theme but this two are my favorite.
  • Using translation editor like: Poedit.
No matter which option you will choose to translate the theme, it will need a POT (Portable Object Template) file to work. POT is generated from theme files and contain all phrases from the theme that can be translate to a different language.



In our themes, this file is called ct_theme.pot and is found on path theme_name > lang


*In Estato WP the file is called estato-theme.pot and the path to it is estato > language instead.



TKBPvR7VRB_Uxb4E3VVJSg.png



Plugins like WooCommerce are translated in separated file, woocommerce.pot and it can be found in path woocommerce > i18n > languages



Both plugin and translate editor will create PO (Portable Object) and MO (Machine Object) file from the theme POT file. The only file we are able to edit is the PO file. In the PO file, we are saving both English and translations for this phrases. All translations we created are added there. Saving the changes there will also update the MO file that is used by the theme.



Strings that can be translated
This a PHP code that allows Post in string used in the theme to be translated. It is a basic function that will return the text in the correct language if it was translated to it.



<?php $pageTitle = __('Posts in', 'ct_theme') . ' ' . single_cat_title('', false); ?>


Phrases that can be translated by the theme file will have 'ct_theme' in the function. For example Strings that are translated by WooCommerce plugin will have 'woocommerce' added instead.



Common translate issues
If the theme used is WooCommerce but some of the words aren't translated by WooCommerce, please make sure that the string from PO file and the one in the theme is exactly the same. This translations are case sensitive so if the string in the theme is "Add to cart" but in the PO file it's "add to cart", the string from theme will not translate.

- to fix it:

  1. We can change the the string in the theme to add to cart so it will be translated by the plugin
  2. We can change 'woocommerce' to 'ct_theme' and let the user translate it in the theme files instead.
How to translate theme using Loco Translate plugin
Loco Translate is a plugin you can use to translate a theme. For more information on how to translate a theme using Loco Translate, click this link.



How to translate theme using Poedit
  • Create a .po file if you don’t have it using the ct_theme.pot file.
  • Choose the language and translate the .po file content.
  • This will create a .po file ct_theme-es_ES.po (the name is ct_theme-language_language). Save the .po and .mo files on path /wp-content/languages/themes/.
For more information on how to translate a theme using Poedit, click this link.


Share via
Did you find this article useful?  

Related Articles

© createIT