From f4bfe080a651c2c0d4151b29fd3a12632f7010bb Mon Sep 17 00:00:00 2001 From: Meir Date: Fri, 1 Jun 2018 07:43:27 +0200 Subject: [PATCH] mapo en Esperanta lingvo (closes #137) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (+ ĝusta montrado de arabskribaj kaj hebreskribaj nomoj) --- maps/static/maps/world-map.js | 2 ++ maps/views.py | 12 +----------- pasportaservo/settings/base.py | 13 +------------ requirements/base.txt | 1 - 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/maps/static/maps/world-map.js b/maps/static/maps/world-map.js index 0fe9d3e7..1261d558 100644 --- a/maps/static/maps/world-map.js +++ b/maps/static/maps/world-map.js @@ -4,6 +4,8 @@ window.addEventListener("load", function() { + mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.2/mapbox-gl-rtl-text.js'); + var map = new mapboxgl.Map({ container: 'map', style: '/mapo/positron-gl-style.json', diff --git a/maps/views.py b/maps/views.py index 5ade3972..5b96f4c5 100644 --- a/maps/views.py +++ b/maps/views.py @@ -5,7 +5,6 @@ from django.views.decorators.cache import cache_page from django.views.decorators.vary import vary_on_headers -from accept_language import parse_accept_language from djgeojson.views import GeoJSONLayerView from hosting.models import Place @@ -29,16 +28,7 @@ def get_template_names(self): return ['maps/styles/{}-gl-style.json'.format(self.style)] def get_language(self): - try: - language_string = self.request.META['HTTP_ACCEPT_LANGUAGE'] - except KeyError: - return 'en' - - languages = parse_accept_language(language_string) - for lang in languages: - if lang.language in settings.OPENMAPTILES_LANGUAGES: - return lang.language - return 'en' + return 'eo' def get_context_data(self, **kwargs): return { diff --git a/pasportaservo/settings/base.py b/pasportaservo/settings/base.py index 36429c21..7946263b 100644 --- a/pasportaservo/settings/base.py +++ b/pasportaservo/settings/base.py @@ -209,20 +209,9 @@ def user_first_name(user): OPENCAGE_API_KEY = 'a27f7e361bdfe11881a987a6e86fb5fd' -MAPBOX_GL_BASE_STATIC = 'https://api.tiles.mapbox.com/mapbox-gl-js/v0.40.1/mapbox-gl.{ext}' +MAPBOX_GL_BASE_STATIC = 'https://api.tiles.mapbox.com/mapbox-gl-js/v0.45.0/mapbox-gl.{ext}' MAPBOX_GL_CSS = MAPBOX_GL_BASE_STATIC.format(ext='css') MAPBOX_GL_JS = MAPBOX_GL_BASE_STATIC.format(ext='js') # https://openmaptiles.com/hosting/ OPENMAPTILES_API_KEY = 'iQbjILhp2gs0dgNfTlIV' - -# https://github.com/openmaptiles/openmaptiles/openmaptiles.yaml -OPENMAPTILES_LANGUAGES = ( - # 'eo', - 'ar', 'az', 'be', 'bg', 'br', 'bs', 'ca', 'cs', 'cy', 'da', 'de', 'el', - 'en', 'es', 'et', 'fi', 'fr', 'fy', 'ga', 'gd', 'he', 'hr', 'hu', - 'hy', 'is', 'it', 'ja', 'ja_kana', 'ja_rm', 'ka', 'kk', 'kn', 'ko', - 'ko_rm', 'la', 'lb', 'lt', 'lv', 'mk', 'mt', 'nl', 'no', 'pl', 'pt', - 'rm', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr', 'sr-Latn', 'sv', 'th', 'tr', - 'uk', 'zh', -) diff --git a/requirements/base.txt b/requirements/base.txt index d440d97c..a26c687a 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -26,4 +26,3 @@ sendgrid-django==2.0.0 pyuca==1.2 wheel -parse-accept-language==0.1.2