From 856325fac17465d102da621f1282b6d8ed02f679 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:07:02 +0100 Subject: [PATCH] lint: Add `lint-qt-translation.py` --- test/lint/lint-qt-translation.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 test/lint/lint-qt-translation.py diff --git a/test/lint/lint-qt-translation.py b/test/lint/lint-qt-translation.py new file mode 100755 index 00000000000..47bf96b654f --- /dev/null +++ b/test/lint/lint-qt-translation.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# +# Copyright (c) 2023-present The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or https://opensource.org/license/mit/. +# +# Check for leading whitespaces in the translatable strings. + +import subprocess +import sys + + +def main(): + tr_strings = subprocess.run(['git', 'grep', '-e', 'tr("[[:space:]]', '--', 'src/qt'], stdout=subprocess.PIPE, text=True).stdout + + if tr_strings.strip(): + print("Avoid leading whitespaces in:") + print(tr_strings) + sys.exit(1) + + +if __name__ == "__main__": + main()