PDA

View Full Version : Country name string to QLocale::country enum



Szyk
20th January 2018, 16:58
Hi
I want to write my own speech synthesizer proxy class. This is due to build in windows speech synthesizer limits (only 2 languages and one female voice).
I want to store settings in meaningful ini file. And I want to display language's list in program options. So: I want language names like: English, German, polish on this list. But for QLocale constructor I need names like en_GB, de_DE, pl_PL.

How can I convert from meaning full (long) country names to bcp47 (codes)?
I need bcp47 code names, because it is accepted by QLocale constructor.

Another approach:
How can I convert from meaning full (long) country names to QLocale::Country?
This will be faster approach to create QLocale...

The same question is for QLocale::Language conversion from meaning full names to enum or bcp47...

thanks and best wishes
Szyk Cech