diff --git a/changelogs/fragments/language.yml b/changelogs/fragments/language.yml new file mode 100644 index 00000000000..8e9569f491a --- /dev/null +++ b/changelogs/fragments/language.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - Set LANGUAGE environment variable is set to a non-English locale (https://github.com/ansible/ansible/issues/83608). diff --git a/lib/ansible/modules/apt.py b/lib/ansible/modules/apt.py index 423ff2c57d4..fa22d905351 100644 --- a/lib/ansible/modules/apt.py +++ b/lib/ansible/modules/apt.py @@ -1252,6 +1252,7 @@ def main(): LC_ALL=locale, LC_MESSAGES=locale, LC_CTYPE=locale, + LANGUAGE=locale, ) module.run_command_environ_update = APT_ENV_VARS diff --git a/lib/ansible/modules/apt_key.py b/lib/ansible/modules/apt_key.py index 1ea4a6a02c4..ec86e829baa 100644 --- a/lib/ansible/modules/apt_key.py +++ b/lib/ansible/modules/apt_key.py @@ -188,7 +188,7 @@ def lang_env(module): if not hasattr(lang_env, 'result'): locale = get_best_parsable_locale(module) - lang_env.result = dict(LANG=locale, LC_ALL=locale, LC_MESSAGES=locale) + lang_env.result = dict(LANG=locale, LC_ALL=locale, LC_MESSAGES=locale, LANGUAGE=locale) return lang_env.result diff --git a/lib/ansible/modules/apt_repository.py b/lib/ansible/modules/apt_repository.py index 28d948a666d..3fb027c0c32 100644 --- a/lib/ansible/modules/apt_repository.py +++ b/lib/ansible/modules/apt_repository.py @@ -504,7 +504,7 @@ class UbuntuSourcesList(SourcesList): if self.apt_key_bin: locale = get_best_parsable_locale(self.module) - APT_ENV = dict(LANG=locale, LC_ALL=locale, LC_MESSAGES=locale, LC_CTYPE=locale) + APT_ENV = dict(LANG=locale, LC_ALL=locale, LC_MESSAGES=locale, LC_CTYPE=locale, LANGUAGE=locale) self.module.run_command_environ_update = APT_ENV rc, out, err = self.module.run_command([self.apt_key_bin, 'export', key_fingerprint], check_rc=True) found = bool(not err or 'nothing exported' not in err) diff --git a/lib/ansible/modules/dpkg_selections.py b/lib/ansible/modules/dpkg_selections.py index 6c66f6951f7..a1fa672732d 100644 --- a/lib/ansible/modules/dpkg_selections.py +++ b/lib/ansible/modules/dpkg_selections.py @@ -68,7 +68,7 @@ def main(): dpkg = module.get_bin_path('dpkg', True) locale = get_best_parsable_locale(module) - DPKG_ENV = dict(LANG=locale, LC_ALL=locale, LC_MESSAGES=locale, LC_CTYPE=locale) + DPKG_ENV = dict(LANG=locale, LC_ALL=locale, LC_MESSAGES=locale, LC_CTYPE=locale, LANGUAGE=locale) module.run_command_environ_update = DPKG_ENV name = module.params['name']