Skip to content

ashishb/android-auto-translate

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

android-auto-translate

Lint YAML Lint Markdown Lint Dockerfiles Lint Python Code

Test Python Code

Build Docker image

This GitHub Action auto-translates Android's strings.xml and fills in the missing translations in all other languages.

It also deletes any translations that is no longer defined in default strings.xml.

To use this for a new language, say "es", first create "values-es/strings.xml" file with the following placeholder content

<resources>
</resources>

and save the following to .github/workflows/translate-android.yaml in the repository.

---
name: Automatically Translate Android App

on:  # yamllint disable-line rule:truthy
  push:
    branches: ["master", "main"]
    paths:
      - "**/strings.xml"

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

jobs:

  # Run locally with "act -j translateAndroid"
  translateAndroid:

    runs-on: ubuntu-latest
    timeout-minutes: 15

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

      - name: Translate strings.xml to supported languages
        uses: ashishb/android-auto-translate@master

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4
        with:
          committer: "ashishb's Translation Bot <[email protected]>"
          title: "[Bot]Auto-generated translations for non-English languages"
          body: "Auto-generated translations by [Android Auto Translate](https://github.com/ashishb/android-auto-translate) bot"

How to run this locally

$ git clone https://github.com/ashishb/android-auto-translate
...
$ cd android-auto-translate
...
# Do note that this will modify strings.xml files in the specified
# Android dir, so, don't forget to back them up first
$ GITHUB_WORKSPACE=<path-to-android-base-dir> poetry run ./src/translations.py

Used by

  1. MusicSync
  2. ChatPaths
  3. eFurry