How can I set up multi language admin ui?

I will have two admin users, one of them only speaking italian and the other only speaks english. How can I setup multi-language admin user interface?

Related posts

Leave a Reply

2 comments

  1. There are a couple of methods that this can be done without the overhead of plugins.

    Method 1

    The first method involves hooking to the load_textdomain_mofile filter.

    (This must go into a separate plugin)

    function wpse31785_change_mofile( $mofile, $domain ) {
        if ( $domain == 'default'
            and get_current_user() == 'riccardo' )
                return substr($mofile, 0, -8).'it_IT.mo';
        return $mofile;
    }
    
    add_filter( 'load_textdomain_mofile', 'wpse31785_change_mofile', null, 2 );
    

    Method 2

    This method involves modifying your wp-config.php file in order to conditionally set WPLANG.

    // store the language in session
    if ( isset($_GET['lang']) ) $_SESSION['lang'] = $_GET['lang'];
    
    if ( isset($_SESSION['lang']) ) // pick the language conditionally
        if ( $_SESSION['lang'] == 'it' ) define( 'WPLANG', 'it_IT' );
        elseif ( $_SESSION['lang'] == 'en' ) define ( 'WPLANG' , 'en_EN' );
    
    // the default fallback
    if ( !defined( 'WPLANG' ) ) define ( 'WPLANG', '' );
    

    With this in your wp-config.php you are able to provide an additional GET parameter to set the language for the session. http://yoursite.com/wp-admin/?lang=it will set the WPLANG constant to it_IT.

    Alternatively you can store the chosen language in the cookies with setcookie() and get them from the $_COOKIE global instead of using the session variables.

  2. There are some plugins that will do it for you.

    I think one is called wp native dashboard’ allows user tochoose language from those installed

    Another one called ‘in their language ‘ is simple but effective – attempts to determine preferred language from the browser settings.

    Of course you must also have the wp language files loaded for the languages that you want to support in the admin area.
    http://codex.wordpress.org/WordPress_in_Your_Language