Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: validate po files on pull_request #564

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 '-----------------------------------------'