WordPress.org

Support

Support » Plugins and Hacks » [Resolved] get_current_lang() not working properly

[Resolved] get_current_lang() not working properly

  • gustavo-clicknaranja
    Member

    @gustavo-clicknaranja

    Hi!

    I’m using this to get the current language:

    global $wpCeceppaML;
    $wpCeceppaML->get_current_lang();

    but it always returns the same! I have two languages, “en” (english) and “es” (spanish), and this function is always returning “es”. I can change the language of the page, choosing it in the languages menu, or changing the url parameters (&lang=en), and the menu changes, and everything changes, but the function I am calling from a plugin php is always returning “es”, never “en”.

    Do you know why is this happening, and how could I solve it?

    Many thanks!

    http://wordpress.org/extend/plugins/ceceppa-multilingua/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Alessandro Senese
    Member

    @ceceppa

    Try if with 1.0

    Plugin Author Alessandro Senese
    Member

    @ceceppa

    With 1.0 use this for get current language:

    cml_get_current_language();

    This function return a php object with this fields:

    *) id – id of language
    *) cml_default – 1 if it is the default language
    *) cml_flag – name of flag
    *) cml_language – name of the language
    *) cml_language_slug – slug of the language
    *) cml_locale – wordpress locale

    gustavo-clicknaranja
    Member

    @gustavo-clicknaranja

    Only with 1.0? I have installed 1.0.2 version…

    And I’m getting an error with cml_get_current_language();
    I call it from the theme header.php and I get this message:

    “Call to undefined function cml_get_current_language();”

    Plugin Author Alessandro Senese
    Member

    @ceceppa

    That function exists since version 1.0.0.

    You get “undefined function” because the plugin has not yet been loaded, but it is strange because I’ve added that function at the top of my “header.php” and works correctly….

    Let me know which theme you are using, so I test plugin with it…

    Plugin Author Alessandro Senese
    Member

    @ceceppa

    Have you solved the problem?

    gustavo-clicknaranja
    Member

    @gustavo-clicknaranja

    Thank you Alessandro, you are right, the function works correctly in other places but not there, for some reason the plugin was not loaded yet.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] get_current_lang() not working properly’ is closed to new replies.