Okay
  Print

How to translate the theme in your own language ?

Translate in your own language

  1. Download and Install PoEdit software: https://poedit.net/
  2. Unzip the theme file you have downloaded from ThemeForest.
  3. In the folder /Theme/ you will see the theme .zip file. Unzip it as well.
  4. Open Poedit and click on File -> New from POT/Po file in the main menu and select the POT file in your theme’s languages folder. The .POT file should be located in your /Theme/theme_name_folder/languages/
  5. A properties box will open up. Select the language name you want to translate to.
  6. Now you can start translating the theme via the String Translation mechanism. This provides direct like-for-like translations. Go through each line one-by-one, adding the translation to your native language as you go. If you think there’s some text that won’t require translation or you’re not sure what to translate it to you can just leave them as they are in the original language; you can always come back and translate them later if need be. You don't have to translate everything. Remember that strings that you have not translated will appear in english in your site. The string you have translated will show the corresponding translations.
  7. Go to File -> Save. You’ll be asked to what filename you want to save your .po file. Each language and country has a specific code you will need to use when saving translation files; for instance, if you’re going to translate into Spanish you’ll name your file “themename-es_ES.po”, whereas if you’re translating into German you’ll name the file “themename-de_DE.po”, french from France will be "themename-fr_FR.po", french from Canada will be "themename-fr_CA.po". To break it down; the first lower-case letters defines the language, whereas the second upper-case letter defines the country. In many cases the language and country will be the same, hence “de_DE” for Germany, but what about languages like English or Portuguese, that are spoken in several countries natively? In these cases there will be a difference in the first and second letter pairs; for the UK, the code would be en_GB, whereas for the USA it will be en_US. If you’re not familiar with the codes for your native language and country you can head over to the GNU website, where they have all the codes for Language and Country. Remember, if you use the wrong naming convention WordPress won’t be able to use your translation, so double-check if necessary.
  8. Save your new language file in the wp-content/languages/themes/theme_name-fr_CA.mo . In this case, we are translating a theme called SoundRise in French-Canada. The filename will be soundrise-fr_CA.mo . See screenshot: http://d.pr/i/iVUn
  9. Some strings is located in the plugin "soundrise-music". You need to repeat steps 4 to 8 as you did for the theme. The pot file in the plugins/plugin_name/languages folder, and you will save the mo file in the wp-content/languages/plugins/plugin_name-fr_CA.mo

Setup Wordpress to read your translation

OPTION 1. IF YOU ARE USING 2 LANGUAGES ON YOUR SITE:

  1. Make sure the language value you are translating is set in your translation WordPress plugin. In this case, we are using WPML plugin/
  2. - Go to WP-admin > WPML > Language. Add/Edit the language you want to translate (http://d.pr/i/ssZZjo) and click "Edit languages"
  3. - Make sure that the default locale is corresponding to your .mo file you previously saved. In this case, it will be fr_CA since my .mo file has been named: soundrise-fr_CA.mo (where soundrise is the name of my theme and fr_CA is my default locale, separated by a dash) See screenshot: http://d.pr/i/wNxvu7

You are done!

OPTION 2: IF YOU ARE USING ONLY 1 LANGUAGE ON YOUR SITE

You’ll need to make sure your wp-config.php file settings match your language files. Edit the file wp-config.php which is located in your root folder (See screenshot: http://d.pr/i/1fQmH) You’ll need to open the wp-config.php file and set your language accordingly, like this:

 


/** * WordPress Localized Language, defaults to English.  *  * Change this to localize WordPress. A corresponding MO file for the chosen  * language must be installed to wp-content/languages. For example, install  * es_ES.mo to wp-content/languages and set WPLANG to 'es-ES' to enable Spanish  * language support.  */ define('WPLANG', 'fr-CA');

 

 

Share your language files with others

If you’ve already translated a theme then many of our users would be delighted if you could share your translation files with the community. Just get in contact with us via our Helpdesk ticket system and we will include the translation files in the next theme update if possible.

 

Translation tips: Character Encoding

If you’re used to working in HTML or through the WordPress editors then there are a few areas which might catch you out when creating the translations; here’s a few tips to help you get things done: First of all, any localizations should use UTF-8 encoding. This is one of the reasons we recommend Poedit; this kind of seemingly minor issue is already accounted for in a dedicated program. If you were to edit the files via a standard, simple editor like notepad, then the default settings will usually use different encoding. You won’t actually notice this when working on the file, but once you save it you’ll notice that all your translated elements are displaying the identifying string rather than the original or new language. You can just open and resave the file with the proper encoding, but using a dedicated program will prevent this happening in the first place, so it’s probably the safer solution! When writing your translations you should write your translations plainly; that is, avoid escaping accented and special characters with HTML character entities, save for a select group that are expected to be escaped to avoid conflict with XHTML markup: angle brackets (< & >), and ampersands (&). In addition, there are a few other characters that function better when escaped, such as non-breaking spaces ( ), angle quotes (« and »), curly apostrophes (’) and curly quotes. When we create multilingual sites, we need to remember that translation is not everything; localization goes beyond just translating words and expands to include adapting the site to a different language, country and conventions. Some words simply don’t mean the same thing or carry the same implications as other languages, so don’t translate literally; translate organically; try to get a feel for the meaning behind the original text, and capture that spirit in your translation.