Skip to content

Commit

Permalink
add translation test (#857)
Browse files Browse the repository at this point in the history
Adds a translation test github action, that creates a messages.pot using jambo extract-translations
and then checks that every .po file matches messages.pot.
This is the same logic that the SDK's translation test uses.
Also adds an Italian translation that was missing, so that tests pass.
Previously, the translation for `vertical-full-page-map-alternative-verticals/alternativeverticals.hbs:47` was used 
for `vertical-full-page-map-alternative-verticals/alternativeverticals.hbs:5` instead of the actual line 5 translation,
causing the translation for line 47 to be doubled and the translation for line 5 to be missing.

J=SLAP-1378
TEST=auto

checked that the test will run on master and release branches
  • Loading branch information
oshi97 committed Jun 29, 2021
1 parent 54fc9d4 commit 00034ef
Show file tree
Hide file tree
Showing 5 changed files with 633 additions and 12 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/translation-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Translation Test

on:
pull_request:
branches:
- master
- release/*

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [15.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- name: 'extract translations'
run: npx jambo extract-translations --globs '*/**/*{.hbs,.js}' '!**/node_modules' $IGNORED_FOLDERS --output $OUTPUT_FILE
env:
IGNORED_FOLDERS: '!{commands,hbshelpers,patches,postupgrade,static,tests,test-site,translations}/**'
OUTPUT_FILE: 'translations/messages.pot'
- run: sudo apt-get install -qq gettext
- run: |
cd translations
for po_file in *.po
do msgcmp $po_file messages.pot
done
Loading

0 comments on commit 00034ef

Please sign in to comment.