Skip to content

Commit

Permalink
Updating the main branch to the latest develop code (#2020)
Browse files Browse the repository at this point in the history
* Deleted all files in the main branch in anticipation of merging develop into main cleanly

* Merge develop into main

---------

Co-authored-by: Peter Harrison <[email protected]>
  • Loading branch information
palisadoes and palisadian authored Jun 2, 2024
1 parent bf9852d commit f661cc9
Show file tree
Hide file tree
Showing 133 changed files with 5,708 additions and 5,447 deletions.
2 changes: 1 addition & 1 deletion .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ reviews:
base_branches:
- develop
chat:
auto_reply: true
auto_reply: true
8 changes: 0 additions & 8 deletions .dockerignore

This file was deleted.

56 changes: 36 additions & 20 deletions .github/workflows/compare_translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,15 @@ def load_translation(filepath):
Returns:
translation: Loaded translation
"""
with open(filepath, "r", encoding="utf-8") as file:
translation = json.load(file)
return translation
try:
with open(filepath, "r", encoding="utf-8") as file:
content = file.read()
if not content.strip():
raise ValueError(f"File {filepath} is empty.")
translation = json.loads(content)
return translation
except json.JSONDecodeError as e:
raise ValueError(f"Error decoding JSON from file {filepath}: {e}")


def check_translations(directory):
Expand All @@ -112,26 +118,36 @@ def check_translations(directory):
Returns:
None
"""
default_file = "en.json"
default_translation = load_translation(os.path.join(directory, default_file))
translations = os.listdir(directory)
translations.remove(default_file) # Exclude default translation
default_language_dir = os.path.join(directory, "en")
default_files = ["common.json", "errors.json", "translation.json"]
default_translations = {}
for file in default_files:
file_path = os.path.join(default_language_dir, file)
default_translations[file] = load_translation(file_path)

languages = os.listdir(directory)
languages.remove("en") # Exclude default language directory


error_found = False

for translation_file in translations:
other_file = os.path.join(directory, translation_file)
other_translation = load_translation(other_file)
for language in languages:
language_dir = os.path.join(directory, language)
for file in default_files:
default_translation = default_translations[file]
other_file_path = os.path.join(language_dir, file)
other_translation = load_translation(other_file_path)

# Compare translations and get detailed error messages
errors = compare_translations(
default_translation, other_translation, f"en/{file}", f"{language}/{file}"
)
if errors:
error_found = True
print(f"File {language}/{file} has missing translations for:")
for error in errors:
print(f" - {error}")

# Compare translations and get detailed error messages
errors = compare_translations(
default_translation, other_translation, default_file, translation_file
)
if errors:
error_found = True
print(f"File {translation_file} has missing translations for:")
for error in errors:
print(f" - {error}")

if error_found:
sys.exit(1) # Exit with an error status code
Expand All @@ -154,7 +170,7 @@ def main():
"--directory",
type=str,
nargs="?",
default=os.path.join(os.getcwd(), "public/locales"),
default=os.path.join(os.getcwd(), "locales"),
help="Directory containing translation files(relative to the root directory).",
)
args = parser.parse_args()
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v40

- name: Check formatting
if: steps.changed-files.outputs.only_changed != 'true'
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:

- name: Get Changed Unauthorized files
id: changed-unauth-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v40
with:
files: |
.github/**
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v40

- name: Echo number of changed files
env:
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:

- name: Get changed TypeScript files
id: changed-files
uses: tj-actions/changed-files@v41
uses: tj-actions/changed-files@v40

- name: Run tests
if: steps.changed-files.outputs.only_changed != 'true'
Expand Down
Loading

0 comments on commit f661cc9

Please sign in to comment.