summaryrefslogtreecommitdiff
path: root/odoo/__init__.py
diff options
context:
space:
mode:
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
#----------------------------------------------------------