diff --git a/.github/workflows/validate-english-strings.yml b/.github/workflows/validate-english-strings.yml new file mode 100644 index 000000000..43935b05e --- /dev/null +++ b/.github/workflows/validate-english-strings.yml @@ -0,0 +1,32 @@ +name: Validate English strings.xml + +on: + pull_request: { } + push: + branches: [ main, develop ] + +jobs: + translation_strings: + name: Validate strings.xml + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Python + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install translations requirements + run: make translation_requirements + + - name: Validate English plurals in strings.xml + run: make validate_english_plurals + + - name: Test extract strings + run: | + make extract_translations + # Ensure the file is extracted + test -f i18n/src/main/res/values/strings.xml diff --git a/Makefile b/Makefile index e7ff3745b..a0ba67b45 100644 --- a/Makefile +++ b/Makefile @@ -10,3 +10,16 @@ pull_translations: clean_translations_temp_directory extract_translations: clean_translations_temp_directory python3 i18n_scripts/translation.py --combine + +validate_english_plurals: + @if git grep 'quantity' -- '**/res/values/strings.xml' | grep -E 'quantity=.(zero|two|few|many)'; then \ + echo ""; \ + echo ""; \ + echo "Error: Found invalid plurals in the files listed above."; \ + echo " Please only use 'one' and 'other' in English strings.xml files,"; \ + echo " otherwise Transifex fails to parse them."; \ + echo ""; \ + exit 1; \ + else \ + echo "strings.xml files are valid."; \ + fi diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 580d262ac..931d2c6da 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -100,19 +100,11 @@ Due Tomorrow Due Yesterday - Due %1$d days ago Due %1$d day ago - Due %1$d days ago - Due %1$d days ago - Due %1$d days ago Due %1$d days ago - Due in %1$d days Due in %1$d day - Due in %1$d days - Due in %1$d days - Due in %1$d days Due in %1$d days diff --git a/course/src/main/res/values/strings.xml b/course/src/main/res/values/strings.xml index 2fcb1d950..51ac39e95 100644 --- a/course/src/main/res/values/strings.xml +++ b/course/src/main/res/values/strings.xml @@ -65,11 +65,7 @@ %1$s - %2$s - %3$d / %4$d - %1$s of %2$s assignments complete %1$s of %2$s assignment complete - %1$s of %2$s assignments complete - %1$s of %2$s assignments complete - %1$s of %2$s assignments complete %1$s of %2$s assignments complete diff --git a/dashboard/src/main/res/values/strings.xml b/dashboard/src/main/res/values/strings.xml index f83c35a2f..80c05bc42 100644 --- a/dashboard/src/main/res/values/strings.xml +++ b/dashboard/src/main/res/values/strings.xml @@ -21,11 +21,7 @@ No %1$s Courses - %1$d Past Due Assignments %1$d Past Due Assignment - %1$d Past Due Assignments - %1$d Past Due Assignments - %1$d Past Due Assignments %1$d Past Due Assignments