Python-i18n: make it compile again

This commit is contained in:
Adriaan de Groot 2017-08-15 13:21:17 +02:00
parent cbfdd8690d
commit 6370898154
2 changed files with 8 additions and 6 deletions

View File

@ -221,7 +221,6 @@ BOOST_PYTHON_MODULE( libcalamares )
bp::def(
"gettext_languages",
&CalamaresPython::gettext_languages,
bp::args(),
"Returns list of languages (most to least-specific) for gettext."
);
}

View File

@ -24,6 +24,9 @@
#include "utils/CalamaresUtilsSystem.h"
#include "utils/CalamaresUtils.h"
#include "GlobalStorage.h"
#include "JobQueue.h"
#include <QDir>
#undef slots
@ -211,24 +214,24 @@ obscure( const std::string& string )
std::list< std::string >
gettext_languages()
{
bp::list pyList;
QVariant localeConf_ = m_gs->value( "localeConf" );
std::list< std::string > pyList;
QVariant localeConf_ = Calamares::JobQueue::instance()->globalStorage()->value( "localeConf" );
if ( localeConf_.canConvert< QVariantMap >() )
{
QVariant lang_ = localeConf_.value< QVariantMap >()[ "LANG" ];
if ( lang_.canConvert< QString >() )
{
QString lang = lang_.value< QString >();
pyList.append( lang.toStdString() );
pyList.push_back( lang.toStdString() );
if ( lang.indexOf( '.' ) > 0)
{
lang.truncate( lang.indexOf( '.' ) );
pyList.append( lang.toStdString() );
pyList.push_back( lang.toStdString() );
}
if ( lang.indexOf( '_' ) > 0)
{
lang.truncate( lang.indexOf( '_' ) );
pyList.append( lang.toStdString() );
pyList.push_back( lang.toStdString() );
}
}
}