WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently, I'm building multi languages blog. As I know, almost WP language translator plugins are based on .po & .mo files. here is a problem. A new language what I'm going to add does not exist with .po & .mo files, it's just a dialect(local) language.

That's why I defined in php and grab the language.php files as below code.


<a href="<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; ?>/?lang=newlanguage"> New Language</a>
<a href="<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]; ?>/?lang=eng">English</a>


<?php session_start();
$_SESSION['language'] = $_GET['lang'];
if ( $_SESSION['language'] == 'newlanguage' ) {
require (TEMPLATEPATH .'/languages/new-language.php');
else {
require (TEMPLATEPATH .'/languages/english.php');  // default language
} ?>

the problem is it doesn't work, if I load to the new page, "new-language" is disappear and it automatically changes to the default language.

My question is Can someone guide me to the right way/codes with developer solution?

share|improve this question
possible duplicate of How to update the language used by wordpress from a plugin – kaiser Feb 14 '13 at 13:32
Please take a look at this question. Your question was already asked and answered two times. – kaiser Feb 14 '13 at 13:32
If the .po file, and its correspondent .mo, don't exist, you have to create it yourself. – brasofilo Feb 14 '13 at 18:45
@ronaldtgi, please add your solution as an Answer. – brasofilo Feb 23 '13 at 10:35
up vote 0 down vote accepted

http://wordpress.org/extend/plugins/wcm-user-language-switcher I tried wcm language switcher, it only supports for users, not for guest who are not logged in. anyway thanks to kaiser & brasofilo.

Finally, I got a solution with theme switcher plugin http://wordpress.org/extend/plugins/theme-switcher I duplicate my theme and keep one is default, then create next one for new-language. even it takes more space in hosting, it was definitely what I need.

just add to header.php as the follow codes <?php wp_theme_switcher(); ?> or <?php wp_theme_switcher('dropdown'); ?>

it allowed for all users,guests and also eveyone can switch without logging in. theme switcher plugin also provide for sidebar widget with dropdown & lists style.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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