mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 02:14:13 +00:00
workflows for po/mo generator (currently only manually)
This commit is contained in:
41
.github/workflows/compile-mo.yml
vendored
Normal file
41
.github/workflows/compile-mo.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Compile .mo files from changed .po files
|
||||
|
||||
on:
|
||||
# push:
|
||||
# paths:
|
||||
# - '**/*.po'
|
||||
# branches:
|
||||
# - 'gettext_test'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
compile_mo:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: HB9HIL/wavelog
|
||||
ref: gettext_test
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Set up gettext
|
||||
run: sudo apt-get install -y gettext
|
||||
|
||||
- name: Compile .mo files from changed .po files
|
||||
run: |
|
||||
for po in $(git diff --name-only HEAD~1 HEAD | grep '\.po$'); do
|
||||
mo="${po%.po}.mo";
|
||||
msgfmt --verbose -o "$mo" "$po";
|
||||
done
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config --global user.name "github-actions"
|
||||
git config --global user.email "github-actions@github.com"
|
||||
git add .
|
||||
git commit -m "Compiled .mo file"
|
||||
git push
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
47
.github/workflows/translation.yml
vendored
Normal file
47
.github/workflows/translation.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
name: Translation Workflow
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: HB9HIL/wavelog
|
||||
ref: gettext_test
|
||||
|
||||
- name: Set up gettext
|
||||
run: sudo apt-get install -y gettext
|
||||
|
||||
- name: Create POT file
|
||||
run: xgettext --no-wrap -o assets/lang_src/messages.pot --copyright-holder=Wavelog --from-code=UTF-8 --keyword=__ --keyword=_ngettext:1,2 --keyword=_pgettext:1c,2 -L PHP $(find . -name "*.php")
|
||||
|
||||
- name: Merge POT into PO files
|
||||
run: |
|
||||
for po in $(find . -name "*.po"); do
|
||||
msgmerge --no-wrap -UN --verbose "$po" assets/lang_src/messages.pot;
|
||||
done
|
||||
|
||||
- name: Delete backup .po~ files
|
||||
run: find . -name "*.po~" -delete
|
||||
|
||||
- name: Compile MO files from PO files
|
||||
run: |
|
||||
for po in $(find . -name "*.po"); do
|
||||
mo="${po%.po}.mo";
|
||||
msgfmt --verbose -o "$mo" "$po";
|
||||
done
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config --global user.name "github-actions"
|
||||
git config --global user.email "github-actions@github.com"
|
||||
git add .
|
||||
git commit -m "Update translations"
|
||||
git push
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user