-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: restart work on json file generator
- Loading branch information
1 parent
9177d75
commit f32d10d
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |