Fix locale filtering for UTF-8 on Fedora.

locale -a returns the locales using ".utf8" names rather than ".UTF-8".
The case-insensitive match does not help because it is "utf8" rather
than "UTF-8". So we need to match both with and without the dash.
This commit is contained in:
Kevin Kofler 2016-09-26 01:47:58 +02:00 committed by Philip
parent 2a74fc423f
commit 3edf1bb162
2 changed files with 4 additions and 2 deletions

View File

@ -60,7 +60,8 @@ LocaleConfiguration::fromLanguageAndLocation( const QString& languageLocale,
// FIXME: this might be useless if we already filter out non-UTF8 locales
foreach ( QString line, linesForLanguage )
{
if ( line.contains( "UTF-8" ) )
if ( line.contains( "UTF-8", Qt::CaseInsensitive ) ||
line.contains( "utf8", Qt::CaseInsensitive ) )
linesForLanguageUtf.append( line );
}

View File

@ -365,7 +365,8 @@ LocalePage::init( const QString& initialRegion,
// because it's not 1995.
for ( auto it = m_localeGenLines.begin(); it != m_localeGenLines.end(); )
{
if ( !it->contains( "UTF-8", Qt::CaseInsensitive ) )
if ( !it->contains( "UTF-8", Qt::CaseInsensitive ) &&
!it->contains( "utf8", Qt::CaseInsensitive ) )
it = m_localeGenLines.erase( it );
else
++it;