summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <[email protected]>2017-05-13 20:16:28 +0200
committerFriedrich W. H. Kossebau <[email protected]>2017-05-13 20:55:04 +0200
commitc9d571d2d5b28bbd7a9a2602deb929585095d1cf (patch)
tree0ac3cac68424bf54bffc6e3bab116d737d189628
parent13f63a3f3897abfbec64066e7a3f3af22661329f (diff)
[Weather] Fix lookup of bbcukmet translations strings, stored in lowercase
-rw-r--r--dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp b/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
index ff24da0..b6cb78d 100644
--- a/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
+++ b/dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
@@ -765,9 +765,12 @@ void UKMETIon::parseFiveDayForecast(const QString& source, QXmlStreamReader& xml
parseFloat(forecast->tempLow, low.cap(1));
}
+ const QString summaryLC = summary.toLower();
forecast->period = period;
- forecast->iconName = getWeatherIcon(dayIcons(), summary.toLower());
- forecast->summary = i18nc("weather forecast", summary.toUtf8().data());
+ forecast->iconName = getWeatherIcon(dayIcons(), summaryLC);
+ // db uses original strings normalized to lowercase, but we prefer the unnormalized if without translation
+ const QString summaryTranslated = i18nc("weather forecast", summaryLC.toUtf8().data());
+ forecast->summary = (summaryTranslated != summaryLC) ? summaryTranslated : summary;
qCDebug(IONENGINE_BBCUKMET) << "i18n summary string: " << forecast->summary;
m_weatherData[source].forecasts.append(forecast);
// prepare next
@@ -831,8 +834,11 @@ void UKMETIon::updateWeather(const QString& source)
data.insert(QStringLiteral("Observation Period"), weatherData.obsTime);
}
if (!weatherData.condition.isEmpty()) {
+ // db uses original strings normalized to lowercase, but we prefer the unnormalized if without translation
+ const QString conditionLC = weatherData.condition.toLower();
+ const QString conditionTranslated = i18nc("weather condition", conditionLC.toUtf8().data());
data.insert(QStringLiteral("Current Conditions"),
- i18nc("weather condition", weatherData.condition.toUtf8().data()));
+ (conditionTranslated != conditionLC) ? conditionTranslated : weatherData.condition);
}
// qCDebug(IONENGINE_BBCUKMET) << "i18n condition string: " << i18nc("weather condition", weatherData.condition.toUtf8().data());