diff options
| author | Lucas Perais (lpe) <lpe@odoo.com> | 2019-04-02 14:15:56 +0000 |
|---|---|---|
| committer | Lucas Perais (lpe) <lpe@odoo.com> | 2019-04-03 14:03:00 +0000 |
| commit | 0e85b5b1321c13bc4ac88ba5b4f02846a7a1bfe9 (patch) | |
| tree | 786971bbe5e5284e9f6e5d50049cb8c2d7086b66 /odoo/__init__.py | |
| parent | 251021796c25676f5c341e0a3fc3ba4c9feb85bb (diff) | |
[FIX] odoo: patch babel for "World" language territory
Following c844d6609160f43fb36d961c9fa797bc1e16f57e
where generic Arabic (World) is coded ar_AA
but babel doesn't support this
Instead, babel understands xx_001 for World generic languages
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
OPW 1961396
closes odoo/odoo#32344
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Diffstat (limited to 'odoo/__init__.py')
| -rw-r--r-- | odoo/__init__.py | 17 |
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 #---------------------------------------------------------- |
