From fc659cab9fcc4078aa7f0ffaa644647e43e96ee2 Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Wed, 7 Mar 2018 19:22:13 +0530 Subject: [PATCH 1/2] number localization format for de set same as en --- dynamicweb/formats/__init__.py | 0 dynamicweb/formats/de/__init__.py | 0 dynamicweb/formats/de/formats.py | 2 ++ dynamicweb/settings/base.py | 19 ++++++++++--------- hosting/templates/hosting/orders.html | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 dynamicweb/formats/__init__.py create mode 100644 dynamicweb/formats/de/__init__.py create mode 100644 dynamicweb/formats/de/formats.py diff --git a/dynamicweb/formats/__init__.py b/dynamicweb/formats/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dynamicweb/formats/de/__init__.py b/dynamicweb/formats/de/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/dynamicweb/formats/de/formats.py b/dynamicweb/formats/de/formats.py new file mode 100644 index 00000000..c1f28af7 --- /dev/null +++ b/dynamicweb/formats/de/formats.py @@ -0,0 +1,2 @@ +DECIMAL_SEPARATOR = '.' +THOUSAND_SEPARATOR = ',' diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 5027afef..11666ab7 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -255,6 +255,12 @@ USE_L10N = True USE_TZ = True +USE_THOUSAND_SEPARATOR = True + +FORMAT_MODULE_PATH = [ + 'dynamicweb.formats' +] + LANGUAGES = ( ('en-us', _('English')), ('de', _('Deutsch')), @@ -262,11 +268,6 @@ LANGUAGES = ( LANGUAGE_CODE = 'en-us' -LOCALE_PATHS = [ - - os.path.join(PROJECT_DIR, 'digitalglarus/locale'), -] - CMS_PLACEHOLDER_CONF = { 'logo_image': { 'name': 'Logo Image', @@ -334,7 +335,7 @@ CMS_PLACEHOLDER_CONF = { }, } -CMS_PERMISSION=True +CMS_PERMISSION = True CACHES = { 'default': { @@ -522,14 +523,14 @@ if UNGLEICH_SITE_CONFIGS == "": raise Exception("Please define UNGLEICH_SITE_CONFIGS in your .env") else: try: - configs_dict=json.loads(UNGLEICH_SITE_CONFIGS) + configs_dict = json.loads(UNGLEICH_SITE_CONFIGS) except ValueError as verr: raise Exception("UNGLEICH_SITE_CONFIGS is not a valid JSON: {}".format( str(verr) )) else: MULTISITE_CMS_URLS = { - k:v['MULTISITE_CMS_URL'] for (k,v) in configs_dict.items() + k: v['MULTISITE_CMS_URL'] for (k, v) in configs_dict.items() } MULTISITE_CMS_ALIASES = { @@ -611,7 +612,7 @@ DCL_ERROR_EMAILS_TO_LIST = [] if DCL_ERROR_EMAILS_TO is not None: DCL_ERROR_EMAILS_TO_LIST = [x.strip() for x in DCL_ERROR_EMAILS_TO.split( - ',')] \ + ',')] \ if "," in DCL_ERROR_EMAILS_TO else [DCL_ERROR_EMAILS_TO.strip()] if 'info@ungleich.ch' not in DCL_ERROR_EMAILS_TO_LIST: diff --git a/hosting/templates/hosting/orders.html b/hosting/templates/hosting/orders.html index d747979d..e0e85cfd 100644 --- a/hosting/templates/hosting/orders.html +++ b/hosting/templates/hosting/orders.html @@ -30,7 +30,7 @@ {{ order.id }} {{ order.created_at | date:"M d, Y H:i" }} - {{ order.price|unlocalize }} + {{ order.price }} {% trans 'See Invoice' %} From 849cdec0e21564f95059318c8a0a523fc7607eed Mon Sep 17 00:00:00 2001 From: Arvind Tiwari Date: Wed, 21 Mar 2018 01:29:28 +0530 Subject: [PATCH 2/2] unlocalize vm id --- hosting/templates/hosting/virtual_machines.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hosting/templates/hosting/virtual_machines.html b/hosting/templates/hosting/virtual_machines.html index 467d9d39..ce1656ae 100644 --- a/hosting/templates/hosting/virtual_machines.html +++ b/hosting/templates/hosting/virtual_machines.html @@ -1,5 +1,5 @@ {% extends "hosting/base_short.html" %} -{% load staticfiles bootstrap3 i18n %} +{% load staticfiles bootstrap3 i18n l10n %} {% block content %}
@@ -40,7 +40,7 @@ {% for vm in vms %} - {{vm.vm_id}} + {{vm.vm_id|unlocalize}} {% if vm.ipv4 %}{{vm.ipv4}}{% endif %} {% if vm.ipv6 %}{{vm.ipv6}}{% endif %}