diff options
author | Martin Gräßlin <mgraesslin@kde.org> | 2014-06-12 11:30:24 +0200 |
---|---|---|
committer | Martin Gräßlin <mgraesslin@kde.org> | 2014-06-21 07:41:18 +0200 |
commit | a52b00f31eb5df1cd603975bdd31794233898a59 (patch) | |
tree | 4f302c61a3f77216b9cf29208b4c7cd79eb60edf /src/core/kconfigdata.cpp | |
parent | 9aeacb07b1169fa3dc9b7653e8f30070a91569d5 (diff) | |
download | kconfig-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/kconfigdata.cpp')
-rw-r--r-- | src/core/kconfigdata.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/kconfigdata.cpp b/src/core/kconfigdata.cpp index 109063d6..6ef6af07 100644 --- a/src/core/kconfigdata.cpp +++ b/src/core/kconfigdata.cpp @@ -145,6 +145,11 @@ bool KEntryMap::setEntry(const QByteArray &group, const QByteArray &key, const Q } e.bExpand = (options & EntryExpansion); e.bReverted = false; + if (options & EntryLocalized) { + e.bLocalizedCountry = (options & EntryLocalizedCountry); + } else { + e.bLocalizedCountry = false; + } if (newKey) { //qDebug() << "inserting" << k << "=" << value; @@ -158,6 +163,14 @@ bool KEntryMap::setEntry(const QByteArray &group, const QByteArray &key, const Q return true; } else { // KEntry e2 = it.value(); + if (options & EntryLocalized) { + // fast exit checks for cases where the existing entry is more specific + const KEntry &e2 = it.value(); + if (e2.bLocalizedCountry && !e.bLocalizedCountry) { + // lang_COUNTRY > lang + return false; + } + } if (it.value() != e) { //qDebug() << "changing" << k << "from" << e.mValue << "to" << value; it.value() = e; |