https://github.com/liri-infra/translation-action
:heavy_plus_sign: GitHub action to update translations
https://github.com/liri-infra/translation-action
action github github-actions lupdate qt transifex
Last synced: about 2 months ago
JSON representation
:heavy_plus_sign: GitHub action to update translations
- Host: GitHub
- URL: https://github.com/liri-infra/translation-action
- Owner: liri-infra
- License: gpl-3.0
- Created: 2020-04-10T19:54:57.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-30T07:00:10.000Z (over 2 years ago)
- Last Synced: 2023-12-01T06:38:24.922Z (over 2 years ago)
- Topics: action, github, github-actions, lupdate, qt, transifex
- Language: Python
- Homepage:
- Size: 63.5 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.GPLv3
Awesome Lists containing this project
README
# translation-action
[](https://www.gnu.org/licenses/gpl-3.0.html)
This action does the following tasks:
1. Regenerate translation source files
2. Push source files to Transifex in order to rebase the translations
3. Pull rebased translations from Transifex
4. 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`: contains `ts`, `desktop` or `metainfo`
* `directory`: sources directory, only for `ts`
* `source_file`: template file, only for `desktop` and `metainfo`
* `file_filter`: filter of the source files, only for `desktop` and `metainfo`
* `output_path`: output file location
Here's an example of `.tx/sources.json` from [Liri Text](https://github.com/lirios/text/blob/develop/.tx/sources.json):
```json
[
{
"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/.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/.po",
"output_path": "translations/data/metainfo/metainfo.pot"
}
]
```
## Usage
This action is usually called in a `schedule` workflow like this:
```yaml
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.