WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Get Language in Theme/Templates

[Resolved] Get Language in Theme/Templates

  • Hi,

    I installed the plugin and everything works just fine.

    However I couldn’t find a documentation and I was wondering how I can change text in the template depending on the language.

    My idea would be simple but stupid

    if($lang = "en") echo "hello";
    else echo "salut";

    What I would need here is a way to this, to get the language
    Thanks for your help.
    Tobi

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author toscho

    @toscho

    You could use get_bloginfo( 'language' ).

    if ( 'en' === get_bloginfo( 'language' ) )
        echo 'hello';
    else
        echo 'salut';

    But that’s not how you should change strings. Use proper translation functions instead and a language file.

    Hi, only gotta change a few string.

    Your code is not working for me.

    get_bloginfo always return “en-US”.

    I am using multiple Networks and Multilingual Press. The only place I find to select languages is in this plugin. Nothing under settings > general or other places.

    Any help?

    Plugin Author toscho

    @toscho

    If you don’t find the settings under General Settings, you have to install the correct language first from http://i18n.svn.wordpress.org/.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Get Language in Theme/Templates’ is closed to new replies.