aboutsummaryrefslogtreecommitdiff
path: root/src/core/kconfigini.cpp
diff options
context:
space:
mode:
authorMartin Gräßlin <mgraesslin@kde.org>2014-06-12 11:30:24 +0200
committerMartin Gräßlin <mgraesslin@kde.org>2014-06-21 07:41:18 +0200
commita52b00f31eb5df1cd603975bdd31794233898a59 (patch)
tree4f302c61a3f77216b9cf29208b4c7cd79eb60edf /src/core/kconfigini.cpp
parent9aeacb07b1169fa3dc9b7653e8f30070a91569d5 (diff)
downloadkconfig-a52b00f31eb5df1cd603975bdd31794233898a59.tar.gz
kconfig-a52b00f31eb5df1cd603975bdd31794233898a59.tar.bz2
Fix reading of entries for language/country combinations
This fixes a regression introduced in 988f09bb051dca0437ecec431ee44ed5b4a560d8. The mentioned commit ensures that if the locale is e.g. "de_DE" the entry "de" will be used. But this breaks if there is a translation for another country. E.g. for "de_CH" it would also pick the "de" entry. This change now operates on both just the language code and the locale. If an entry with the language code is present it will be picked. If another entry with the exact locale is found it will be overwritten. Modifiers are not supported as this is currently missing in QLocale. REVIEW: 118692
Diffstat (limited to 'src/core/kconfigini.cpp')
-rw-r--r--src/core/kconfigini.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp
index f4ce9410..5fe4de03 100644
--- a/src/core/kconfigini.cpp
+++ b/src/core/kconfigini.cpp
@@ -85,6 +85,8 @@ KConfigIniBackend::parseConfig(const QByteArray &currentLocale, KEntryMap &entry
return ParseOk;
}
+ const QByteArray currentLanguage = currentLocale.split('_').first();
+
bool bDefault = options & ParseDefaults;
bool allowExecutableValues = options & ParseExpansions;
@@ -251,7 +253,7 @@ KConfigIniBackend::parseConfig(const QByteArray &currentLocale, KEntryMap &entry
}
printableToString(&aKey, file, lineNo);
if (!locale.isEmpty()) {
- if (locale != currentLocale) {
+ if (locale != currentLocale && locale != currentLanguage) {
// backward compatibility. C == en_US
if (locale.at(0) != 'C' || currentLocale != "en_US") {
if (merging) {
@@ -275,6 +277,9 @@ KConfigIniBackend::parseConfig(const QByteArray &currentLocale, KEntryMap &entry
}
if (!locale.isNull()) {
entryOptions |= KEntryMap::EntryLocalized;
+ if (locale.indexOf('_') != -1) {
+ entryOptions |= KEntryMap::EntryLocalizedCountry;
+ }
}
printableToString(&line, file, lineNo);
if (entryOptions & KEntryMap::EntryRawKey) {