Python locale.locale_alias() Examples

The following are 3 code examples of locale.locale_alias(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module locale , or try the search function .
Example #1
Source File: location.py    From Flask-Validator with Mozilla Public License 2.0 5 votes vote down vote up
def __init__(self, field, allow_null=True, throw_exception=False, message=None):
        self.all_locates = locale.locale_alias

        Validator.__init__(self, field, allow_null, throw_exception, message) 
Example #2
Source File: makelocalealias.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def optimize(data):
    locale_alias = locale.locale_alias
    locale.locale_alias = data.copy()
    for k, v in data.items():
        del locale.locale_alias[k]
        if locale.normalize(k) != v:
            locale.locale_alias[k] = v
    newdata = locale.locale_alias
    errors = check(data)
    locale.locale_alias = locale_alias
    if errors:
        sys.exit(1)
    return newdata 
Example #3
Source File: makelocalealias.py    From android_universal with MIT License 5 votes vote down vote up
def optimize(data):
    locale_alias = locale.locale_alias
    locale.locale_alias = data.copy()
    for k, v in data.items():
        del locale.locale_alias[k]
        if locale.normalize(k) != v:
            locale.locale_alias[k] = v
    newdata = locale.locale_alias
    errors = check(data)
    locale.locale_alias = locale_alias
    if errors:
        sys.exit(1)
    return newdata