[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-i18n-doc
Subject: Patch for kweather
From: Albert Astals Cid <tsdgeos () yahoo ! es>
Date: 2004-09-03 17:24:06
Message-ID: 200409031924.06465.tsdgeos () yahoo ! es
[Download RAW message or body]
Hi, today i realised in a part of kweather the i18n was done in i18n() +
i18n() + i18n() that is really bad as gives little versatility to
translators, i attach a patch that fixes this.
Ok to commit?
HEAD only as BRANCH is in freeze :(
Albert
["kweather.patch" (text/x-diff)]
Index: metar_parser.cpp
===================================================================
RCS file: /home/kde/kdetoys/kweather/metar_parser.cpp,v
retrieving revision 1.1
diff -u -r1.1 metar_parser.cpp
--- metar_parser.cpp 22 Jun 2004 00:43:20 -0000 1.1
+++ metar_parser.cpp 3 Sep 2004 17:06:17 -0000
@@ -210,97 +210,97 @@
{
QString sIntensity = CurrentRegExp.cap(1);
QString sCode = CurrentRegExp.cap(2);
- QString currentWeather = "";
+ QString intensity, descriptor, phenomena, currentWeather;
kdDebug(12006) << "Current: " << CurrentRegExp.capturedTexts().join("-") << endl;
// Decode the intensity
if (sIntensity == "+")
{
- currentWeather = i18n("Heavy");
+ intensity = i18n("Heavy");
weatherInfo.heavy = true;
}
else if (sIntensity == "-")
{
- currentWeather = i18n("Light");
+ intensity = i18n("Light");
weatherInfo.heavy = false;
}
// Decode the descriptor
if (sCode.contains("MI"))
- currentWeather += i18n(" Shallow");
+ descriptor = i18n("Shallow");
else if (sCode.contains("PR"))
- currentWeather += i18n(" Partial");
+ descriptor = i18n("Partial");
else if (sCode.contains("BC"))
- currentWeather += i18n(" Patches");
+ descriptor = i18n("Patches");
else if (sCode.contains("DR"))
- currentWeather += i18n(" Low Drifting");
+ descriptor = i18n("Low Drifting");
else if (sCode.contains("BL"))
- currentWeather += i18n(" Blowing");
+ descriptor = i18n("Blowing");
else if (sCode.contains("SH"))
{
- currentWeather += i18n(" Showers");
+ descriptor = i18n("Showers");
weatherInfo.theWeather = "shower";
}
else if (sCode.contains("TS"))
{
- currentWeather += i18n(" Thunder Storm");
+ descriptor = i18n("Thunder Storm");
weatherInfo.theWeather = "tstorm";
}
else if (sCode.contains("FZ"))
{
- currentWeather += i18n(" Freezing");
+ descriptor = i18n("Freezing");
}
// Decode weather phenomena
if (sCode.contains("DZ"))
{
- currentWeather += i18n(" Drizzle");
+ phenomena = i18n("Drizzle");
weatherInfo.theWeather = "light_rain";
}
else if (sCode.contains("RA"))
{
- currentWeather += i18n(" Rain");
+ phenomena = i18n("Rain");
weatherInfo.theWeather = "shower";
}
else if (sCode.contains("SN"))
{
- currentWeather += i18n(" Snow");
+ phenomena = i18n("Snow");
weatherInfo.theWeather = "snow";
}
else if (sCode.contains("SG"))
{
- currentWeather += i18n(" Snow Grains");
+ phenomena = i18n("Snow Grains");
weatherInfo.theWeather = "snow4";
}
else if (sCode.contains("IC"))
{
- currentWeather += i18n(" Ice Crystals");
+ phenomena = i18n("Ice Crystals");
weatherInfo.theWeather = "hail";
}
else if (sCode.contains("PE"))
{
- currentWeather += i18n(" Ice Pellets");
+ phenomena = i18n("Ice Pellets");
weatherInfo.theWeather = "hail";
}
else if (s.contains("GR"))
{
- currentWeather += i18n(" Hail");
+ phenomena = i18n("Hail");
weatherInfo.theWeather = "hail";
}
else if (sCode.contains("GS"))
{
- currentWeather += i18n(" Small Hail Pellets");
+ phenomena = i18n("Small Hail Pellets");
weatherInfo.theWeather = "hail";
}
else if (s.contains("UP"))
{
- currentWeather += i18n(" Unknown Precipitation");
+ phenomena = i18n("Unknown Precipitation");
weatherInfo.theWeather = iconName("shower1");
}
else if (sCode.contains("BR"))
{
- currentWeather += i18n(" Mist");
+ phenomena = i18n("Mist");
// Mist has lower priority than say rain or snow
if ( weatherInfo.theWeather.isEmpty() )
{
@@ -309,7 +309,7 @@
}
else if (sCode.contains("FG"))
{
- currentWeather += i18n(" Fog");
+ phenomena = i18n("Fog");
// Fog has lower priority than say rain or snow
if ( weatherInfo.theWeather.isEmpty() )
{
@@ -317,32 +317,34 @@
}
}
else if (sCode.contains("FU"))
- currentWeather += i18n(" Smoke");
+ phenomena = i18n("Smoke");
else if (sCode.contains("VA"))
- currentWeather += i18n(" Volcanic Ash");
+ phenomena = i18n("Volcanic Ash");
else if (sCode.contains("DU"))
- currentWeather += i18n(" Widespread Dust");
+ phenomena = i18n("Widespread Dust");
else if (sCode.contains("SA"))
- currentWeather += i18n(" Sand");
+ phenomena = i18n("Sand");
else if (sCode.contains("HZ"))
- currentWeather += i18n(" Haze");
+ phenomena = i18n("Haze");
else if (sCode.contains("PY"))
- currentWeather += i18n(" Spray");
+ phenomena = i18n("Spray");
else if (sCode.contains("PO"))
- currentWeather += i18n(" Dust/Sand Swirls");
+ phenomena = i18n("Dust/Sand Swirls");
else if (sCode.contains("SQ"))
- currentWeather += i18n(" Sudden Winds");
+ phenomena = i18n("Sudden Winds");
else if (sCode.contains("FC"))
{
if (sIntensity == "+")
currentWeather = i18n("Tornado");
else
- currentWeather += i18n(" Funnel Cloud");
+ phenomena = i18n("Funnel Cloud");
}
else if (sCode.contains("SS"))
- currentWeather += i18n(" Sand Storm");
+ phenomena = i18n("Sand Storm");
else if (sCode.contains("DS"))
- currentWeather += i18n("Dust Storm");
+ phenomena = i18n("Dust Storm");
+
+ if (currentWeather.isEmpty()) currentWeather = i18n("%1 is the intensity, %2 is \
the descriptor and %3 is the phenomena", "%1 %2 \
%3").arg(intensity).arg(descriptor).arg(phenomena);
if (!currentWeather.isEmpty())
weatherInfo.qsCurrentList << currentWeather;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic