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

    (@ceceppa)

    Hi,
    sorry for delay, I saw your message just now…
    Actually you can use get_locale because the plugin change current locale in according to current language…
    Anyhow you can use:

    CMLLanguage::get_current_locale()

    You can find full API documentation in Ceceppa Multilingua -> Api page, if something isn’t clear let me know ??

    Hallo could you please give one short example how to call the current language, maybe by id or by name.

    I like to create a loop and use the language id as a condition, but until now, its always emtpy?

    Thanks katasun

    Plugin Author Alessandro Senese

    (@ceceppa)

    Hi,
    to get info about current language you can use this method:

    CMLLanguage::get_current_id(); //Return current language id
    CMLLanguage::get_current_slug(); //Return current language slug
    CMLLanguage::get_current_locale(); //Return current language locale
    
    /* The function above will return a stdClass Object of current language: */
    CMLLanguage::get_current();

    I like to create a loop and use the language id as a condition, but until now, its always emtpy?

    Which method return empty value?

    Thanks a lot I copied this from your code which is working:

    $current = cml_get_current_language();
    if($current->cml_language_slug == ‘en’){
    echo $slide[‘description’];
    }
    if I only want the id it could be done like this?

    $current = cml_get_current_language();
    if($current->cml_language_id == ‘2’){
    echo $slide[‘description’];
    }

    Thanks katasun

    Plugin Author Alessandro Senese

    (@ceceppa)

    Hi,
    you can write:

    if( $current->id == 2 )

    or

    if( CMLLanguage::get_current_id() == 2 )

    it’s the same…

    Cheers
    Alessandro

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Get locale’ is closed to new replies.