Skip to content

Commit

Permalink
feat: restart work on json file generator
Browse files Browse the repository at this point in the history
  • Loading branch information
theycallhermax authored Dec 13, 2023
1 parent 9177d75 commit f32d10d
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/po2json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Update Translations

on:
push:
branches: "**"
pull_request:
types:
- opened

jobs:
update-translations:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install Dependencies
run: npm install -g po2json

- name: Update Translations
run: |
project_folder="[project folder name]"
language_code="[language code of the language you are translating to]"
# Find the .po file in the pushed changes
po_file=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep ".po")
# If a .po file is found, update translations
if [ -n "$po_file" ]; then
po2json \
$project_folder/$language_code.po \
$project_folder/$language_code.json \
-f jed \
-d $language_code \
--fallback-to-msgid
git add .
git commit -m "Update translations"
git push
else
echo "No .po file found in the pushed changes. Skipping translation update."
fi

0 comments on commit f32d10d

Please sign in to comment.