Okay
  Print

How to Translate the theme

See Relevant url : http://themenectar.com/docs/salient/translations/ 


Translation Basics

The section covers the steps in creating a .po file that contains the set of translated strings. If you’re already fimilar with creating a .po file, skip to the Recommended Toolssection.

Setting The WordPress installation language

Head over to the WordPress admin panel > Settings > General tab and ensure that your desired language is selected from the “Site Language” dropdown. This step is essential for ensuring the correct language file you’ll be creating gets called on your site.

Location of Theme Language Files

By default, Salient will load language files from the lang directory, which is located in the root of the theme folder. Once you’ve created your .po/.mo files for your desired language code, you can store them in this directory.

If you’d like to keep your .po/.mo files in a child theme to ensure they don’t get removed during theme updates, you can create a directory called “lang” within your Salient child theme and keep them there instead. When going this route, you’ll also need to add the following snippet into your Salient child theme functions.php file:

<span class="border-top"></span><span class="border-right"></span><span class="border-bottom"></span><span class="border-left"></span>
add_action('after_setup_theme', 'child_lang_setup');
function child_lang_setup(){ load_child_theme_textdomain('salient', get_stylesheet_directory() . '/lang');
}

Translation Process

Salient includes three files in the lang directory to assist with translation.

  • default.po/default.mo –  language files with no assigned language that can be opened in a program/through a plugin of your choosing to quickly start editing the strings. Once the translations have been made, simply rename both files to the WordPress locale you’re using. For example French would named “fr_FR.po” and “fr_FR.mo”. You can find a complete list of locale codes here.
  • nectar_salient_strings.pot – This is the main template file that can be used to generate new po/mo files. It has all the translation strings left empty. When you use one of the recommended tools for translating listed below, you can use this file to automatically create the .po/.mo files in your chosen locale so you don’t need to manually name them or find out what your locale code is.

Recommended Tools

WPML

WPML makes it easy to build multilingual sites and run them. It’s powerful enough for corporate sites, yet simple for blogs.

  • Translate pages, posts, custom types, taxonomy, menus and theme’s texts.
  • WPML comes with state-of-the-art translation management. You can turn ordinary WordPress users into TranslatorsTranslators can access only specific translation jobs which Editors assign to them.
  • WPML frees you from the hassle of editing PO files and uploading MO files. You can translate texts in other plugins and in Admin screens directly from the String Translation interface.

The WPML team has written a comprehensive guide on integration with Salient. If you’re new to the plugin, or stuck on something we recommend giving it a read through.

 Official WPML Guide

If you’re looking for extra assistance with for your site solution or are in need of developing customized components – WPML also has a list of official contractors.

 WPML Contractors List

Loco Translate (Free)

Loco Translate provides in-browser editing of WordPress translation files.

  • Built-in translation editor within WordPress admin
  • Extraction of translatable strings from your source code
  • Native MO file compilation without the need for Gettext on your system

Download Loco Translate

Poedit (Free)

Poedit is a program you can download for free to translate outside of WordPress. Because of this, it’s slightly more labor intensive than one of the WP plugins above, but still a great option.  Poedit is intentionally spartan so that the focus is on the translation you’re working on. Just you and the translation, no distractions.

Download Poedit