Translate delay message
authorLuciano Montanaro <mikelima@cirulla.net>
Tue, 12 Nov 2013 23:02:54 +0000 (00:02 +0100)
committerLuciano Montanaro <mikelima@cirulla.net>
Tue, 12 Nov 2013 23:02:54 +0000 (00:02 +0100)
application/resources/i18n/quandoparte_it.qm
application/resources/i18n/quandoparte_it.ts
application/stationschedulemodel.cpp

index bcd314f..78d97ee 100644 (file)
Binary files a/application/resources/i18n/quandoparte_it.qm and b/application/resources/i18n/quandoparte_it.qm differ
index 5041e28..4fa15ac 100644 (file)
     </message>
 </context>
 <context>
+    <name>QObject</name>
+    <message>
+        <location filename="../../stationschedulemodel.cpp" line="181"/>
+        <source>On time</source>
+        <translation>In orario</translation>
+    </message>
+    <message>
+        <location filename="../../stationschedulemodel.cpp" line="186"/>
+        <source>Delay: %1 minutes</source>
+        <translation>Ritardo: %1 minuti</translation>
+    </message>
+    <message>
+        <source>Delay: %1</source>
+        <translation type="obsolete">Ritardo: %1</translation>
+    </message>
+</context>
+<context>
     <name>SearchBar</name>
     <message>
         <location filename="../harmattan/qml/SearchBar.qml" line="41"/>
 <context>
     <name>StationScheduleModel</name>
     <message>
-        <location filename="../../stationschedulemodel.cpp" line="234"/>
+        <location filename="../../stationschedulemodel.cpp" line="246"/>
         <source>Unknown station</source>
         <translation>Stazione sconosciuta</translation>
     </message>
     <message>
-        <location filename="../../stationschedulemodel.cpp" line="236"/>
+        <location filename="../../stationschedulemodel.cpp" line="248"/>
         <source>Unknown error</source>
         <translation>Reeore sconosciuto</translation>
     </message>
     <message>
-        <location filename="../../stationschedulemodel.cpp" line="289"/>
+        <location filename="../../stationschedulemodel.cpp" line="301"/>
         <source>Network error</source>
         <translation>Errore di rete</translation>
     </message>
index c3fb03d..7dd4cf2 100644 (file)
@@ -176,7 +176,19 @@ static void parseTrain(const QString &text, StationScheduleItem &item)
             item.setArrivalStation(filter.cap(2));
             item.setArrivalTime(filter.cap(3));
         }
-        item.setDelay(filter.cap(6));
+       QString delayDescription = filter.cap(6);
+       if (delayDescription == "in orario") {
+        item.setDelay(QObject::tr("On time"));
+       } else {
+           QRegExp delayRegExp("ritardo (.*)(| minuti)");
+           int pos = delayRegExp.indexIn(delayDescription);
+           if (pos >= 0) {
+        item.setDelay(QString(QObject::tr("Delay: %1 minutes")).arg(delayRegExp.cap(1)));
+           } else {
+               // Does not match, let the user parse it
+               item.setDelay(delayDescription);
+           }
+       }
         item.setExpectedPlatform(filter.cap(4));
         item.setActualPlatform(filter.cap(5));
     } else {