mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
locale: Optimize guessLCLocale by moving function calls out of loops.
This commit is contained in:
parent
bcbe5103b9
commit
440b38addf
1 changed files with 3 additions and 2 deletions
|
@ -287,10 +287,11 @@ LocalePage::guessLCLocale()
|
|||
if ( m_localeGenLines.isEmpty() )
|
||||
return "en_US.UTF-8 UTF-8";
|
||||
|
||||
QString myLanguage = QLocale::languageToString( myLocale.language() );
|
||||
QStringList linesForLanguage;
|
||||
foreach ( QString line, m_localeGenLines )
|
||||
{
|
||||
if ( line.startsWith( QLocale::languageToString( myLocale.language() ) ) )
|
||||
if ( line.startsWith( myLanguage ) )
|
||||
linesForLanguage.append( line );
|
||||
}
|
||||
|
||||
|
@ -312,10 +313,10 @@ LocalePage::guessLCLocale()
|
|||
}
|
||||
|
||||
// FIXME: use reverse geocoding to guess the country
|
||||
QString prefix = myLocale.name();
|
||||
QStringList linesForLanguageAndCountry;
|
||||
foreach ( QString line, linesForLanguage )
|
||||
{
|
||||
QString prefix = myLocale.name();
|
||||
if ( line.startsWith( prefix ) )
|
||||
linesForLanguageAndCountry.append( line );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue