function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
amritamrit 

How to convert locale to language value?

Hi,

 

I want to populate the current user's language field in one custom field in object.For that I'm querying the languagelocalekey from user object and assign the value to custom field

 

Eg:Cuobject__c cu=new Cuobject__c;
cu.Language__c=currentusr.Languagelocalekey;

 

But still I'm getting the locale(en_US) instead of English.any idea to convert locale to language value.

 

Can anyone suggest me solution for this

 

Thanks

Bhawani SharmaBhawani Sharma
I am not sure if there is already any standard function for this, but what I can suggest is, you can create a custom setting where you can have key and Value fields. Key will be you Languagelocalekey(en_US) and value will be English.
Now whenever you want to populate language, fetch custom setting and set value.
This will help you
http://boards.developerforce.com/t5/General-Development/Needed-a-List-of-LanguageLocaleKey-codes-in-salesforce/td-p/379513
swatKatswatKat

The values for Language are stored like this in salesforce. You see the label 'English' in the User Interface but the value for is actually stored as 'en_US'. Similarly for other languages. I thnk you should go by what Bhawani is suggesting.