6/23/2014 - 11:47 AM

Requirements for Wordpress theme localization setup

Requirements for Wordpress theme localization setup

  1. Ensure you have used _e(), __(), _x() etc. functions in your theme. Use unique text domain as argument (for example, __('Poetry', 'myblogtextdomain'))

  2. Install Poedit, create new catalog (.po file) and save it in [themename]/languages/ with locale name (ru_RU.po, en_US.po etc.). In catalog properties leave Language field empty, in Sources paths use ../../ as base path and theme name as a Paths field group entry

  3. Use Update command in Poedit to scan theme files for strings to be translated

  4. Translate these strings and save the file. Poedit will automatically create .mo file

  5. Upload them both (still to [themename]/languages)

  6. Insert function that will load text domain in functions.php:

     add_action('after_setup_theme', 'setup_textdomain');
     function setup_textdomain(){
         load_theme_textdomain('myblogtextdomain', get_template_directory() . '/languages');