[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH 1/2] forms: translate sty lesheet and layout des
From: |
Thomas Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH 1/2] forms: translate sty lesheet and layout descriptions, and paper sizes |
Date: |
Tue, 3 Apr 2012 23:13:44 +0200 |
Until now, the stylesheet description strings were coming from the
OcitySMap configuration file, the layout description strings from the
OcitySMap source code, and the paper sizes from the OcitySMap code as
well.
Unfortunately, when MapOSMatic queries the list of stylesheets,
layouts and paper sizes, OcitySMap has no idea of which language the
web site is in. OcitySMap cares about the language in which the map
will be rendered, not the language in which the website is displayed.
Therefore, in order to properly translate the stylesheet descriptions,
layout descriptions and paper sizes, we have to do it from MapOSMatic
itself. The drawback is that MapOSMatic now needs to know the list of
layouts and stylesheets, but there doesn't seem to be other reasonable
solutions.
Signed-off-by: Thomas Petazzoni <address@hidden>
---
www/maposmatic/forms.py | 36 ++++++++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/www/maposmatic/forms.py b/www/maposmatic/forms.py
index 251d24c..671833b 100644
--- a/www/maposmatic/forms.py
+++ b/www/maposmatic/forms.py
@@ -87,17 +87,41 @@ class MapRenderingJobForm(forms.ModelForm):
layout_renderers = self._ocitysmap.get_all_renderers()
stylesheets = self._ocitysmap.get_all_style_configurations()
- self.fields['layout'].choices = [(r.name, r.description)
- for r in layout_renderers]
+ for r in layout_renderers:
+ if r.name == 'plain':
+ description = _(u"Full-page layout without street index")
+ elif r.name == 'single_page_index_side':
+ description = _(u"Full-page layout with the street index on
the side")
+ elif r.name == 'single_page_index_bottom':
+ description = _(u"Full-page layout with the street index at
the bottom")
+ elif r.name == 'multi_page':
+ description = _(u"Multi-page layout")
+ else:
+ description = _(u"The %(layout_name)s layout")
+ self.fields['layout'].choices.append((r.name, description))
+
self.fields['layout'].initial = layout_renderers[0].name
- self.fields['stylesheet'].choices = [(s.name, s.description)
- for s in stylesheets]
+ for s in stylesheets:
+ if s.name == "Default":
+ description = _("The default OpenStreetMap.org style")
+ elif s.name == "MapQuestEu":
+ description = _("The european MapQuest style")
+ elif s.name == "MapQuestUs":
+ description = _("The US MapQuest style")
+ elif s.name == "MapQuestUk":
+ description = _("The UK MapQuest style")
+ elif s.name == "Printable":
+ description = _("A MapOSMatic-specific stylesheet suitable for
printing")
+ else:
+ description = _("The <i>%(stylesheet_name)</i> stylesheet")
+ self.fields['stylesheet'].choices.append((r.name, description))
+
self.fields['stylesheet'].initial = stylesheets[0].name
def _build_papersize_description(p):
- if p[1] is None or p[2] is None:
- return mark_safe("%s <em class=\"papersize\"></em>" % p[0])
+ if p[0] == "Best fit":
+ return mark_safe(_("Best fit <em class=\"papersize\"></em>"))
else:
return mark_safe("%s <em class=\"papersize\">"
"(%.1f × %.1f cm²)</em>"
--
1.7.4.1
- [Maposmatic-dev] A proposal to solve the translation problem, Thomas Petazzoni, 2012/04/03
- [Maposmatic-dev] [PATCH 1/2] forms: translate sty lesheet and layout descriptions, and paper sizes,
Thomas Petazzoni <=
- [Maposmatic-dev] [PATCH 2/2] Update translations, Thomas Petazzoni, 2012/04/03
- Re: [Maposmatic-dev] A proposal to solve the translation problem, Maxime Petazzoni, 2012/04/03
- Re: [Maposmatic-dev] A proposal to solve the translation problem, Thomas Petazzoni, 2012/04/03
- Re: [Maposmatic-dev] A proposal to solve the translation problem, Jeroen van Rijn, 2012/04/03
- Re: [Maposmatic-dev] A proposal to solve the translation problem, Thomas Petazzoni, 2012/04/03
- Re: [Maposmatic-dev] A proposal to solve the translation problem, Jeroen van Rijn, 2012/04/03
- Re: [Maposmatic-dev] A proposal to solve the translation problem, Thomas Petazzoni, 2012/04/04
- Re: [Maposmatic-dev] A proposal to solve the translation problem, David MENTRE, 2012/04/04
- Re: [Maposmatic-dev] A proposal to solve the translation problem, David MENTRE, 2012/04/04