Check for Crowdin Updates #45
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
name: Check for Crowdin Updates | |
on: | |
schedule: | |
- cron: '0 0 * * 1' # Every Monday at 12:00 AM UTC, which is 10:00 AM Melbourne time (AEST) | |
workflow_dispatch: | |
jobs: | |
fetch_convert_and_diff_translations: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo Content | |
uses: actions/checkout@v4 | |
with: | |
path: 'scripts' | |
# don't provide a branch (ref) so it uses the default for that event | |
- name: Checkout Android | |
uses: actions/checkout@v4 | |
with: | |
repository: 'oxen-io/session-android' | |
path: 'android' | |
ref: 'dev' | |
- name: Checkout Desktop | |
uses: actions/checkout@v4 | |
with: | |
repository: 'oxen-io/session-desktop' | |
path: 'desktop' | |
ref: 'standardised_strings_qa_2' | |
- name: Checkout iOS | |
uses: actions/checkout@v4 | |
with: | |
repository: 'oxen-io/session-ios' | |
path: 'ios' | |
ref: 'dev' | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
cache: 'pip' # caching pip dependencies | |
- name: Install Dependencies | |
run: | | |
pip install -r ${{ github.workspace }}/scripts/crowdin/requirements.txt | |
- name: Download Translations | |
env: | |
CROWDIN_API_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }} | |
run: | | |
python "${{ github.workspace }}/scripts/crowdin/download_translations_from_crowdin.py" \ | |
"$CROWDIN_API_TOKEN" \ | |
618696 \ | |
"${{ github.workspace }}/raw_translations" \ | |
--glossary_id 407522 \ | |
--concept_id 36 \ | |
--skip-untranslated-strings | |
- name: Prepare Android Strings | |
run: | | |
python "${{ github.workspace }}/scripts/crowdin/generate_android_strings.py" \ | |
"${{ github.workspace }}/raw_translations" \ | |
"${{ github.workspace }}/android/app/src/main/res" \ | |
"${{ github.workspace }}/android/session-android/libsession/src/main/java/org/session/libsession/utilities/NonTranslatableStringConstants.kt" | |
- name: Prepare Desktop Strings | |
run: | | |
rm -rf ${{ github.workspace }}/desktop/_locales/* | |
python "${{ github.workspace }}/scripts/crowdin/generate_desktop_strings.py" \ | |
"${{ github.workspace }}/raw_translations" \ | |
"${{ github.workspace }}/desktop/_locales" \ | |
"${{ github.workspace }}/desktop/ts/localization/constants.ts" | |
- name: Prepare QA strings | |
run: | | |
cd ${{ github.workspace }}/desktop/ | |
python ./tools/localization/generateLocales.py --generate-types --print-problems --print-problem-strings | |
cd - | |
- name: Prepare iOS Strings | |
run: | | |
python "${{ github.workspace }}/scripts/crowdin/generate_ios_strings.py" \ | |
"${{ github.workspace }}/raw_translations" \ | |
"${{ github.workspace }}/ios/Session/Meta" \ | |
"${{ github.workspace }}/ios/SessionUtilitiesKit/General/Constants.swift" | |
- name: Upload Android artefacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: session-android-artefact | |
path: | | |
${{ github.workspace }}/android/app/src/main/res/values*/strings.xml | |
${{ github.workspace }}/android/session-android/libsession/src/main/java/org/session/libsession/utilities/NonTranslatableStringConstants.kt | |
overwrite: true | |
if-no-files-found: warn | |
retention-days: 7 | |
- name: Upload Desktop artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: session-desktop-artifact | |
path: | | |
${{ github.workspace }}/desktop/_locales | |
${{ github.workspace }}/desktop/ts/localization/constants.ts | |
overwrite: true | |
if-no-files-found: warn | |
retention-days: 7 | |
- name: Upload iOS artefacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: session-ios-artifact | |
path: | | |
${{ github.workspace }}/ios/Session/Meta/Localizable.xcstrings | |
${{ github.workspace }}/ios/SessionUtilitiesKit/General/Constants.swift | |
overwrite: true | |
if-no-files-found: warn | |
retention-days: 7 | |
- name: Upload QA artefacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: session-qa-artifact | |
path: | | |
${{ github.workspace }}/desktop/ts/localization/locales.ts | |
${{ github.workspace }}/desktop/ts/localization/constants.ts | |
overwrite: true | |
if-no-files-found: warn | |
retention-days: 7 | |
# Not sure why yet, but uploading artefacts after creating the pull requests | |
# seems to only include a part of what should be in. | |
# As a dirty fix we upload the artefacts first, and then make the pull request | |
- name: Create Android Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
path: 'android' | |
token: ${{ secrets.CROWDIN_PR_TOKEN }} | |
title: "[Automated] Update translations from Crowdin" | |
body: | | |
[Automated] | |
This PR includes the latest translations from Crowdin | |
Session uses the community-driven translation platform Crowdin for localization, anyone can contribute at https://getsession.org/translate | |
branch: feature/update-crowdin-translations | |
commit-message: "[Automated] Update translations from Crowdin" | |
delete-branch: true | |
- name: Create Desktop Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
path: 'desktop' | |
token: ${{ secrets.CROWDIN_PR_TOKEN }} | |
title: "[Automated] Update translations from Crowdin" | |
body: | | |
[Automated] | |
This PR includes the latest translations from Crowdin | |
Session uses the community-driven translation platform Crowdin for localization, anyone can contribute at https://getsession.org/translate | |
branch: feature/update-crowdin-translations | |
commit-message: "[Automated] Update translations from Crowdin" | |
delete-branch: true | |
- name: Create iOS Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
path: 'ios' | |
token: ${{ secrets.CROWDIN_PR_TOKEN }} | |
title: "[Automated] Update translations from Crowdin" | |
body: | | |
[Automated] | |
This PR includes the latest translations from Crowdin | |
Session uses the community-driven translation platform Crowdin for localization, anyone can contribute at https://getsession.org/translate | |
branch: feature/update-crowdin-translations | |
commit-message: "[Automated] Update translations from Crowdin" | |
delete-branch: true |