Skip to content

Commit 11d0bde

Browse files
committed
feat: initial Android strings.xml localization example
0 parents  commit 11d0bde

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed

.github/workflows/translate.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Translate
2+
on:
3+
push:
4+
branches: [main]
5+
permissions:
6+
contents: write
7+
jobs:
8+
translate:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Lingo.dev
13+
uses: lingodotdev/lingo.dev@main
14+
with:
15+
api-key: ${{ secrets.LINGODOTDEV_API_KEY }}

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Android App Localization Example
2+
3+
Demonstrates automated localization for Android `strings.xml` resource files using [Lingo.dev](https://lingo.dev) CLI and GitHub Actions.
4+
5+
> **Full walkthrough:** [lingo.dev/en/guides/android-app-localization](https://lingo.dev/en/guides/android-app-localization)
6+
7+
## What's inside
8+
9+
- `app/src/main/res/values/strings.xml` - source strings (English)
10+
- `i18n.json` - Lingo.dev CLI configuration
11+
- `.github/workflows/translate.yml` - GitHub Actions workflow
12+
13+
## Quick start
14+
15+
1. Fork this repo
16+
2. Add `LINGODOTDEV_API_KEY` to **Settings > Secrets and variables > Actions**
17+
3. Push a change to source strings in `strings.xml`
18+
4. Translations appear automatically via commit to main
19+
20+
## How it works
21+
22+
The Lingo.dev CLI reads the source `strings.xml`, identifies new or changed entries using a lockfile, translates the delta through a configured localization engine, and writes per-locale files into `values-[locale]/` directories. The GitHub Actions workflow runs this on every push to main.
23+
24+
## Locales
25+
26+
- **Source:** `en`
27+
- **Targets:** `es`, `fr`, `de`, `ja`
28+
29+
## Links
30+
31+
- [Guide: Android App Localization with strings.xml](https://lingo.dev/en/guides/android-app-localization)
32+
- [Lingo.dev CLI docs](https://lingo.dev/en/docs/cli)
33+
- [GitHub Actions integration](https://lingo.dev/en/docs/integrations/github)
34+
- [Create a free account](https://lingo.dev)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- App identity -->
4+
<string name="app_name">My App</string>
5+
6+
<!-- Main screen -->
7+
<string name="welcome_title">Welcome back!</string>
8+
<string name="search_placeholder">Search…</string>
9+
10+
<!-- Settings screen -->
11+
<string name="settings_title">Settings</string>
12+
<string name="logout_button">Log out</string>
13+
14+
<!-- Empty state -->
15+
<string name="empty_state_title">No items yet</string>
16+
<string name="empty_state_description">Tap the + button to create your first item.</string>
17+
18+
<!-- Alerts -->
19+
<string name="delete_confirmation">Are you sure you want to delete this item? This action cannot be undone.</string>
20+
21+
<!-- Plurals -->
22+
<plurals name="items_count">
23+
<item quantity="one">%d item</item>
24+
<item quantity="other">%d items</item>
25+
</plurals>
26+
27+
<!-- String array -->
28+
<string-array name="sort_options">
29+
<item>Newest first</item>
30+
<item>Oldest first</item>
31+
<item>Alphabetical</item>
32+
</string-array>
33+
</resources>

i18n.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://lingo.dev/schema/i18n.json",
3+
"version": "1.15",
4+
"locale": {
5+
"source": "en",
6+
"targets": ["es", "fr", "de", "ja"]
7+
},
8+
"buckets": {
9+
"android": {
10+
"include": ["app/src/main/res/values-[locale]/strings.xml"]
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)