diff --git a/ChangeLog b/ChangeLog index e9793411..f12a6da4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ - support sorting faders by channel group +- add support to change the GUI language (#297) + - add special server list filter for filtering occupied servers by using "#" (#397) - scale channel instrument picture in Compact skin mode @@ -20,11 +22,6 @@ - bug fix: grouping faders in the client should be proportional (see discussion in #202, #419) -TODO add support to change language (#297) - TODO search in the code for "TODO maybe first try to find the complete string, if not found use only first two letters instead" - -TODO bug fix: incorrect selection of UI language (#408) !!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -> note that for the 3.5.8 bug fix release we went back to the original translation code (e.g. no pt_BR!) TODO add new register message which contains version and, e.g., max number of clients diff --git a/src/util.cpp b/src/util.cpp index d1b68b35..7112369b 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -1469,19 +1469,26 @@ QPair CLocale::FindSysLangTransFileName ( const QMap if the language - // is not correct, the user can change it in the GUI anyway) - const QString strUiLang = QLocale().uiLanguages().at ( 0 ); + QString strUiLang = QLocale().uiLanguages().at ( 0 ); + strUiLang.replace ( "-", "_" ); - if ( strUiLang.length() >= 2 ) + // first try to find the complete language string + if ( TranslMap.constFind ( strUiLang ) != TranslMap.constEnd() ) { - -// TODO maybe first try to find the complete string, if not found use only first two letters instead - - PairSysLang.first = strUiLang.left ( 2 ); + PairSysLang.first = strUiLang; PairSysLang.second = TranslMap[PairSysLang.first]; } + else + { + // only extract two first characters to identify language (ignoring + // location for getting a simpler implementation -> if the language + // is not correct, the user can change it in the GUI anyway) + if ( strUiLang.length() >= 2 ) + { + PairSysLang.first = strUiLang.left ( 2 ); + PairSysLang.second = TranslMap[PairSysLang.first]; + } + } } return PairSysLang;