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

Firstly i have been install wp with different languange with indonesian languange as default, i have plan, want to translate with other languange, How to simple translate switch, but keep Indonesian as default. with .po file

thanks for the help ...

share|improve this question

Assuming you're talking about the front-end and you have your strings properly internationalized, you just need to insert the load_theme_textdomain() function to tell wordpress where are your .po files.

this is how the Toolbox Theme does it:

 * Make theme available for translation
 * Translations can be filed in the /languages/ directory
 * If you're building a theme based on martins, use a find and replace
 * to change 'martins' to the name of your theme in all the template files
load_theme_textdomain( 'martins', TEMPLATEPATH . '/languages' );

$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
    require_once( $locale_file );


i once played with changing users locale to do that automatically, getting the users language from the $_SERVER superglobal.

i came up with this, but it's not working yet. Maybe you can work from it.


function rm_get_locale($lang) {
    global $locale;
    // This gets the users' primary browser settings for acceptable languages
    // and transforms the string so it looks like en_US or pt_BR rather than
    // en-us and pt-br. It takes only the first value returned, no all of them.
    $langcode = explode(";", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
    $langcode = explode(",", $langcode['0']);
    $langcode = $langcode['0'];
    $langcode = preg_split('/-/', $langcode);
    $upper = strtoupper($langcode[1]);
    $lower = $langcode[0];

    // now we get the native wp locale and the parsed user locale
    $wplocale = get_locale();
    $userlocale = implode('_',array($lower,$upper));

    // compare them and apply the user's locale if they don't match.
    if ($userlocale != $wplocale) {
        return $userlocale;
    } else {
        return $lang;

share|improve this answer
Thank's @moraleida :) now i successful create indonesian language for default, with create .po file and locale.php at languages folder root. a little problem maybe, how can switch for english, on frontend ... very grateful for your help – Reddy 'Rk' Aug 25 '11 at 12:10
Related and can be found useful by other looking wordpress.stackexchange.com/questions/31785/… – soulseekah Mar 9 '12 at 21:58

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.