Skip to content

Commit

Permalink
transifex: update config (#234)
Browse files Browse the repository at this point in the history
ci: use i18n reusable workflows
  • Loading branch information
rekt-hard authored Jul 4, 2023
1 parent 42ed11d commit 2a23e77
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 115 deletions.
58 changes: 4 additions & 54 deletions .github/workflows/i18n-pull.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,14 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Graz University of Technology.
# Copyright (C) 2023 Graz University of Technology.
#
# Invenio-oaiserver is free software; you can redistribute it and/or modify
# Invenio is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.

name: i18n:pull translations
on: workflow_dispatch # manually trigger

jobs:
i18n-pull:
runs-on: ubuntu-20.04
env:
PYTHON-VERSION: 3.9
steps:
- name: Checkout
uses: actions/checkout@v2

# setup python
- name: Set up Python ${{ env.PYTHON-VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON-VERSION }}

# install dependencies
- name: Install dependencies
run: |
pip install -e ".[all]"
# install transifex client
- name: transifex-client
run: |
pip install transifex-client
# store token
- name: store token
run: |
touch ~/.transifexrc
echo [https://www.transifex.com] >> ~/.transifexrc
echo api_hostname=https://api.transifex.com >> ~/.transifexrc
echo hostname=https://www.transifex.com >> ~/.transifexrc
echo password=${{ secrets.TRANSIFEX_TOKEN }} >> ~/.transifexrc
echo username=api >> ~/.transifexrc
# pull all lang
- name: pull translations
run: |
tx pull -a -f
# remove transifex credential file
- name: remove transifexrc file
uses: JesseTG/rm@v1.0.2
with:
path: ~/.transifexrc

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: i18n:pulled translations
title: i18n:pulled translations
body: i18n:pulled translations
branch: 101-translations-pull # name of branch which PR is created from
delete-branch: true # delete branch once merged,closed
uses: inveniosoftware/invenio-i18n/.github/workflows/i18n-pull-base.yml@master
secrets: inherit
65 changes: 6 additions & 59 deletions .github/workflows/i18n-push.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,16 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Graz University of Technology.
# Copyright (C) 2023 Graz University of Technology.
#
# Invenio-oaiserver is free software; you can redistribute it and/or modify
# Invenio is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.

name: i18n:push translations
on: workflow_dispatch # manually trigger

jobs:
i18n-extract:
runs-on: ubuntu-20.04
env:
PYTHON-VERSION: 3.9
steps:
- name: Checkout
uses: actions/checkout@v2

# setup python
- name: Set up Python ${{ env.PYTHON-VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON-VERSION }}

# install dependencies
- name: Install dependencies
run: |
pip install -e ".[all]"
# install transifex client
- name: transifex-client
run: |
pip install transifex-client
# store token
- name: store token
run: |
touch ~/.transifexrc
echo [https://www.transifex.com] >> ~/.transifexrc
echo api_hostname=https://api.transifex.com >> ~/.transifexrc
echo hostname=https://www.transifex.com >> ~/.transifexrc
echo password=${{ secrets.TRANSIFEX_TOKEN }} >> ~/.transifexrc
echo username=api >> ~/.transifexrc
# extract
- name: extract_messages
run: |
python setup.py extract_messages
# push source
- name: push_messages
run: |
tx push -s
# remove transifex credential file
- name: remove transifexrc file
uses: JesseTG/rm@v1.0.2
with:
path: ~/.transifexrc

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
commit-message: i18n:push translations
title: i18n:push translations
body: i18n:push translations
branch: 101-translations-push # name of branch which PR is created from
delete-branch: true # delete branch once merged,closed
uses: inveniosoftware/invenio-i18n/.github/workflows/i18n-push-base.yml@master
with:
extract-backend: true
secrets: inherit
5 changes: 3 additions & 2 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
# Copyright (C) 2023 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand All @@ -23,9 +24,9 @@
# $ tx pull -a

[main]
host = https://www.transifex.com
host = https://app.transifex.com

[invenio.invenio-oaiserver-messages]
[o:inveniosoftware:p:invenio:r:invenio-oaiserver-messages]
file_filter = invenio_oaiserver/translations/<lang>/LC_MESSAGES/messages.po
source_file = invenio_oaiserver/translations/messages.pot
source_lang = en
Expand Down
1 change: 1 addition & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# This file is part of Invenio.
# Copyright (C) 2020 CERN.
# Copyright (C) 2023 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
Expand Down

0 comments on commit 2a23e77

Please sign in to comment.