[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH] Mark strings for translati on with noop functio
From: |
Konstantin Mochalov |
Subject: |
[Maposmatic-dev] [PATCH] Mark strings for translati on with noop function to use in maposmatic. |
Date: |
Wed, 4 Apr 2012 10:50:27 +0400 |
Styles are not yet marked for translation, because defined in config,
possible to export style translation strings by creating .py file
that will not be imported, with
_("MapOSMatic stylesheet suitable for printing")
etc, end add this .py file to xgettext invocation.
Not tested this change.
---
i18n.py | 5 ++-
locale/ocitysmap.pot | 70 +++++++++++++++++--------
locale/ru/LC_MESSAGES/ocitysmap.po | 38 +++++++++++---
ocitysmap2/i18n.py | 3 +
ocitysmap2/layoutlib/__init__.py | 5 ++-
ocitysmap2/layoutlib/multi_page_renderer.py | 3 +-
ocitysmap2/layoutlib/single_page_renderers.py | 9 ++--
7 files changed, 97 insertions(+), 36 deletions(-)
diff --git a/i18n.py b/i18n.py
index a241dc7..5de1119 100755
--- a/i18n.py
+++ b/i18n.py
@@ -32,9 +32,12 @@ def make_pot():
print "Make locale/ocitysmap.pot"
subprocess.check_call(['xgettext', '-o', 'ocitysmap.pot', '-p', 'locale',
'-L', 'Python',
+ '--keyword=gettext_noop',
+ '--no-wrap',
'ocitysmap2/indexlib/indexer.py',
'ocitysmap2/layoutlib/multi_page_renderer.py',
- 'ocitysmap2/layoutlib/single_page_renderers.py'])
+ 'ocitysmap2/layoutlib/single_page_renderers.py',
+ 'ocitysmap2/layoutlib/__init__.py'])
return
def make_po(languages):
diff --git a/locale/ocitysmap.pot b/locale/ocitysmap.pot
index 2e181a3..643968d 100644
--- a/locale/ocitysmap.pot
+++ b/locale/ocitysmap.pot
@@ -1,19 +1,20 @@
# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR ORGANIZATION
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <address@hidden>, YEAR.
#
+#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2012-03-31 23:23+CEST\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-04-04 10:33+0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <address@hidden>\n"
"Language-Team: LANGUAGE <address@hidden>\n"
"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: ENCODING\n"
-"Generated-By: pygettext.py 1.5\n"
-
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
#: ocitysmap2/indexlib/indexer.py:163
msgid "Places of worship"
@@ -23,16 +24,16 @@ msgstr ""
msgid "Place of worship"
msgstr ""
-#: ocitysmap2/indexlib/indexer.py:165
-msgid "Kindergarten"
-msgstr ""
-
#: ocitysmap2/indexlib/indexer.py:165 ocitysmap2/indexlib/indexer.py:166
#: ocitysmap2/indexlib/indexer.py:167 ocitysmap2/indexlib/indexer.py:168
#: ocitysmap2/indexlib/indexer.py:169
msgid "Education"
msgstr ""
+#: ocitysmap2/indexlib/indexer.py:165
+msgid "Kindergarten"
+msgstr ""
+
#: ocitysmap2/indexlib/indexer.py:166
msgid "School"
msgstr ""
@@ -49,15 +50,15 @@ msgstr ""
msgid "Library"
msgstr ""
-#: ocitysmap2/indexlib/indexer.py:170
-msgid "Town hall"
-msgstr ""
-
#: ocitysmap2/indexlib/indexer.py:170 ocitysmap2/indexlib/indexer.py:171
#: ocitysmap2/indexlib/indexer.py:172 ocitysmap2/indexlib/indexer.py:174
msgid "Public buildings"
msgstr ""
+#: ocitysmap2/indexlib/indexer.py:170
+msgid "Town hall"
+msgstr ""
+
#: ocitysmap2/indexlib/indexer.py:171
msgid "Post office"
msgstr ""
@@ -70,16 +71,21 @@ msgstr ""
msgid "Police"
msgstr ""
-#: ocitysmap2/indexlib/indexer.py:379
+#: ocitysmap2/indexlib/indexer.py:384
msgid "Villages"
msgstr ""
-#: ocitysmap2/layoutlib/multi_page_renderer.py:484
+#: ocitysmap2/layoutlib/multi_page_renderer.py:66
+msgid "A multi-page layout."
+msgstr ""
+
+#: ocitysmap2/layoutlib/multi_page_renderer.py:466
+#, python-format
msgid ""
-"Copyright \302\251 %(year)d MapOSMatic/OCitySMap developers.\n"
+"Copyright © %(year)d MapOSMatic/OCitySMap developers.\n"
"http://www.maposmatic.org\n"
"\n"
-"Map data \302\251 %(year)d OpenStreetMap.org and contributors (cc-by-sa).\n"
+"Map data © %(year)d OpenStreetMap.org and contributors (cc-by-sa).\n"
"http://www.openstreetmap.org\n"
"\n"
"Map rendered on: %(date)s. OSM data updated on: %(osmdate)s.\n"
@@ -87,22 +93,42 @@ msgid ""
"See http://wiki.openstreetmap.org"
msgstr ""
-#: ocitysmap2/layoutlib/multi_page_renderer.py:499
+#: ocitysmap2/layoutlib/multi_page_renderer.py:481
#: ocitysmap2/layoutlib/single_page_renderers.py:306
msgid "unknown"
msgstr ""
-#: ocitysmap2/layoutlib/multi_page_renderer.py:574
+#: ocitysmap2/layoutlib/multi_page_renderer.py:536
msgid "This page is intentionally left blank."
msgstr ""
+#: ocitysmap2/layoutlib/single_page_renderers.py:59
+msgid "A generic full-page layout with or without index."
+msgstr ""
+
#: ocitysmap2/layoutlib/single_page_renderers.py:293
+#, python-format
msgid ""
-"Copyright \302\251 %(year)d MapOSMatic/OCitySMap developers. Map data
\302\251 %(year)d OpenStreetMap.org and contributors (cc-by-sa).\n"
+"Copyright © %(year)d MapOSMatic/OCitySMap developers. Map data © %(year)d
OpenStreetMap.org and contributors (cc-by-sa).\n"
"Map rendered on: %(date)s. OSM data updated on: %(osmdate)s. The map may be
incomplete or inaccurate. You can contribute to improve this map. See
http://wiki.openstreetmap.org"
msgstr ""
-#: ocitysmap2/layoutlib/single_page_renderers.py:634
+#: ocitysmap2/layoutlib/single_page_renderers.py:521
+msgid "Full-page layout without index."
+msgstr ""
+
+#: ocitysmap2/layoutlib/single_page_renderers.py:557
+msgid "Full-page layout with the index on the side."
+msgstr ""
+
+#: ocitysmap2/layoutlib/single_page_renderers.py:592
+msgid "Full-page layout with the index at the bottom."
+msgstr ""
+
+#: ocitysmap2/layoutlib/single_page_renderers.py:631
msgid "Test gettext"
msgstr ""
+#: ocitysmap2/layoutlib/__init__.py:47
+msgid "Best fit"
+msgstr ""
diff --git a/locale/ru/LC_MESSAGES/ocitysmap.po
b/locale/ru/LC_MESSAGES/ocitysmap.po
index 93a74cc..438e434 100644
--- a/locale/ru/LC_MESSAGES/ocitysmap.po
+++ b/locale/ru/LC_MESSAGES/ocitysmap.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ocitymap\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-04-03 12:34+0400\n"
+"POT-Creation-Date: 2012-04-04 10:33+0400\n"
"PO-Revision-Date: \n"
"Last-Translator: Konstantin Mochalov <address@hidden>\n"
"Language-Team: \n"
@@ -76,7 +76,11 @@ msgstr "Полиция"
msgid "Villages"
msgstr "Поселки"
-#: ocitysmap2/layoutlib/multi_page_renderer.py:465
+#: ocitysmap2/layoutlib/multi_page_renderer.py:66
+msgid "A multi-page layout."
+msgstr "Многостраничная верстка."
+
+#: ocitysmap2/layoutlib/multi_page_renderer.py:466
#, python-format
msgid ""
"Copyright © %(year)d MapOSMatic/OCitySMap developers.\n"
@@ -99,16 +103,20 @@ msgstr ""
"Данные этой карты могут быть неполными или неточными. Вы можете внести свой\n"
"вклад в улучшение карты. См. http://wiki.openstreetmap.org"
-#: ocitysmap2/layoutlib/multi_page_renderer.py:480
-#: ocitysmap2/layoutlib/single_page_renderers.py:305
+#: ocitysmap2/layoutlib/multi_page_renderer.py:481
+#: ocitysmap2/layoutlib/single_page_renderers.py:306
msgid "unknown"
msgstr "неизвестно"
-#: ocitysmap2/layoutlib/multi_page_renderer.py:535
+#: ocitysmap2/layoutlib/multi_page_renderer.py:536
msgid "This page is intentionally left blank."
msgstr "Эта страница намеренно оставлена пустой."
-#: ocitysmap2/layoutlib/single_page_renderers.py:292
+#: ocitysmap2/layoutlib/single_page_renderers.py:59
+msgid "A generic full-page layout with or without index."
+msgstr "Одностраничная верстка с указателем или без."
+
+#: ocitysmap2/layoutlib/single_page_renderers.py:293
#, python-format
msgid ""
"Copyright © %(year)d MapOSMatic/OCitySMap developers. Map data © %(year)d
OpenStreetMap.org and contributors (cc-by-sa).\n"
@@ -117,7 +125,23 @@ msgstr ""
"© %(year)d разработчики MapOSMatic/OCitySMap. Данные карты © %(year)d
участники проекта OpenStreetMap.org (cc-by-sa).\n"
"Карта отрисована: %(date)s. Данные OSM обновлены: %(osmdate)s. Данные этой
карты могут быть неполными или неточными. Вы можете внести свой вклад в
улучшение карты. См. http://wiki.openstreetmap.org"
-#: ocitysmap2/layoutlib/single_page_renderers.py:630
+#: ocitysmap2/layoutlib/single_page_renderers.py:521
+msgid "Full-page layout without index."
+msgstr "Одностраничная верстка без указателя."
+
+#: ocitysmap2/layoutlib/single_page_renderers.py:557
+msgid "Full-page layout with the index on the side."
+msgstr "Одностраничная верстка с указателем сбоку."
+
+#: ocitysmap2/layoutlib/single_page_renderers.py:592
+msgid "Full-page layout with the index at the bottom."
+msgstr "Одностраничная верстка с указателем внизу."
+
+#: ocitysmap2/layoutlib/single_page_renderers.py:631
msgid "Test gettext"
msgstr "Тест gettext"
+#: ocitysmap2/layoutlib/__init__.py:47
+msgid "Best fit"
+msgstr "Под размер карты"
+
diff --git a/ocitysmap2/i18n.py b/ocitysmap2/i18n.py
index 57a58b3..b08a5ec 100644
--- a/ocitysmap2/i18n.py
+++ b/ocitysmap2/i18n.py
@@ -826,3 +826,6 @@ def install_translation(locale_name, locale_path):
class is i18n_generic"""
language_class = language_class_map.get(locale_name, i18n_generic)
return language_class(locale_name, locale_path)
+
+def gettext_noop(str):
+ return str
diff --git a/ocitysmap2/layoutlib/__init__.py b/ocitysmap2/layoutlib/__init__.py
index 83ed70e..515ff2a 100644
--- a/ocitysmap2/layoutlib/__init__.py
+++ b/ocitysmap2/layoutlib/__init__.py
@@ -23,6 +23,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Portrait paper sizes in milimeters
+
+from ocitysmap2.i18n import gettext_noop
+
PAPER_SIZES = [('A5', 148, 210),
('A4', 210, 297),
('A3', 297, 420),
@@ -41,5 +44,5 @@ PAPER_SIZES = [('A5', 148, 210),
('50x50cm', 500, 500),
('40x40cm', 400, 400),
- ('Best fit', None, None),
+ (gettext_noop('Best fit'), None, None),
]
diff --git a/ocitysmap2/layoutlib/multi_page_renderer.py
b/ocitysmap2/layoutlib/multi_page_renderer.py
index e41af24..bda0593 100644
--- a/ocitysmap2/layoutlib/multi_page_renderer.py
+++ b/ocitysmap2/layoutlib/multi_page_renderer.py
@@ -50,6 +50,7 @@ import commons
import shapely.wkt
from ocitysmap2 import maplib
from ocitysmap2 import draw_utils
+from ocitysmap2.i18n import gettext_noop
from indexlib.commons import IndexCategory
@@ -62,7 +63,7 @@ class MultiPageRenderer(Renderer):
"""
name = 'multi_page'
- description = 'A multi-page layout.'
+ description = gettext_noop("A multi-page layout.")
multipages = True
def __init__(self, db, rc, tmpdir, dpi, file_prefix):
diff --git a/ocitysmap2/layoutlib/single_page_renderers.py
b/ocitysmap2/layoutlib/single_page_renderers.py
index 172f8bf..ffbceae 100644
--- a/ocitysmap2/layoutlib/single_page_renderers.py
+++ b/ocitysmap2/layoutlib/single_page_renderers.py
@@ -37,6 +37,7 @@ import commons
import ocitysmap2
from abstract_renderer import Renderer
from ocitysmap2.indexlib.renderer import StreetIndexRenderer
+from ocitysmap2.i18n import gettext_noop
import logging
@@ -55,7 +56,7 @@ class SinglePageRenderer(Renderer):
"""
name = 'generic_single_page'
- description = 'A generic full-page layout with or without index.'
+ description = gettext_noop('A generic full-page layout with or without
index.')
MAX_INDEX_OCCUPATION_RATIO = 1/3.
@@ -517,7 +518,7 @@ class SinglePageRenderer(Renderer):
class SinglePageRendererNoIndex(SinglePageRenderer):
name = 'plain'
- description = 'Full-page layout without index.'
+ description = gettext_noop('Full-page layout without index.')
def __init__(self, db, rc, tmpdir, dpi, file_prefix):
"""
@@ -553,7 +554,7 @@ class SinglePageRendererNoIndex(SinglePageRenderer):
class SinglePageRendererIndexOnSide(SinglePageRenderer):
name = 'single_page_index_side'
- description = 'Full-page layout with the index on the side.'
+ description = gettext_noop('Full-page layout with the index on the side.')
def __init__(self, db, rc, tmpdir, dpi, file_prefix):
"""
@@ -588,7 +589,7 @@ class SinglePageRendererIndexOnSide(SinglePageRenderer):
class SinglePageRendererIndexBottom(SinglePageRenderer):
name = 'single_page_index_bottom'
- description = 'Full-page layout with the index at the bottom.'
+ description = gettext_noop('Full-page layout with the index at the
bottom.')
def __init__(self, db, rc, tmpdir, dpi, file_prefix):
"""
--
1.7.6.msysgit.0
Re: [Maposmatic-dev] A proposal to solve the translation problem, Konstantin Mochalov, 2012/04/04
[Maposmatic-dev] (no subject), Konstantin Mochalov, 2012/04/04
- [Maposmatic-dev] [PATCH] Mark strings for translati on with noop function to use in maposmatic.,
Konstantin Mochalov <=
Re: [Maposmatic-dev] A proposal to solve the translation problem, Thomas Petazzoni, 2012/04/10