This action does the following tasks:
- Regenerate translation source files
- Push source files to Transifex in order to rebase the translations
- Pull rebased translations from Transifex
- Commit and push to git
Your project must have a sources.json file, usually located under the .tx directory.
This file contains a list of objects with the following keys:
type: containsts,desktopormetainfodirectory: sources directory, only fortssource_file: template file, only fordesktopandmetainfofile_filter: filter of the source files, only fordesktopandmetainfooutput_path: output file location
Here's an example of .tx/sources.json from Liri Text:
[
{
"type": "ts",
"directory": "src",
"output_path": "translations/app/liri-text.ts"
},
{
"type": "desktop",
"source_file": "data/io.liri.Text.desktop.in",
"dest_file": "data/io.liri.Text.desktop",
"file_filter": "translations/data/desktop/<lang>.po",
"output_path": "translations/data/desktop/desktop.pot"
},
{
"type": "metainfo",
"source_file": "data/io.liri.Text.appdata.xml.in",
"dest_file": "data/io.liri.Text.appdata.xml",
"file_filter": "translations/data/metainfo/<lang>.po",
"output_path": "translations/data/metainfo/metainfo.pot"
}
]This action is usually called in a schedule workflow like this:
name: Translations Sync
on:
schedule:
- cron: '0 15 * * 0'
jobs:
update-translations:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update translations
uses: liri-infra/translation-action@master
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
with:
ssh_key: ${{ secrets.CI_SSH_KEY }}The example checks out the project, configures git to push with a ssh key,
then update .ts files, push them to Transifex and pull back the
translations refreshed with the new sources.