Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cherry pick action to update strings from crowdin #2151

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/localization-crowdin-updater.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "Crowdin Action"

# **What it does**: Upload strings to crowdin project for translations and creates a PR with updates.
# **Why we have it**: We want to externalize and automate the translations process.
# **Who does it impact**: Everyone collaborating on the project.
# For more info: https://github.com/crowdin/github-action/blob/master/action.yml

on:
push:
branches: [ develop ]

workflow_dispatch:
inputs:
baseBranch:
description: "Base branch to create the PR and update the localization strings"
required: true
default: "develop"
type: choice
options:
- "develop"
- "release/candidate"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest

env:
GITHUB_TOKEN: ${{ secrets.ANDROID_BOB_GH_TOKEN }}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: "Set base branch from input"
env:
INPUT_BASE_BRANCH: ${{github.event.inputs.baseBranch}}
if: "${{ github.event.inputs.baseBranch != '' }}"
run: echo "BASE_BRANCH=$INPUT_BASE_BRANCH" >> "$GITHUB_ENV"

- name: "Set base branch to default branch"
if: "${{ github.event.inputs.baseBranch == '' }}"
run: echo "BASE_BRANCH=develop" >> "$GITHUB_ENV"

- name: Crowdin action
uses: crowdin/github-action@v1
with:
project_id: ${{ secrets.CROWDIN_PROJECT_ID }}
token: ${{ secrets.CROWDIN_API_TOKEN }}

upload_sources: true
download_translations: true
upload_translations: false

create_pull_request: true
localization_branch_name: chore/sync-and-update-localization-${{env.BASE_BRANCH}}
commit_message: "chore: update localization strings via Crowdin"
pull_request_title: "chore: update localization strings via Crowdin"
pull_request_body: "This PR pulls in the latest localization translations from Crowdin."
github_user_name: "AndroidBob"
github_user_email: "[email protected]"

pull_request_labels: "l10n, crowdin"
pull_request_assignees: "AndroidBob"
pull_request_team_reviewers: "android"
pull_request_base_branch_name: ${{env.BASE_BRANCH}}

config: "crowdin.yml"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Wire™
[![codecov](https://codecov.io/gh/wireapp/wire-android-reloaded/branch/develop/graph/badge.svg?token=9ELBEPM793)](https://codecov.io/gh/wireapp/wire-android-reloaded)
[![Crowdin](https://badges.crowdin.net/wire-android-reloaded/localized.svg)](https://crowdin.com/project/wire-android-reloaded)

[![Wire logo](https://github.com/wireapp/wire/blob/master/assets/header-small.png?raw=true)](https://wire.com/jobs/)

Expand Down
19 changes: 12 additions & 7 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
pull_request_title: 'chore: update translation strings via Crowdin'
pull_request_labels:
- crowdin
- l10n
files:
- source: /app/src/main/res/values/strings.xml
translation: /app/src/main/res/values-%two_letters_code%/%original_file_name%
"project_id_env": "CROWDIN_PROJECT_ID"
"api_token_env": "CROWDIN_API_TOKEN"
"base_path": "."
"base_url": "https://api.crowdin.com"
"preserve_hierarchy": true

files: [
{
"source": "/app/src/main/res/values/strings.xml",
"translation": "/app/src/main/res/values-%two_letters_code%/%original_file_name%",
}
]
Loading