Skip to content

Commit

Permalink
feat: validate po files on pull_request
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarIthawi committed Aug 18, 2023
1 parent e5d771f commit 06acc58
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/validate-translation-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Validate the po files to ensure translation files are compilable.

name: Validate translation PO files

on:
- pull_request

jobs:
validate-po-files:
runs-on: ubuntu-latest
steps:
# Clones the openedx-translations repo
- name: clone openedx/openedx-translations
uses: actions/checkout@v3

- name: Install gettext
run: |
sudo apt install -y gettext
- name: Validate translation files
id: validate_translation_files
run: |
make validate_translation_files
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
__pycache__
.pytest_cache

# msgfmt sometimes leaves these behind in the root directory
/*.mo
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: piptools upgrade fix_transifex_resource_names transifex_resources_requirements
.PHONY: piptools upgrade fix_transifex_resource_names transifex_resources_requirements validate_translation_files

piptools:
pip install -q -r requirements/pip_tools.txt
Expand Down Expand Up @@ -29,3 +29,11 @@ test_requirements: ## Installs test.txt requirements

test: ## Run scripts tests
pytest -v -s scripts/tests

validate_translation_files: ## Run basic validation to ensure files are compilable
find translations/ -name '*.po' \
| grep -v '/en/LC_MESSAGES/' \
| xargs -I{} msgfmt -v --strict --check {}
@echo '-----------------------------------------'
@echo 'Congratulations! Translation files are valid.'
@echo '-----------------------------------------'

0 comments on commit 06acc58

Please sign in to comment.