Hi Alex,
Thanks for your reply.
I have set up parts of the theme to enable localization, for example:
__(‘Max. Price’,’mythemedomain’)
My question is, is there any where or any way that I can set the localization of the term ‘Max. Price’ to the different languages available on the site? Can WPGlobus handle this, or do I have to do the edits in the PO/MO/POT file?
Thanks again for your assistance!
Just to add on, the code is placed on code-behind within the theme functions.php, and there is no front-end for it.
@jeromeeee
1. you can use POEdit for generate PO\MO files and then use
load_theme_textdomain()
see http://codex.ww.wp.xz.cn/Function_Reference/load_theme_textdomain
2. you can use code to get string in current language
echo apply_filters( 'the_title', '{:en}Max. Price{:}{:de}Max. Preis{:}' );
Hi Alex,
Do I have to do both steps 1 and 2, or are they different methods to approach the question?
Say for example, I need to localize this code-behind:
<span class=”search-label”>’.__(‘Listed In’,’mythemedomain’).'</span>
<span class=”search-label”>’.__(‘Type’,’mythemedomain’).'</span>
<span class=”search-label”>’.__(‘Number of Rooms’,’mythemedomain’).'</span>
How can I use the apply_filters method to this?
Thanks once again, so much, for your help.
I have tried to first method, here’s what I’ve done:
1. Create languages folder /wp-content/themes/mythemename/languages
2. Put my PO/MO files in the folder (zh_CN.mo and zh_CN.po)
3. Added this line of code in my functions.php :
add_action(‘after_setup_theme’, ‘load_languages’);
function load_languages(){
load_theme_textdomain(‘mythemedomain’, get_template_directory() . ‘/languages’);
}
But when I’m on the Chinese version of the site (from WPGlobus), the translations do not appear. Any idea?
try this in functions.php
load_theme_textdomain( 'mythemedomain', get_template_directory() . '/languages' );