diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index 6420534a5..58353e11b 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -30,6 +30,7 @@ #include #include #include +#include LocalePage::LocalePage( QWidget* parent ) @@ -226,12 +227,22 @@ LocalePage::init( const QString& initialRegion, // Fill in meaningful locale/charset lines from locale.gen m_localeGenLines.clear(); QFile localeGen( localeGenPath ); - if ( !localeGen.open( QIODevice::ReadOnly | QIODevice::Text ) ) + QByteArray ba; + if ( localeGen.open( QIODevice::ReadOnly | QIODevice::Text ) ) { - cDebug() << "ERROR: Cannot open file" << localeGenPath << "."; - return; + ba = localeGen.readAll(); + localeGen.close(); + } + else + { + cDebug() << "Cannot open file" << localeGenPath + << ". Assuming the supported languages are already built into " + "the locale archive."; + QProcess localeA; + localeA.start( "locale", QStringList() << "-a" ); + localeA.waitForFinished(); + ba = localeA.readAllStandardOutput(); } - QByteArray ba = localeGen.readAll(); foreach ( QByteArray line, ba.split( '\n' ) ) { if ( line.startsWith( "# " ) || line.simplified() == "#" )