[Weather] Fix lookup of bbcukmet translations strings, stored in lowercase

parent 13f63a3f
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment