[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH] First support to select map index language into
From: |
David MENTRE |
Subject: |
[Maposmatic-dev] [PATCH] First support to select map index language into maposmatic |
Date: |
Sun, 20 Dec 2009 22:09:22 +0100 |
* You need to drop maposmatic_maprenderingjob table and run a manage
syncdb.
* The selection of Belgian languages will crash current ocitysmap.
---
scripts/maposmaticd | 7 +++++--
www/maposmatic/models.py | 1 +
www/maposmatic/views.py | 2 ++
www/settings.py | 6 ++++++
www/templates/maposmatic/index.html | 9 ++++++++-
5 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/scripts/maposmaticd b/scripts/maposmaticd
index 8af0270..974f5e0 100755
--- a/scripts/maposmaticd
+++ b/scripts/maposmaticd
@@ -40,9 +40,12 @@ def render_job_process(job):
if job.administrative_city == "":
bbox = OCMBoundingBox(job.lat_upper_left, job.lon_upper_left,
job.lat_bottom_right, job.lon_bottom_right)
- renderer = OCitySMap(config_file=OCITYSMAP_CFG_PATH, boundingbox=bbox)
+ renderer = OCitySMap(config_file=OCITYSMAP_CFG_PATH, boundingbox=bbox,
+ language=job.map_language)
else:
- renderer = OCitySMap(config_file=OCITYSMAP_CFG_PATH,
city_name=job.administrative_city)
+ renderer = OCitySMap(config_file=OCITYSMAP_CFG_PATH,
+ city_name=job.administrative_city,
+ language=job.map_language)
outfile_prefix = os.path.join(RENDERING_RESULT_PATH, job.files_prefix())
diff --git a/www/maposmatic/models.py b/www/maposmatic/models.py
index 7d671e3..34cde89 100644
--- a/www/maposmatic/models.py
+++ b/www/maposmatic/models.py
@@ -80,6 +80,7 @@ class MapRenderingJob(models.Model):
resultmsg = models.CharField(max_length=256, null=True)
submitterip = models.IPAddressField()
index_queue_at_submission = models.IntegerField()
+ map_language = models.CharField(max_length=16)
objects = MapRenderingJobManager()
diff --git a/www/maposmatic/views.py b/www/maposmatic/views.py
index 7e5b654..a81fe67 100644
--- a/www/maposmatic/views.py
+++ b/www/maposmatic/views.py
@@ -100,6 +100,7 @@ class MapRenderingJobForm(ModelForm):
maptitle = CharField(max_length=256, required=False)
bbox = AreaField(label=_("Area"), fields=(FloatField(), FloatField(),
FloatField(), FloatField()))
+ map_language = ChoiceField(choices=www.settings.MAP_LANGUAGES)
def clean(self):
cleaned_data = self.cleaned_data
@@ -207,6 +208,7 @@ def index(request):
job.status = 0 # Submitted
job.submitterip = request.META['REMOTE_ADDR']
job.index_queue_at_submission =
MapRenderingJob.objects.queue_size()
+ job.map_language = form.cleaned_data['map_language']
job.save()
return HttpResponseRedirect('/jobs/%d' % job.id)
diff --git a/www/settings.py b/www/settings.py
index d050e60..50a93be 100644
--- a/www/settings.py
+++ b/www/settings.py
@@ -108,6 +108,12 @@ LANGUAGES = (("fr", u"Français"),
("en", u"English"),
("de", u"Deutsch"))
+MAP_LANGUAGES = (("fr_FR.UTF-8", u"France"),
+ ("en_GB.UTF-8", u"United Kingdom"),
+ ("fr_BE.UTF-8", u"Royaume de Belgique (FR)"),
+ ("de_BE.UTF-8", u"Königreich Belgien (DE)"),
+ ("nl_BE.UTF-8", u"Koninkrijk België (NL)"))
+
LOG = logging.getLogger(os.environ.get("MAPOSMATIC_LOG_TARGET",
"maposmatic"))
LOG.setLevel(os.environ.get("MAPOSMATIC_LOG_LEVEL",
diff --git a/www/templates/maposmatic/index.html
b/www/templates/maposmatic/index.html
index a639f38..41e0a77 100644
--- a/www/templates/maposmatic/index.html
+++ b/www/templates/maposmatic/index.html
@@ -179,7 +179,14 @@ maps.{% endblocktrans %}</p>
</ul>
</td>
</tr>
-
+ <tr class="label">
+ <td>{% trans "Map Index Language:" %}</td>
+ </tr>
+ <tr class="field">
+ <td>
+ {{ form.map_language }}
+ </td>
+ </tr>
</table>
</form>
--
1.6.3.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Maposmatic-dev] [PATCH] First support to select map index language into maposmatic,
David MENTRE <=