Merge pull request #214 from zinrai/devel

Add EUC-JP locale name normalization
This commit is contained in:
Brian Coca 2015-01-22 16:01:47 -05:00
commit 21126a4af3

View file

@ -32,6 +32,11 @@ EXAMPLES = '''
- locale_gen: name=de_CH.UTF-8 state=present - locale_gen: name=de_CH.UTF-8 state=present
''' '''
LOCALE_NORMALIZATION = {
".utf8": ".UTF-8",
".eucjp": ".EUC-JP",
}
# =========================================== # ===========================================
# location module specific support methods. # location module specific support methods.
# #
@ -44,7 +49,9 @@ def is_present(name):
def fix_case(name): def fix_case(name):
"""locale -a might return the encoding in either lower or upper case. """locale -a might return the encoding in either lower or upper case.
Passing through this function makes them uniform for comparisons.""" Passing through this function makes them uniform for comparisons."""
return name.replace(".utf8", ".UTF-8") for s, r in LOCALE_NORMALIZATION.iteritems():
name = name.replace(s, r)
return name
def replace_line(existing_line, new_line): def replace_line(existing_line, new_line):
"""Replaces lines in /etc/locale.gen""" """Replaces lines in /etc/locale.gen"""