This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Our next available supporter will start replying to tickets in about 1.56 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 3 voices.

Last updated by Harshad 6 years, 3 months ago.

Assigned support staff: Harshad.

Author Posts
June 26, 2013 at 9:37 pm #139389

The J

I would like a function to retrieve the language native name (or English name of it), given that language code.

Something like:

get_lang_name($langcode, $native)
// where $langcode can be 'it', 'en'... etc.
// $native can be true/false

Does WPML already have that function? If yes I must have missed it in the API documentation... if not, could you point the function out? So I can save some time and focus on the rest of development 🙂

Thank you!

June 27, 2013 at 11:47 am #139529


Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Dear Jany,

Hope you can achive this with Language Constants. Please check this tutorial for more details [Check Language constants section on the bottom].

With Regards


June 29, 2013 at 1:01 am #140000

The J

ICL_LANGUAGE_NAME will tell me the current language name, I cant use it to retrieve another language name.
Please can you provide a function that will do that? (read my first post)
Thank you!

June 30, 2013 at 11:19 am #140150


Please use the following code in your theme's functions.php file

function get_language_name($code=''){
global $sitepress;
$details = $sitepress->get_language_details($code);
$language_name = $details['english_name'];
return $language_name;

Then give a call the get_language_name() in your theme files wherever you want to display the language name;

<?php echo get_language_name(ICL_LANGUAGE_CODE);?>

The topic ‘[Closed] Native language name from language code?’ is closed to new replies.