summaryrefslogtreecommitdiff
path: root/odoo/__init__.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-04-05 10:50:56 +0200
committerChristophe Simonis <chs@odoo.com>2019-04-05 10:50:56 +0200
commitf2be461f0906ed47306da58c31240014b6239d80 (patch)
tree6084c152dd56f691aa75c2e4580ffaf53b8257ba /odoo/__init__.py
parentf391b8c5a55bdc512d70cb8b3e61f23903abb5ed (diff)
parentf2d0995362ccdae88ba64597ea6f0feca3eab618 (diff)
[MERGE] forward port branch saas-12.1 up to f2d0995362c
Diffstat (limited to 'odoo/__init__.py')
-rw-r--r--odoo/__init__.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/odoo/__init__.py b/odoo/__init__.py
index 6bfe00b8499..aa27b79ae03 100644
--- a/odoo/__init__.py
+++ b/odoo/__init__.py
@@ -62,6 +62,23 @@ import time
if hasattr(time, 'tzset'):
time.tzset()
+# ----------------------------------------------------------
+# module babel hack
+# make sure unicode [world] territory is "001"
+# whereas "unitag" notation is "AA"
+# http://www.unicode.org/reports/tr35/#unicode_region_subtag
+# http://www.unicode.org/reports/tr35/#unicode_region_subtag_validity
+# BCP47: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
+# ----------------------------------------------------------
+import babel
+_babelCoreParseLocale = babel.core.parse_locale
+def _babelCoreParseLocale_unitag(identifier, sep='_'):
+ lang, territory, script, variant = _babelCoreParseLocale(identifier, sep)
+ territory = '001' if territory == 'AA' else territory
+ return lang, territory, script, variant
+
+babel.core.parse_locale = _babelCoreParseLocale_unitag
+
#----------------------------------------------------------
# Shortcuts
#----------------------------------------------------------