Georg
Georg

Reputation: 3940

Android - Translating language codes

I get a response from a webservice that will return several language codes (ISO 639-2) as options. I now want to translate those into a human understandable word. For example:

eng-> English
ger -> German
fre -> French

How would you translate those words. Should I be using the strings.xml? But how will I get the Resource ID of those words?

Thanks a lot

Upvotes: 1

Views: 1337

Answers (1)

Nikolay Ivanov
Nikolay Ivanov

Reputation: 8935

You can convert 639-2 codes to 639-1 code using answer for this question and after you get a 2 letter code construct Locale object and use getDisplayLanguage method

Upvotes: 1

Related Questions