From 5491ff7c6a9961decd86db82579149603ee12e5f Mon Sep 17 00:00:00 2001
From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com>
Date: Thu, 28 Nov 2024 20:06:51 +0100
Subject: [PATCH] [PR #9187/f828bdee backport][stable-10] flatpak: force locale
 language to be C (#9207)

flatpak: force locale language to be C (#9187)

* flatpak: force locale langauge to be C

* add changelog frag

(cherry picked from commit f828bdee2287d603158407bd7ea3f843240dfefa)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
---
 changelogs/fragments/9187-flatpak-lang.yml | 2 ++
 plugins/modules/flatpak.py                 | 2 ++
 2 files changed, 4 insertions(+)
 create mode 100644 changelogs/fragments/9187-flatpak-lang.yml

diff --git a/changelogs/fragments/9187-flatpak-lang.yml b/changelogs/fragments/9187-flatpak-lang.yml
new file mode 100644
index 0000000000..159923cbdc
--- /dev/null
+++ b/changelogs/fragments/9187-flatpak-lang.yml
@@ -0,0 +1,2 @@
+bugfixes:
+  - flatpak - force the locale language to ``C`` when running the flatpak command (https://github.com/ansible-collections/community.general/pull/9187, https://github.com/ansible-collections/community.general/issues/8883).
diff --git a/plugins/modules/flatpak.py b/plugins/modules/flatpak.py
index 09e49e5575..84e4ea8374 100644
--- a/plugins/modules/flatpak.py
+++ b/plugins/modules/flatpak.py
@@ -419,6 +419,8 @@ def main():
     if not binary:
         module.fail_json(msg="Executable '%s' was not found on the system." % executable, **result)
 
+    module.run_command_environ_update = dict(LANGUAGE='C', LC_ALL='C')
+
     installed, not_installed = flatpak_exists(module, binary, name, method)
     if state == 'absent' and installed:
         uninstall_flat(module, binary, installed, method)