I have been really hard time to get my site translated.
I have MO and PO files, but my theme is not compatible with WPML and the developer team doesn't to change it.

Therefore I may have to build a plugin or compatibility coding by myself. But I can't really find how to do and what I need to do.

Does anybody know how to do? Or any tutorial for it? I can't really find WMPL site as well.


2 Answers 2


You don’t have to make anything special for WPML, using the regular translation code should be enough. See I18n for WordPress Developers in the Codex.

Code preparation


Add Text Domain and Domain Path to your theme’s style.css.


 * Theme Name:    My awesome theme
 * Text Domain:   my_awesome_theme
 * Domain Path:  /languages


Find all strings that should be translated and use the Text Domain value with the proper translation functions.


Replace …

echo 'Comments'

… with …

esc_html_e( 'Comments', 'my_awesome_theme' );

See wp-includes/l10n.php for available functions, and follwing the links in the Codex article mentioned earlier.

Theme directory

Create a directory for translation files from the value of Domain Path.



Now WPML should be able to find all strings for translation and to create the proper language files.

Finally, make sure the language file is actually loaded. Add the following code to the functions.php in you theme:

add_action( 'wp_loaded', 'my_awesome_theme_load_theme_language' );

 * Load translations.
 * @wp-hook wp_loaded
 * @return  bool
function my_awesome_theme_load_theme_language()
    $lang_dir = get_stylesheet_directory() . '/languages';
    return load_theme_textdomain( 'my_awesome_theme', $lang_dir );
  • but my site is still being designed and re-organized by us from another theme. the problem is original theme is not compatible and I think the original theme did what you said. :( but I didn't work. whatelse I need to check more to make it work?
    – pulla
    Oct 13, 2013 at 17:28
  • @pulla See my update, the last code block.
    – fuxia
    Oct 13, 2013 at 17:33

WPML has a pretty good documentation on how to make a theme compatible.

Most of the time, all themes should work out of the box with WPML if the theme designer did follow the wp standards for internationalization.

If you don't get further with that link and have any concrete problem we can help you with, please add the details of what goes wrong and how you tried to fix it to your question.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.