diff --git a/.github/scripts/check_language_properties.py b/.github/scripts/check_language_properties.py index 11d8636d..0496d351 100644 --- a/.github/scripts/check_language_properties.py +++ b/.github/scripts/check_language_properties.py @@ -11,6 +11,8 @@ adjusting the format. Usage: python check_language_properties.py --reference-file --branch [--actor ] [--files ] """ +# Sample for Windows: +# python .github/scripts/check_language_properties.py --reference-file src\main\resources\messages_en_GB.properties --branch "" --files src\main\resources\messages_de_DE.properties src\main\resources\messages_uk_UA.properties import copy import glob @@ -164,8 +166,14 @@ def check_for_differences(reference_file, file_list, branch, actor): basename_current_file = os.path.basename(os.path.join(branch, file_path)) if ( basename_current_file == basename_reference_file - or not file_path.startswith( - os.path.join("src", "main", "resources", "messages_") + or ( + # only local windows command + not file_path.startswith( + os.path.join("", "src", "main", "resources", "messages_") + ) + and not file_path.startswith( + os.path.join(os.getcwd(), "src", "main", "resources", "messages_") + ) ) or not file_path.endswith(".properties") or not basename_current_file.startswith("messages_") @@ -275,6 +283,12 @@ if __name__ == "__main__": required=True, help="Branch name.", ) + parser.add_argument( + "--check-file", + type=str, + required=False, + help="List of changed files, separated by spaces.", + ) parser.add_argument( "--files", nargs="+", @@ -293,11 +307,14 @@ if __name__ == "__main__": file_list = args.files if file_list is None: - file_list = glob.glob( - os.path.join( - os.getcwd(), "src", "main", "resources", "messages_*.properties" + if args.check_file: + file_list = [args.check_file] + else: + file_list = glob.glob( + os.path.join( + os.getcwd(), "src", "main", "resources", "messages_*.properties" + ) ) - ) update_missing_keys(args.reference_file, file_list) else: check_for_differences(args.reference_file, file_list, args.branch, args.actor) diff --git a/.github/workflows/update-translations.yml b/.github/workflows/update-translations.yml index 2320cd50..ff271e43 100644 --- a/.github/workflows/update-translations.yml +++ b/.github/workflows/update-translations.yml @@ -1,6 +1,7 @@ name: Update Translations on: + workflow_dispatch: push: branches: ["main"] paths: diff --git a/HowToAddNewLanguage.md b/HowToAddNewLanguage.md index 7ab6f53a..50cb067e 100644 --- a/HowToAddNewLanguage.md +++ b/HowToAddNewLanguage.md @@ -60,3 +60,13 @@ ignore = [ - After adding the new tags to `messages_en_GB.properties`, add and translate them in the respective language file (e.g., `messages_pl_PL.properties`). Make sure to place the entry under the correct language section. This helps maintain the accuracy of translation progress statistics and ensures that the translation tool or scripts do not misinterpret the completion rate. + +### Use this code to perform a local check + +#### Windows command + +```ps +python .github/scripts/check_language_properties.py --reference-file src\main\resources\messages_en_GB.properties --branch "" --files src\main\resources\messages_pl_PL.properties + +python .github/scripts/check_language_properties.py --reference-file src\main\resources\messages_en_GB.properties --branch "" --check-file src\main\resources\messages_pl_PL.properties +```