Add support for locales in /usr/share/i18n/SUPPORTED
This commit is contained in:
parent
893417d26e
commit
9450290212
@ -1,6 +1,6 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -225,10 +225,28 @@ LocalePage::init( const QString& initialRegion,
|
|||||||
}
|
}
|
||||||
emit m_tzWidget->locationChanged( m_tzWidget->getCurrentLocation() );
|
emit m_tzWidget->locationChanged( m_tzWidget->getCurrentLocation() );
|
||||||
|
|
||||||
// Fill in meaningful locale/charset lines from locale.gen
|
// Some distros come with a meaningfully commented and easy to parse locale.gen,
|
||||||
|
// and others ship a separate file /usr/share/i18n/SUPPORTED with a clean list of
|
||||||
|
// supported locales. We first try that one, and if it doesn't exist, we fall back
|
||||||
|
// to parsing the lines from locale.gen
|
||||||
m_localeGenLines.clear();
|
m_localeGenLines.clear();
|
||||||
QFile localeGen( localeGenPath );
|
QFile supported( "/usr/share/i18n/SUPPORTED" );
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
|
|
||||||
|
if ( supported.exists() &&
|
||||||
|
supported.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||||
|
{
|
||||||
|
ba = supported.readAll();
|
||||||
|
supported.close();
|
||||||
|
|
||||||
|
foreach ( QByteArray line, ba.split( '\n' ) )
|
||||||
|
{
|
||||||
|
m_localeGenLines.append( QString::fromLatin1( line.simplified() ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFile localeGen( localeGenPath );
|
||||||
if ( localeGen.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
if ( localeGen.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||||
{
|
{
|
||||||
ba = localeGen.readAll();
|
ba = localeGen.readAll();
|
||||||
@ -262,6 +280,7 @@ LocalePage::init( const QString& initialRegion,
|
|||||||
m_localeGenLines.append( lineString );
|
m_localeGenLines.append( lineString );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
|
Loading…
Reference in New Issue
Block a user