Jump to content

Get two letter code for default language


bmacnaughton
 Share

Recommended Posts

This is probably really simple but I am unable to get the two letter code for the default language.

$languages->default gives me a numeric code (the page ID for that language).

$user->language give me the numeric code again

$user->languages->name gives me "default" if it is the default language, else the two-letter code for the language.

But I don't see the two letter code for the language in $config (I might be missing it) nor anywhere else.

 

I've hardcoded around this now, so the question is largely academic, but I'd prefer not to hardcode it.

 

Being able to get the two character code, and not 'default' for the default language would be equally helpful. 

Link to comment
Share on other sites

The good thing: In PW you have full flexibility handling languages. You can create any name or title. As @Zeka mentioned you can also add any custom fields (2 letter iso codes, numeric iso codes, language descriptions, flag-icons, landscape images, currency etc.)

The bad thing: You have to do some things by yourself.

Keep in mind that the naming of your homepage is also related to language settings. For better handling I recommend consistence (equality) between this and the language name (or any custom language field like 2 letter language code)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...