updateTranslatableText.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # -*- coding: utf-8 -*-
  2. #
  3. # Copyright (c) Contributors to the Open 3D Engine Project.
  4. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. #
  6. # SPDX-License-Identifier: Apache-2.0 OR MIT
  7. #
  8. #
  9. import os
  10. os.chdir('qml')
  11. startDir = os.getcwd()
  12. # since it's a .exe file it will only work on windows, but we may as well
  13. # construct the path in a platform-independent way.
  14. lupdateCmd = os.path.join(startDir, '..', '..', '..',
  15. 'Code', 'SDKs', 'Qt', 'x64', 'bin', 'lupdate.exe')
  16. lupdateCmd += ' -source-language en_GB '
  17. print(startDir)
  18. # Korean, Japanese and Simplified Chinese
  19. targetLanguages = ['ko', 'ja', 'zh_CN']
  20. for lang in targetLanguages:
  21. os.chdir(startDir)
  22. tgtLang = ' -target-language ' + lang
  23. tsName = ' -ts this_' + lang + '.ts'
  24. os.system(lupdateCmd + '-no-recursive .' + tgtLang + tsName)
  25. for folder in os.listdir():
  26. print(folder)
  27. folderPath = os.path.join(startDir, folder)
  28. if not os.path.isdir(folderPath):
  29. continue
  30. filenameBase = os.path.join(folderPath, "..", folder + '_')
  31. tsSwitches = ' -ts ' + filenameBase + lang + '.ts'
  32. os.system(lupdateCmd + '-recursive . ' + tsSwitches)
  33. print(('Finished processing: ' + lang + ': ' + folderPath))