system language: first try to find the complete string, if not found use only first two letters instead

This commit is contained in:
Volker Fischer 2020-07-06 20:01:40 +02:00
parent 1e57b7b0d5
commit e6a6c8a79e
2 changed files with 18 additions and 14 deletions

View file

@ -13,6 +13,8 @@
- support sorting faders by channel group - 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) - add special server list filter for filtering occupied servers by using "#" (#397)
- scale channel instrument picture in Compact skin mode - 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) - 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 TODO add new register message which contains version and, e.g., max number of clients

View file

@ -1469,19 +1469,26 @@ QPair<QString, QString> CLocale::FindSysLangTransFileName ( const QMap<QString,
if ( !slUiLang.isEmpty() ) if ( !slUiLang.isEmpty() )
{ {
// only extract two first characters to identify language (ignoring QString strUiLang = QLocale().uiLanguages().at ( 0 );
// location for getting a simpler implementation -> if the language strUiLang.replace ( "-", "_" );
// is not correct, the user can change it in the GUI anyway)
const QString strUiLang = QLocale().uiLanguages().at ( 0 );
if ( strUiLang.length() >= 2 ) // first try to find the complete language string
if ( TranslMap.constFind ( strUiLang ) != TranslMap.constEnd() )
{ {
PairSysLang.first = strUiLang;
// TODO maybe first try to find the complete string, if not found use only first two letters instead
PairSysLang.first = strUiLang.left ( 2 );
PairSysLang.second = TranslMap[PairSysLang.first]; 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; return PairSysLang;