maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH] Initial Polish language support.


From: Łukasz Jernaś
Subject: [Maposmatic-dev] [PATCH] Initial Polish language support.
Date: Mon, 8 Feb 2010 14:09:41 +0100

This patch adds support for some of the caveats in maps of Poland
generated from ocitysmap. Probably more will be needed.
---
 locale/pl/LC_MESSAGES/ocitysmap.po |   85 ++++++++++++++++++++++++++++++++++++
 ocitysmap/i18n.py                  |   52 ++++++++++++++++++++++
 2 files changed, 137 insertions(+), 0 deletions(-)
 create mode 100644 locale/pl/LC_MESSAGES/ocitysmap.po

diff --git a/locale/pl/LC_MESSAGES/ocitysmap.po 
b/locale/pl/LC_MESSAGES/ocitysmap.po
new file mode 100644
index 0000000..c74611d
--- /dev/null
+++ b/locale/pl/LC_MESSAGES/ocitysmap.po
@@ -0,0 +1,85 @@
+# Copyright (C) 2010 Maposmatic
+# This file is licensed under the same terms as the ocitysmap package.
+#
+# Łukasz Jernaś <address@hidden>, 2010.
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"POT-Creation-Date: 2010-02-08 10:18+CET\n"
+"PO-Revision-Date: 2010-02-08 10:28+0100\n"
+"Last-Translator: Łukasz Jernaś <address@hidden>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: ENCODING\n"
+"Generated-By: pygettext.py 1.5\n"
+"X-Generator: Lokalize 1.0\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
+
+#: ocitysmap/draw_utils.py:150
+msgid "This map has been rendered on %s and may be incomplete or inaccurate."
+msgstr ""
+"Mapa ta została wygenerowana dnia %s i może być niekompletna, bądź 
niedokładka."
+
+#: ocitysmap/draw_utils.py:155
+msgid "You can contribute to improve this map. See 
http://wiki.openstreetmap.org";
+msgstr ""
+"Aby pomóc ulepszyć tą mapę, zajrzyj na stronę internetową 
http://wiki.openstreetmap.org";
+
+#: ocitysmap/street_index.py:288
+msgid "Place of worship"
+msgstr "Miejsce kultu"
+
+#: ocitysmap/street_index.py:288
+msgid "Places of worship"
+msgstr "Miejsca kultu"
+
+#: ocitysmap/street_index.py:289
+msgid "Kindergarten"
+msgstr "Przedszkole"
+
+#: ocitysmap/street_index.py:289 ocitysmap/street_index.py:290
+#: ocitysmap/street_index.py:291 ocitysmap/street_index.py:292
+#: ocitysmap/street_index.py:293
+msgid "Education"
+msgstr "Edukacja"
+
+#: ocitysmap/street_index.py:290
+msgid "School"
+msgstr "Szkoła"
+
+#: ocitysmap/street_index.py:291
+msgid "College"
+msgstr "Szkoła wyższa"
+
+#: ocitysmap/street_index.py:292
+msgid "University"
+msgstr "Uniwersytet"
+
+#: ocitysmap/street_index.py:293
+msgid "Library"
+msgstr "Biblioteka"
+
+#: ocitysmap/street_index.py:294
+msgid "Town hall"
+msgstr "Ratusz"
+
+#: ocitysmap/street_index.py:294 ocitysmap/street_index.py:295
+#: ocitysmap/street_index.py:296 ocitysmap/street_index.py:297
+msgid "Public buildings"
+msgstr "Budynki użyteczności publicznej"
+
+#: ocitysmap/street_index.py:295
+msgid "Post office"
+msgstr "Poczta"
+
+#: ocitysmap/street_index.py:296
+msgid "Public building"
+msgstr "Budynek użyteczności publicznej"
+
+#: ocitysmap/street_index.py:297
+msgid "Police"
+msgstr "Policja"
+
+
diff --git a/ocitysmap/i18n.py b/ocitysmap/i18n.py
index 23e85e8..c8778ec 100644
--- a/ocitysmap/i18n.py
+++ b/ocitysmap/i18n.py
@@ -577,6 +577,57 @@ class i18n_hr_HR(i18n):
            e.g. É and E are equals in French map index"""
         return self._upper_unaccent_string(a) == self._upper_unaccent_string(b)
 
+class i18n_pl_generic(i18n):
+ 
+    APPELLATIONS = [ u"Dr.", u"Doktora", u"Ks.", u"Księdza",
+                     u"Generała", u"Gen.",
+                     u"Aleja", u"Plac", u"Pl.",
+                     u"Rondo", u"rondo", u"Profesora",
+                     u"Prof.",
+                     u"" ]
+
+    DETERMINANTS = [ u"\s?im.", u"\s?imienia", u"\s?pw.",
+                     u"" ]
+    
+    SPACE_REDUCE = re.compile(r"\s+")
+    PREFIX_REGEXP = re.compile(r"^(?P<prefix>(%s)(%s)?)\s?\b(?P<name>.+)" %
+                                    ("|".join(APPELLATIONS),
+                                     "|".join(DETERMINANTS)),
+                                      re.IGNORECASE | re.UNICODE)
+
+
+    def __init__(self, language, locale_path):
+        self.language = str(language)
+        _install_language(language, locale_path)
+
+    def language_code(self):
+        return self.language
+
+    def user_readable_street(self, name):
+        #
+        # Make sure name actually contains something,
+        # the PREFIX_REGEXP.match fails on zero-length strings
+        #
+        if len(name) == 0:
+            return name
+
+        name = name.strip()
+        name = self.SPACE_REDUCE.sub(" ", name)
+        matches = self.PREFIX_REGEXP.match(name)
+        #
+        # If no prefix was captured, that's okay. Don't substitute
+        # the name however, "<name> ()" looks silly
+        #
+        if matches == None:
+            return name
+
+        if matches.group('prefix'):
+            name = self.PREFIX_REGEXP.sub(r"\g<name>, \g<prefix>", name)
+        return name
+
+    def first_letter_equal(self, a, b):
+        return a == b
+
 
 class i18n_generic(i18n):
     def __init__(self, language, locale_path):
@@ -651,6 +702,7 @@ language_class_map = {
     'ar_YE.UTF-8': i18n_ar_generic,
     'hr_HR.UTF-8': i18n_hr_HR,
     'ru_RU.UTF-8': i18n_ru_generic,
+    'pl_PL.UTF-8': i18n_pl_generic,
 }
 
 def install_translation(locale_name, locale_path):
-- 
1.6.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]