lint-qt-translation.py raw

   1  #!/usr/bin/env python3
   2  #
   3  # Copyright (c) 2023-present The Bitcoin Core developers
   4  # Distributed under the MIT software license, see the accompanying
   5  # file COPYING or https://opensource.org/license/mit/.
   6  #
   7  # Check for leading whitespaces in the translatable strings.
   8  
   9  import subprocess
  10  import sys
  11  
  12  
  13  def main():
  14      tr_strings = subprocess.run(['git', 'grep', '-e', 'tr("[[:space:]]', '--', 'src/qt'], stdout=subprocess.PIPE, text=True).stdout
  15  
  16      if tr_strings.strip():
  17          print("Avoid leading whitespaces in:")
  18          print(tr_strings)
  19          sys.exit(1)
  20  
  21  
  22  if __name__ == "__main__":
  23      main()
  24