diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2023-10-25 13:15:58 +0100 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2023-10-25 13:20:07 +0100 |
commit | 64879f4c03b9d933898c0bb83d9b7e9c20729e51 (patch) | |
tree | ffb2720cba0a297dd74fde52d0a411b802f9d34a /test/lint | |
parent | afa081a39bde77d3959aa35b6e6c75a2fe988d68 (diff) | |
parent | 856325fac17465d102da621f1282b6d8ed02f679 (diff) | |
download | bitcoin-64879f4c03b9d933898c0bb83d9b7e9c20729e51.tar.xz |
Merge bitcoin-core/gui#771: Avoid error-prone leading whitespace in translatable strings
856325fac17465d102da621f1282b6d8ed02f679 lint: Add `lint-qt-translation.py` (Hennadii Stepanov)
294a018bf5106b03af39a2a8cfa4d5f2ebf6912b qt: Avoid error prone leading spaces in translatable strings (Hennadii Stepanov)
d8298e7f069f961fc077ceacff2c332d58734688 qt, refactor: Drop superfluous type conversions (Hennadii Stepanov)
Pull request description:
While working on the GUI translation via Transifex web interface, I found it error-prone to have leading whitespace in translatable strings. This is because it is very easy to unintentionally drop them in translations unnoticed.
Fixed all current cases. Added a linter to prevent similar cases in the future.
ACKs for top commit:
furszy:
utACK 856325f
Tree-SHA512: b1ca5effb2db6649e1e99382de79acf3a9f81cc9dad434db5623338489e597897e8addd60c1ab3dcc7506ae62753a7a4ad5a41d7a865f8fcdf94348b54baa7e7
Diffstat (limited to 'test/lint')
-rwxr-xr-x | test/lint/lint-qt-translation.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lint/lint-qt-translation.py b/test/lint/lint-qt-translation.py new file mode 100755 index 0000000000..47bf96b654 --- /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() |