[libcalamares, keyboard] Use convenience for getting current locale
This commit is contained in:
parent
d80661211c
commit
2478570deb
@ -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,13 +281,9 @@ _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 >() )
|
||||
{
|
||||
QString lang = lang_.value< QString >();
|
||||
languages.append( lang );
|
||||
if ( lang.indexOf( '.' ) > 0 )
|
||||
{
|
||||
@ -299,7 +296,6 @@ _gettext_languages()
|
||||
languages.append( lang );
|
||||
}
|
||||
}
|
||||
}
|
||||
return languages;
|
||||
}
|
||||
|
||||
|
@ -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() )
|
||||
|
Loading…
Reference in New Issue
Block a user