I have my own theme that I’ve created and I need to support 3 languages. I started by adding the gettext functions to my template _e(“string”,”namespace”) etc, generated the po file with Poedit, and then created the .mo file for Spanish (es_ES)
My current setup which is not working >
Update
wp-config.php
define ('WPLANG', 'es_ES');
functions.php
define('TPL_LANGUAGES',TEMPLATEPATH.'/languages/');
function theme_init(){
load_theme_textdomain( 'protoman', TPL_LANGUAGES);
}
add_action('init', 'theme_init');
languages mo file
themes/protoman/languages/es_ES.mo
index.php
<ul>
<li><a href="#"><?php _e('Home', 'protoman'); ?> </a></li>
<li><a href="#"><?php _e('Account', 'protoman'); ?></a></li>
<li><a href="#"><?php _e('Shop', 'protoman'); ?> </a></li>
<li><a href="#"><?php _e('Corporate', 'protoman'); ?> </a></li>
STILL NO LUCK!
1 Answer
You need to load_theme_textdomain() in your theme.
Place this in theme functions file:
function theme_init(){
load_theme_textdomain('theme_name', get_template_directory() . '/languages');
}
add_action ('init', 'theme_init');
Then you put you language files in you theme /languages folder
you language files should be es_ES.mo and es_ES.po without the text domain at the front as the codex states File names such as: my_theme-sv_SE.mo will NOT work.