PDA

View Full Version : ISO 639-2 language codes



brixton
23rd November 2010, 00:46
Hey,
Qt always surprises me - in a good way - about what it can do for me. I haven't found this one in the documentation, so maybe someone here can answer me. Does Qt provide a mapping for the three-letter ISO 639-2 language codes ("eng" = "English", etc)?

If not, does someone know if is there a library that does provide this?

Thanks, B

SixDegrees
23rd November 2010, 08:09
Qt doesn't have this.

You really don't need anything more than a simple map structure to implement this. Populate it with the data easily available from any of scores of websites. It's maybe 15 minutes worth of effort. Add another minute or two if you want reverse lookups, which you can derive from the initial map.

brixton
23rd November 2010, 21:52
Sure I can do it easily, but Qt or some other common library has it already then I'd rather use something that is well-maintained. Qt has the ISO 639 information somewhere inside, but I guess it isn't available through any class.

In any case, I found that ICU (http://site.icu-project.org/) does provide this functionality, even giving the country name in the user's locale which is a nice touch. It seems that ICU is widely deployed on Linux so that's good too.