Title: Get locale
Last modified: August 21, 2016

---

# Get locale

 *  [activecontent](https://wordpress.org/support/users/activecontent/)
 * (@activecontent)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/get-locale/)
 * Alessandro,
 * Currently i am using this in some templates:
    `<?php if(get_locale() == 'en_GB'):?
   >`
 * To get the locale and do some conditional stuff for the different languages.
 * Is there a similar method to call the locale with your API?
 * Thanks
 * Marcellino
 * [https://wordpress.org/plugins/ceceppa-multilingua/](https://wordpress.org/plugins/ceceppa-multilingua/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Alessandro Senese aka Ceceppa](https://wordpress.org/support/users/ceceppa/)
 * (@ceceppa)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/get-locale/#post-4959509)
 * 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 🙂
 *  [katasun](https://wordpress.org/support/users/katasun/)
 * (@katasun)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/get-locale/#post-4959549)
 * 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 aka Ceceppa](https://wordpress.org/support/users/ceceppa/)
 * (@ceceppa)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/get-locale/#post-4959550)
 * 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?
 *  [katasun](https://wordpress.org/support/users/katasun/)
 * (@katasun)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/get-locale/#post-4959551)
 * 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 aka Ceceppa](https://wordpress.org/support/users/ceceppa/)
 * (@ceceppa)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/get-locale/#post-4959552)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/ceceppa-multilingua_4faedb.svg)
 * [Ceceppa Multilingua](https://wordpress.org/plugins/ceceppa-multilingua/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ceceppa-multilingua/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ceceppa-multilingua/)
 * [Active Topics](https://wordpress.org/support/plugin/ceceppa-multilingua/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ceceppa-multilingua/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ceceppa-multilingua/reviews/)

## Tags

 * [language](https://wordpress.org/support/topic-tag/language/)
 * [locale](https://wordpress.org/support/topic-tag/locale/)

 * 5 replies
 * 3 participants
 * Last reply from: [Alessandro Senese aka Ceceppa](https://wordpress.org/support/users/ceceppa/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/get-locale/#post-4959552)
 * Status: not resolved