mirror of
https://github.com/parchlinux/calamares.git
synced 2025-07-05 05:15:38 -04:00
Python-i18n: WIP, moving API to libcalamares.utils
This commit is contained in:
parent
1dbe7c29e2
commit
cbfdd8690d
5 changed files with 40 additions and 33 deletions
|
@ -208,4 +208,31 @@ obscure( const std::string& string )
|
|||
return CalamaresUtils::obscure( QString::fromStdString( string ) ).toStdString();
|
||||
}
|
||||
|
||||
std::list< std::string >
|
||||
gettext_languages()
|
||||
{
|
||||
bp::list pyList;
|
||||
QVariant localeConf_ = m_gs->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() );
|
||||
if ( lang.indexOf( '.' ) > 0)
|
||||
{
|
||||
lang.truncate( lang.indexOf( '.' ) );
|
||||
pyList.append( lang.toStdString() );
|
||||
}
|
||||
if ( lang.indexOf( '_' ) > 0)
|
||||
{
|
||||
lang.truncate( lang.indexOf( '_' ) );
|
||||
pyList.append( lang.toStdString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
return pyList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue