WordPress.org

Forums

MultilingualPress
[resolved] Get Language in Theme/Templates (4 posts)

  1. tobias-r
    Member
    Posted 1 year ago #

    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

  2. toscho
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. tobias-r
    Member
    Posted 1 year ago #

    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?

  4. toscho
    Member
    Plugin Author

    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • MultilingualPress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.