Hi,<br>I have two questions and would appreciate if anybody can give me an answer.<br><br>1. Is there any reason that QLocale is synched with system locale and KLocale is not?<br>2. Currently when kxkb uses libxklavier to fetch translations (for more details see my recent email in kde-i18n) I have to set system locale from KLocale with the code below. The question is: is there a better solution I should have used?
<br><br>Thanks,<br>Andriy<br><br>static const int LOCALE_CATEGORY = LC_ALL;<br>...<br> const char* currLocale = setlocale(LOCALE_CATEGORY, NULL);<br><br> QString locale = KGlobal::locale()->language();<br> if(
locale.indexOf('_') == -1 ) { // TODO: do we have to do this?<br> QString country = KGlobal::locale()->country();<br> if( ! country.isEmpty() ) {<br> locale += "_";<br> locale +=
country.toUpper();<br> }<br> }<br> locale += ".UTF-8";<br><br> const char* newLocale = setlocale(LOCALE_CATEGORY, locale.toLatin1());<br> if( newLocale == NULL ) {<br> setlocale(LC_ALL, "C");
<br> }<br><br>... call libxklavier ...<br><br> setlocale(LOCALE_CATEGORY, currLocale);<br><br>