diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index 3532d8f32..93297436d 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -13,6 +13,7 @@ #include "GlobalStorage.h" #include "JobQueue.h" #include "PythonHelper.h" +#include "locale/Global.h" #include "partition/Mount.h" #include "utils/CalamaresUtilsSystem.h" #include "utils/Logger.h" @@ -280,24 +281,19 @@ _gettext_languages() Calamares::GlobalStorage* gs = jq ? jq->globalStorage() : CalamaresPython::GlobalStoragePythonWrapper::globalStorageInstance(); - QVariant localeConf_ = gs->value( "localeConf" ); - if ( localeConf_.canConvert< QVariantMap >() ) + QString lang = CalamaresUtils::Locale::readGS( *gs, QStringLiteral( "LANG" ) ); + if ( !lang.isEmpty() ) { - QVariant lang_ = localeConf_.value< QVariantMap >()[ "LANG" ]; - if ( lang_.canConvert< QString >() ) + languages.append( lang ); + if ( lang.indexOf( '.' ) > 0 ) { - QString lang = lang_.value< QString >(); + lang.truncate( lang.indexOf( '.' ) ); + languages.append( lang ); + } + if ( lang.indexOf( '_' ) > 0 ) + { + lang.truncate( lang.indexOf( '_' ) ); languages.append( lang ); - if ( lang.indexOf( '.' ) > 0 ) - { - lang.truncate( lang.indexOf( '.' ) ); - languages.append( lang ); - } - if ( lang.indexOf( '_' ) > 0 ) - { - lang.truncate( lang.indexOf( '_' ) ); - languages.append( lang ); - } } } return languages; diff --git a/src/modules/keyboard/Config.cpp b/src/modules/keyboard/Config.cpp index 9afaef5f3..e7ffc6555 100644 --- a/src/modules/keyboard/Config.cpp +++ b/src/modules/keyboard/Config.cpp @@ -15,6 +15,7 @@ #include "GlobalStorage.h" #include "JobQueue.h" +#include "locale/Global.h" #include "utils/Logger.h" #include "utils/RAII.h" #include "utils/Retranslator.h" @@ -483,7 +484,7 @@ Config::guessLocaleKeyboardLayout() // Try to preselect a layout, depending on language and locale Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - QString lang = gs->value( "localeConf" ).toMap().value( "LANG" ).toString(); + QString lang = CalamaresUtils::Locale::readGS( *gs, QStringLiteral( "LANG" ) ); cDebug() << "Got locale language" << lang; if ( !lang.isEmpty() )