[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    [kstars] kstars/data/scripts: Fix untranslatable city/region/country names
From:       Alexander Potashev <aspotashev () gmail ! com>
Date:       2015-04-03 13:32:24
Message-ID: E1Ye1hw-0004Lu-AR () scm ! kde ! org
[Download RAW message or body]

Git commit 647ed08686dd727d21ecccbe4ef2f9d0b9864239 by Alexander Potashev.
Committed on 03/04/2015 at 13:23.
Pushed by aspotashev into branch 'master'.

Fix untranslatable city/region/country names

This fixes the whole city translation because kstars/geolocation.cpp
relies on the old i18n contexts like "Country name", etc.

The context strings are now again descriptive and also avoid merged
strings that cannot be translated properly.

This commit does not break the string freeze because all
city/region/country names were previously untranslatable.

CCMAIL: kde-i18n-doc@kde.org

M  +20   -8    kstars/data/scripts/extract_geo_data.py

http://commits.kde.org/kstars/647ed08686dd727d21ecccbe4ef2f9d0b9864239

diff --git a/kstars/data/scripts/extract_geo_data.py b/kstars/data/scripts/extract_geo_data.py
index 590e255..07eef6c 100644
--- a/kstars/data/scripts/extract_geo_data.py
+++ b/kstars/data/scripts/extract_geo_data.py
@@ -8,23 +8,35 @@ db.text_factory = str
 
 cursor = db.cursor()
 
-cursor.execute('''SELECT DISTINCT Name from city''')
+cursor.execute('''SELECT DISTINCT Name, Province, Country from city''')
 all_rows = cursor.fetchall()
 all_rows.sort()
-for row in all_rows:  
-  print('xi18nc("City name (optional, probably does not need a translation)", "{0}")'.format(row[0]))
+for row in all_rows:
+  name = row[0]
+  province = row[1]
+  country = row[2]
+
+  if format(province) != '':
+    place = "{0} {1}".format(province, country)
+  else:
+    place = country
 
-cursor.execute('''SELECT DISTINCT Province from city''')
+  print('xi18nc("City in {0}", "{1}")'.format(place, name))
+
+cursor.execute('''SELECT DISTINCT Province, Country from city''')
 all_rows = cursor.fetchall()
 all_rows.sort()
 for row in all_rows:
-  if format(row[0]) != '':
-    print('xi18nc("Province name (optional, rarely needs a translation)", "{0}")'.format(row[0]))
+  province = row[0]
+  country = row[1]
+
+  if format(province) != '':
+    print('xi18nc("Region/state in {0}", "{1}")'.format(country, province))
 
 cursor.execute('''SELECT DISTINCT Country from city''')
 all_rows = cursor.fetchall()
 all_rows.sort()
 for row in all_rows:  
-  print('xi18nc("Country name (optional, but should be translated)", "{0}")'.format(row[0]))
+  print('xi18nc("Country name", "{0}")'.format(row[0]))
 
-db.close()
\ No newline at end of file
+db.close()
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic