How do I change the value of lang=en-US

The value for that string is normally taken from the option WPLANG in your database table $prefix_options. You can set it in the backend under Settings/General (wp-admin/options-general.php) or per SQL. There several ways to change that value per PHP: Create a global variable $locale in your wp-config.php: $locale=”en_GB”; Declare the constant WPLANG in your wp-config.php: … Read more

How to get a translated string from a language other than the current one?

To find the answer to this question, you just need to look at how WordPress retrieves the translations. Ultimately it is the load_textdomain() function that does this. When we take a look at its source we find that it creates a MO object and loads the translations from a .mo file into it. Then it … Read more

Rewrite Rule for Multilingual Website, Like qTranslate?

I got it now , After searched many resources : function lang_support() { return array(‘en’,’fr’); // Add your support lang-code (1st place is a default) } function rewrite_lang(){ $langs = lang_support(); foreach($langs as $lang) { add_rewrite_endpoint($lang,EP_PERMALINK|EP_PAGES|EP_ROOT|EP_CATEGORIES); } } add_action(‘init’,’rewrite_lang’); function lang(){ global $wp_query; $langs = lang_support(); $lang_r = “”; foreach($langs as $lang) { if(isset($wp_query->query_vars[$lang])) { … Read more

Change page template programmatically ?

It is possible using the template_redirect hook. Looks something like this : function language_redirect() { global $q_config; if( $q_config[‘lang’] == ‘en’ ) { include( get_template_directory() . ‘/page-template_en.php’ ); exit; } else { include( get_template_directory() . ‘/page-template_de.php’ ); exit; } } add_action( ‘template_redirect’, ‘language_redirect’ ); Code is untested, but should look like that. See my similar … Read more