From 6c1e085937a977663f76cbbfb826c36b7c68cb27 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Thu, 19 Feb 2026 16:25:22 +0000 Subject: [PATCH] contrib/locale/push_locale: do not sort source-strings xgettext and related tools have a -s/--sort-output option, which results in the output being lexicographically sorted. The gettext maintainers recommend against using this option and even started deprecating it in some of their tools (xgettext included): - with -s, source strings are lexicographically sorted in the .pot/.po files - without -s, source string are output in the same order they are found in the code - this way, translators have to do much fewer context switches when contributing translations note that the qml part we have already *not* been sorting --- contrib/locale/push_locale.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/locale/push_locale.py b/contrib/locale/push_locale.py index b54c3a06f..aeb038f44 100755 --- a/contrib/locale/push_locale.py +++ b/contrib/locale/push_locale.py @@ -60,7 +60,8 @@ print("Found {} .py files to translate".format(len(files_list))) # Generate fresh translation template print('Generating template...') -cmd = ["xgettext", "-s", "--from-code", "UTF-8", "--language", "Python", "--no-wrap", "-f", f"{build_dir}/app.fil", f"--output={build_dir}/messages_gettext.pot"] +# note: do not use xgettext option "--sort-output", as that makes human translators have to context-switch all the time +cmd = ["xgettext", "--from-code", "UTF-8", "--language", "Python", "--no-wrap", "-f", f"{build_dir}/app.fil", f"--output={build_dir}/messages_gettext.pot"] subprocess.check_output(cmd) # add QML translations