make layout descriptions translatable (issue #79, wip)

pull/81/head
Hartmut Holzgraefe 2022-11-06 13:45:17 +00:00
rodzic 8abbf82a1e
commit 79fd90c026
7 zmienionych plików z 18 dodań i 7 usunięć

Wyświetl plik

@ -45,6 +45,7 @@ import qrcode.image.svg
from io import BytesIO from io import BytesIO
import html import html
from submodules.robinson import robinson from submodules.robinson import robinson
from gettext import gettext
import ocitysmap import ocitysmap
import coords import coords
@ -87,7 +88,7 @@ class MultiPageRenderer(Renderer):
""" """
name = 'multi_page' name = 'multi_page'
description = 'A multi-page layout.' description = gettext(u'A multi-page layout.')
multipages = True multipages = True
# The DEFAULT SCALE values represents the minimum acceptable mapnik scale # The DEFAULT SCALE values represents the minimum acceptable mapnik scale

Wyświetl plik

@ -1,3 +1,5 @@
from gettext import gettext
import ocitysmap import ocitysmap
from ocitysmap.layoutlib.abstract_renderer import Renderer from ocitysmap.layoutlib.abstract_renderer import Renderer
from ocitysmap.layoutlib.single_page_renderers import SinglePageRenderer from ocitysmap.layoutlib.single_page_renderers import SinglePageRenderer
@ -8,7 +10,7 @@ class SinglePageRendererIndexBottom(SinglePageRenderer):
""" """
name = 'single_page_index_bottom' name = 'single_page_index_bottom'
description = 'Full-page layout with the index at the bottom.' description = gettext(u'Full-page layout with the index at the bottom.')
def __init__(self, db, rc, tmpdir, dpi, file_prefix): def __init__(self, db, rc, tmpdir, dpi, file_prefix):
""" """

Wyświetl plik

@ -1,3 +1,5 @@
from gettext import gettext
import ocitysmap import ocitysmap
from ocitysmap.layoutlib.abstract_renderer import Renderer from ocitysmap.layoutlib.abstract_renderer import Renderer
from ocitysmap.layoutlib.single_page_renderers import SinglePageRenderer from ocitysmap.layoutlib.single_page_renderers import SinglePageRenderer
@ -8,7 +10,7 @@ class SinglePageRendererIndexExtraPage(SinglePageRenderer):
if the output file format supports multiple pages. if the output file format supports multiple pages.
""" """
name = 'single_page_index_extra_page' name = 'single_page_index_extra_page'
description = 'Full-page layout with index on extra page (PDF only).' description = gettext(u'Full-page layout with index on extra page (PDF only).')
def __init__(self, db, rc, tmpdir, dpi, file_prefix): def __init__(self, db, rc, tmpdir, dpi, file_prefix):
""" """

Wyświetl plik

@ -1,3 +1,5 @@
from gettext import gettext
import ocitysmap import ocitysmap
from ocitysmap.layoutlib.abstract_renderer import Renderer from ocitysmap.layoutlib.abstract_renderer import Renderer
from ocitysmap.layoutlib.single_page_renderers import SinglePageRenderer from ocitysmap.layoutlib.single_page_renderers import SinglePageRenderer
@ -7,7 +9,7 @@ class SinglePageRendererNoIndex(SinglePageRenderer):
Render single page map without index Render single page map without index
""" """
name = 'plain' name = 'plain'
description = 'Full-page layout without index.' description = gettext(u'Full-page layout without index.')
def __init__(self, db, rc, tmpdir, dpi, file_prefix): def __init__(self, db, rc, tmpdir, dpi, file_prefix):
""" """

Wyświetl plik

@ -1,3 +1,5 @@
from gettext import gettext
import ocitysmap import ocitysmap
from ocitysmap.layoutlib.abstract_renderer import Renderer from ocitysmap.layoutlib.abstract_renderer import Renderer
from ocitysmap.layoutlib.single_page_renderers import SinglePageRenderer from ocitysmap.layoutlib.single_page_renderers import SinglePageRenderer
@ -7,7 +9,7 @@ class SinglePageRendererIndexOnSide(SinglePageRenderer):
This renderer adds a side index to the basic SinglePageRenderer This renderer adds a side index to the basic SinglePageRenderer
""" """
name = 'single_page_index_side' name = 'single_page_index_side'
description = 'Full-page layout with the index on the side.' description = gettext(u'Full-page layout with the index on the side.')
def __init__(self, db, rc, tmpdir, dpi, file_prefix): def __init__(self, db, rc, tmpdir, dpi, file_prefix):
""" """

Wyświetl plik

@ -39,6 +39,7 @@ assert mapnik.mapnik_version() >= 300000, \
"for more details." % mapnik.mapnik_version_string() "for more details." % mapnik.mapnik_version_string()
import math import math
from copy import copy from copy import copy
from gettext import gettext
from ocitysmap.layoutlib import commons from ocitysmap.layoutlib import commons
import ocitysmap import ocitysmap
@ -69,7 +70,7 @@ class SinglePageRenderer(Renderer):
""" """
name = 'generic_single_page' name = 'generic_single_page'
description = 'A generic full-page layout with or without index.' description = gettext(u'A generic full-page layout with or without index.')
# TODO make configurable # TODO make configurable
MAX_INDEX_OCCUPATION_RATIO = 1/3. MAX_INDEX_OCCUPATION_RATIO = 1/3.

Wyświetl plik

@ -33,6 +33,7 @@ assert mapnik.mapnik_version() >= 300000, \
"for more details." % mapnik.mapnik_version_string() "for more details." % mapnik.mapnik_version_string()
import math import math
from copy import copy from copy import copy
from gettext import gettext
from ocitysmap.layoutlib import commons from ocitysmap.layoutlib import commons
import ocitysmap import ocitysmap
@ -57,7 +58,7 @@ class TK25Renderer(Renderer):
""" """
name = 'tk25' name = 'tk25'
description = "German TK25 'Messtischblatt' style" description = gettext(u"German TK25 'Messtischblatt' style")
def __init__(self, db, rc, tmpdir, dpi, file_prefix, def __init__(self, db, rc, tmpdir, dpi, file_prefix,
index_position = 'side'): index_position = 'side'):