A GitHub Action to find the missing and potentially outdated translations for existing locales in an Android Project.
This action is the same as running the following but with a few exceptions
- Reports can be generated in JSON. Lint tool generates XML or HTML
- Seamless integration with GitHub actions to ease the use of generated data
- It's not easy to run the standalone lint tool on a Gradle project
- It checks Git blame to find outdated translations
${ANDROID_HOME}/tools/bin/lint --check MissingTranslation ${PROJECT_DIR}
- Almost zero config
- Find outdated translations
- Generate reports in Markdown or JSON format
- Usable in other CI environments
The following workflow covers one possible use-case for this action. It uses the action to find the missing translations and generate a report in Markdown format. In the next step, it creates a comment on issue #1 with the generated report as its body.
on: [push]
jobs:
check-translations:
name: Check Translations
# Linux is required since this is a docker container action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: check_translations
uses: ashutoshgngwr/android-translations@v1
with:
projectDir: ./
- name: Add comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: 1
body: ${{ steps.check_translations.outputs.report }}
The action can accept the following input parameters
Key | Description | Default Value |
---|---|---|
projectDir |
Android Project's root directory | . |
outdatedLocales |
If true, also find potentially outdated translations | true |
outputFormat |
Must be one of json or markdown |
markdown |
markdownTitle |
Title for the Markdown content (not used with JSON) | Missing Translations |
The action produces the following output which can be used in the next steps
or jobs. See steps
context
and needs
context.
In addition to this, the action also prints the same output to stdout
.
Key | Description |
---|---|
report |
The missing translations report for strings in the requested format. |
The following structure is used while generating JSON reports.
[
{
"name": "example_1",
"value": "Example 1",
"missing_locales": [
"ru",
"pt-rBR"
],
"outdated_locales": [
"cs",
"de"
]
},
{
"name": "example_2",
"value": "Example 2",
"missing_locales": [
"sv",
"de"
],
"outdated_locales": []
},
{
"name": "example_2",
"value": "Example 3",
"missing_locales": [],
"outdated_locales": [
"pt-rBR",
"ru"
]
}
]
Caution: The action is designed to run on projects that are part of a Git repository.
docker run --rm --workdir /app --mount type=bind,source="$(pwd)",target=/app \
ashutoshgngwr/android-translations:v1 --output-format=json