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
- 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

View File

@ -1469,19 +1469,26 @@ QPair<QString, QString> CLocale::FindSysLangTransFileName ( const QMap<QString,
if ( !slUiLang.isEmpty() )
{
// 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)
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;