android-localisation 1.0.0__tar.gz → 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {android_localisation-1.0.0/android_localisation.egg-info → android_localisation-1.0.1}/PKG-INFO +171 -169
- {android_localisation-1.0.0 → android_localisation-1.0.1}/README.md +2 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation/__init__.py +1 -1
- {android_localisation-1.0.0 → android_localisation-1.0.1/android_localisation.egg-info}/PKG-INFO +171 -169
- {android_localisation-1.0.0 → android_localisation-1.0.1}/pyproject.toml +1 -1
- {android_localisation-1.0.0 → android_localisation-1.0.1}/setup.cfg +4 -4
- {android_localisation-1.0.0 → android_localisation-1.0.1}/LICENSE +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/MANIFEST.in +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation/cli.py +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation/fix.py +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation/java/VerifyStrings.java +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation/translate.py +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation/verify.py +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation.egg-info/SOURCES.txt +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation.egg-info/dependency_links.txt +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation.egg-info/entry_points.txt +0 -0
- {android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation.egg-info/top_level.txt +0 -0
{android_localisation-1.0.0/android_localisation.egg-info → android_localisation-1.0.1}/PKG-INFO
RENAMED
|
@@ -1,169 +1,171 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: android-localisation
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: Zero-dependency Android strings.xml translation and verification using LLMs (Gemini, OpenAI, Anthropic, Ollama).
|
|
5
|
-
License: MIT
|
|
6
|
-
Project-URL: Homepage, https://github.com/BharathKmalviya/android-llm-localization
|
|
7
|
-
Project-URL: Repository, https://github.com/BharathKmalviya/android-llm-localization
|
|
8
|
-
Project-URL: Issues, https://github.com/BharathKmalviya/android-llm-localization/issues
|
|
9
|
-
Project-URL: Changelog, https://github.com/BharathKmalviya/android-llm-localization/blob/master/CHANGELOG.md
|
|
10
|
-
Keywords: android,localisation,localization,strings,translation,llm,gemini,openai,anthropic,ollama,i18n,l10n
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: Environment :: Console
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
-
Classifier: Topic :: Software Development :: Internationalization
|
|
23
|
-
Classifier: Topic :: Software Development :: Localization
|
|
24
|
-
Requires-Python: >=3.8
|
|
25
|
-
Description-Content-Type: text/markdown
|
|
26
|
-
License-File: LICENSE
|
|
27
|
-
Dynamic: license-file
|
|
28
|
-
|
|
29
|
-
# Android LLM Localization
|
|
30
|
-
|
|
31
|
-
[](https://pypi.org/project/android-localisation/)
|
|
32
|
-
[](https://pypi.org/project/android-localisation/)
|
|
33
|
-
[](https://github.com/BharathKmalviya/android-llm-localization/blob/master/LICENSE)
|
|
34
|
-
|
|
35
|
-
A zero-dependency Python tool to translate, fix, and verify Android `strings.xml` resources using Large Language Models (LLMs) — Gemini, OpenAI, Anthropic (Claude), or any local model via Ollama.
|
|
36
|
-
|
|
37
|
-
## Why this exists?
|
|
38
|
-
|
|
39
|
-
Localizing Android apps usually involves paying for services, exporting CSVs, or manually using Google Translate. This tool translates `strings.xml` directly in your project using modern LLMs, giving significantly better context-aware translations.
|
|
40
|
-
|
|
41
|
-
**Zero dependencies** — no `pip install` of extra libraries required. Uses only Python's built-in networking.
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## Installation
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
pip install android-localisation
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
To update to the latest version:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
pip install --upgrade android-localisation
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Quick Start
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
# 1. Translate (Gemini free tier recommended)
|
|
63
|
-
android-localise translate --api-key YOUR_GEMINI_API_KEY
|
|
64
|
-
|
|
65
|
-
# 2. Fix any XML escaping issues introduced by the LLM
|
|
66
|
-
android-localise fix
|
|
67
|
-
|
|
68
|
-
# 3. Verify no format specifiers were corrupted (requires Java JDK)
|
|
69
|
-
android-localise verify
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## The Three Commands
|
|
75
|
-
|
|
76
|
-
### 1. `translate` — Translate strings into all locale directories
|
|
77
|
-
|
|
78
|
-
Reads `app/src/main/res/values/strings.xml` (English) and writes translated `strings.xml` into every `values-*` directory it finds.
|
|
79
|
-
|
|
80
|
-
**Prerequisites:**
|
|
81
|
-
- Create empty `values-<lang>/` folders for each language you want (e.g. `values-hi/`, `values-es/`)
|
|
82
|
-
- Get an API key — **[Google Gemini AI Studio](https://aistudio.google.com/) has a generous free tier**
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Basic — Gemini (default)
|
|
86
|
-
android-localise translate --api-key YOUR_GEMINI_API_KEY
|
|
87
|
-
|
|
88
|
-
# With app context for better translations
|
|
89
|
-
android-localise translate --api-key YOUR_KEY --app-context "a fitness tracking app"
|
|
90
|
-
|
|
91
|
-
# OpenAI
|
|
92
|
-
android-localise translate --api-key YOUR_KEY --provider openai --model gpt-4o
|
|
93
|
-
|
|
94
|
-
# Anthropic (Claude)
|
|
95
|
-
android-localise translate --api-key YOUR_KEY --provider anthropic
|
|
96
|
-
|
|
97
|
-
# Local model via Ollama
|
|
98
|
-
android-localise translate --provider custom --base-url http://localhost:11434/v1/chat/completions --model llama3
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
**Full arguments:**
|
|
102
|
-
|
|
103
|
-
| Argument | Description | Default |
|
|
104
|
-
|---|---|---|
|
|
105
|
-
| `--api-key` | API key (or set `GEMINI_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY` env vars) | *None* |
|
|
106
|
-
| `--provider` | AI provider: `gemini`, `openai`, `anthropic`, `custom` | `gemini` |
|
|
107
|
-
| `--model` | Model name (e.g. `gemini-2.5-flash`, `gpt-4o`, `claude-3-5-sonnet-latest`) | provider default |
|
|
108
|
-
| `--app-context` | Short description of your app to improve translation quality | *None* |
|
|
109
|
-
| `--res-dir` | Path to the Android `res/` directory | `app/src/main/res` |
|
|
110
|
-
| `--base-url` | Base URL for custom OpenAI-compatible endpoints | *None* |
|
|
111
|
-
| `--sleep` | Seconds between requests to avoid rate limits | `5.0` |
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
### 2. `fix` — Fix XML escaping issues
|
|
116
|
-
|
|
117
|
-
LLMs occasionally introduce malformed characters — curly apostrophes (`'`), unescaped quotes, or broken `%` symbols. This command cleans them all up.
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
android-localise fix
|
|
121
|
-
# or with a custom res dir:
|
|
122
|
-
android-localise fix --res-dir path/to/res
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
### 3. `verify` — Catch format specifier crashes before they happen
|
|
128
|
-
|
|
129
|
-
LLMs can corrupt Android format specifiers like `%1$s` or `%d`, which causes `UnknownFormatConversionException` crashes at runtime. This command compiles a Java verifier and dry-runs `String.format()` against every translated string.
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
android-localise verify
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
*Requires `javac` in your system PATH. Run from Android Studio's terminal if needed.*
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Recommended Workflow
|
|
140
|
-
|
|
141
|
-
1. Update your English `strings.xml`
|
|
142
|
-
2. Create empty `values-<lang>/` folders for the languages you want
|
|
143
|
-
3. `android-localise translate --api-key YOUR_KEY`
|
|
144
|
-
4. `android-localise fix`
|
|
145
|
-
5. `android-localise verify`
|
|
146
|
-
6. Build and test your app
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Supported Providers
|
|
151
|
-
|
|
152
|
-
| Provider | Default Model | API Key Env Var |
|
|
153
|
-
|---|---|---|
|
|
154
|
-
| `gemini` (default) | `gemini-2.5-flash` | `GEMINI_API_KEY` |
|
|
155
|
-
| `openai` | `gpt-4o-mini` | `OPENAI_API_KEY` |
|
|
156
|
-
| `anthropic` | `claude-3-5-sonnet-latest` | `ANTHROPIC_API_KEY` |
|
|
157
|
-
| `custom` | *(must specify)* | `OPENAI_API_KEY` or none |
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## Contributing
|
|
164
|
-
|
|
165
|
-
Issues and PRs welcome at [github.com/BharathKmalviya/android-llm-localization](https://github.com/BharathKmalviya/android-llm-localization).
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: android-localisation
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Zero-dependency Android strings.xml translation and verification using LLMs (Gemini, OpenAI, Anthropic, Ollama).
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/BharathKmalviya/android-llm-localization
|
|
7
|
+
Project-URL: Repository, https://github.com/BharathKmalviya/android-llm-localization
|
|
8
|
+
Project-URL: Issues, https://github.com/BharathKmalviya/android-llm-localization/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/BharathKmalviya/android-llm-localization/blob/master/CHANGELOG.md
|
|
10
|
+
Keywords: android,localisation,localization,strings,translation,llm,gemini,openai,anthropic,ollama,i18n,l10n
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Internationalization
|
|
23
|
+
Classifier: Topic :: Software Development :: Localization
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# Android LLM Localization
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/android-localisation/)
|
|
32
|
+
[](https://pypi.org/project/android-localisation/)
|
|
33
|
+
[](https://github.com/BharathKmalviya/android-llm-localization/blob/master/LICENSE)
|
|
34
|
+
|
|
35
|
+
A zero-dependency Python tool to translate, fix, and verify Android `strings.xml` resources using Large Language Models (LLMs) — Gemini, OpenAI, Anthropic (Claude), or any local model via Ollama.
|
|
36
|
+
|
|
37
|
+
## Why this exists?
|
|
38
|
+
|
|
39
|
+
Localizing Android apps usually involves paying for services, exporting CSVs, or manually using Google Translate. This tool translates `strings.xml` directly in your project using modern LLMs, giving significantly better context-aware translations.
|
|
40
|
+
|
|
41
|
+
**Zero dependencies** — no `pip install` of extra libraries required. Uses only Python's built-in networking.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install android-localisation
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
To update to the latest version:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install --upgrade android-localisation
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# 1. Translate (Gemini free tier recommended)
|
|
63
|
+
android-localise translate --api-key YOUR_GEMINI_API_KEY
|
|
64
|
+
|
|
65
|
+
# 2. Fix any XML escaping issues introduced by the LLM
|
|
66
|
+
android-localise fix
|
|
67
|
+
|
|
68
|
+
# 3. Verify no format specifiers were corrupted (requires Java JDK)
|
|
69
|
+
android-localise verify
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## The Three Commands
|
|
75
|
+
|
|
76
|
+
### 1. `translate` — Translate strings into all locale directories
|
|
77
|
+
|
|
78
|
+
Reads `app/src/main/res/values/strings.xml` (English) and writes translated `strings.xml` into every `values-*` directory it finds.
|
|
79
|
+
|
|
80
|
+
**Prerequisites:**
|
|
81
|
+
- Create empty `values-<lang>/` folders for each language you want (e.g. `values-hi/`, `values-es/`)
|
|
82
|
+
- Get an API key — **[Google Gemini AI Studio](https://aistudio.google.com/) has a generous free tier**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Basic — Gemini (default)
|
|
86
|
+
android-localise translate --api-key YOUR_GEMINI_API_KEY
|
|
87
|
+
|
|
88
|
+
# With app context for better translations
|
|
89
|
+
android-localise translate --api-key YOUR_KEY --app-context "a fitness tracking app"
|
|
90
|
+
|
|
91
|
+
# OpenAI
|
|
92
|
+
android-localise translate --api-key YOUR_KEY --provider openai --model gpt-4o
|
|
93
|
+
|
|
94
|
+
# Anthropic (Claude)
|
|
95
|
+
android-localise translate --api-key YOUR_KEY --provider anthropic
|
|
96
|
+
|
|
97
|
+
# Local model via Ollama
|
|
98
|
+
android-localise translate --provider custom --base-url http://localhost:11434/v1/chat/completions --model llama3
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Full arguments:**
|
|
102
|
+
|
|
103
|
+
| Argument | Description | Default |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `--api-key` | API key (or set `GEMINI_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY` env vars) | *None* |
|
|
106
|
+
| `--provider` | AI provider: `gemini`, `openai`, `anthropic`, `custom` | `gemini` |
|
|
107
|
+
| `--model` | Model name (e.g. `gemini-2.5-flash`, `gpt-4o`, `claude-3-5-sonnet-latest`) | provider default |
|
|
108
|
+
| `--app-context` | Short description of your app to improve translation quality | *None* |
|
|
109
|
+
| `--res-dir` | Path to the Android `res/` directory | `app/src/main/res` |
|
|
110
|
+
| `--base-url` | Base URL for custom OpenAI-compatible endpoints | *None* |
|
|
111
|
+
| `--sleep` | Seconds between requests to avoid rate limits | `5.0` |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### 2. `fix` — Fix XML escaping issues
|
|
116
|
+
|
|
117
|
+
LLMs occasionally introduce malformed characters — curly apostrophes (`'`), unescaped quotes, or broken `%` symbols. This command cleans them all up.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
android-localise fix
|
|
121
|
+
# or with a custom res dir:
|
|
122
|
+
android-localise fix --res-dir path/to/res
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### 3. `verify` — Catch format specifier crashes before they happen
|
|
128
|
+
|
|
129
|
+
LLMs can corrupt Android format specifiers like `%1$s` or `%d`, which causes `UnknownFormatConversionException` crashes at runtime. This command compiles a Java verifier and dry-runs `String.format()` against every translated string.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
android-localise verify
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
*Requires `javac` in your system PATH. Run from Android Studio's terminal if needed.*
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Recommended Workflow
|
|
140
|
+
|
|
141
|
+
1. Update your English `strings.xml`
|
|
142
|
+
2. Create empty `values-<lang>/` folders for the languages you want
|
|
143
|
+
3. `android-localise translate --api-key YOUR_KEY`
|
|
144
|
+
4. `android-localise fix`
|
|
145
|
+
5. `android-localise verify`
|
|
146
|
+
6. Build and test your app
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Supported Providers
|
|
151
|
+
|
|
152
|
+
| Provider | Default Model | API Key Env Var |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| `gemini` (default) | `gemini-2.5-flash` | `GEMINI_API_KEY` |
|
|
155
|
+
| `openai` | `gpt-4o-mini` | `OPENAI_API_KEY` |
|
|
156
|
+
| `anthropic` | `claude-3-5-sonnet-latest` | `ANTHROPIC_API_KEY` |
|
|
157
|
+
| `custom` | *(must specify)* | `OPENAI_API_KEY` or none |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Contributing
|
|
164
|
+
|
|
165
|
+
Issues and PRs welcome at [github.com/BharathKmalviya/android-llm-localization](https://github.com/BharathKmalviya/android-llm-localization).
|
|
166
|
+
|
|
167
|
+
Releases are fully automated — bumping the version in `pyproject.toml` and pushing to `master` triggers a build and publish to PyPI automatically.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
*Created to make Android localization accessible, free, and completely automated.*
|
|
@@ -136,6 +136,8 @@ android-localise verify
|
|
|
136
136
|
|
|
137
137
|
Issues and PRs welcome at [github.com/BharathKmalviya/android-llm-localization](https://github.com/BharathKmalviya/android-llm-localization).
|
|
138
138
|
|
|
139
|
+
Releases are fully automated — bumping the version in `pyproject.toml` and pushing to `master` triggers a build and publish to PyPI automatically.
|
|
140
|
+
|
|
139
141
|
---
|
|
140
142
|
|
|
141
143
|
*Created to make Android localization accessible, free, and completely automated.*
|
{android_localisation-1.0.0 → android_localisation-1.0.1/android_localisation.egg-info}/PKG-INFO
RENAMED
|
@@ -1,169 +1,171 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: android-localisation
|
|
3
|
-
Version: 1.0.
|
|
4
|
-
Summary: Zero-dependency Android strings.xml translation and verification using LLMs (Gemini, OpenAI, Anthropic, Ollama).
|
|
5
|
-
License: MIT
|
|
6
|
-
Project-URL: Homepage, https://github.com/BharathKmalviya/android-llm-localization
|
|
7
|
-
Project-URL: Repository, https://github.com/BharathKmalviya/android-llm-localization
|
|
8
|
-
Project-URL: Issues, https://github.com/BharathKmalviya/android-llm-localization/issues
|
|
9
|
-
Project-URL: Changelog, https://github.com/BharathKmalviya/android-llm-localization/blob/master/CHANGELOG.md
|
|
10
|
-
Keywords: android,localisation,localization,strings,translation,llm,gemini,openai,anthropic,ollama,i18n,l10n
|
|
11
|
-
Classifier: Development Status :: 4 - Beta
|
|
12
|
-
Classifier: Environment :: Console
|
|
13
|
-
Classifier: Intended Audience :: Developers
|
|
14
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
-
Classifier: Operating System :: OS Independent
|
|
16
|
-
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
-
Classifier: Topic :: Software Development :: Internationalization
|
|
23
|
-
Classifier: Topic :: Software Development :: Localization
|
|
24
|
-
Requires-Python: >=3.8
|
|
25
|
-
Description-Content-Type: text/markdown
|
|
26
|
-
License-File: LICENSE
|
|
27
|
-
Dynamic: license-file
|
|
28
|
-
|
|
29
|
-
# Android LLM Localization
|
|
30
|
-
|
|
31
|
-
[](https://pypi.org/project/android-localisation/)
|
|
32
|
-
[](https://pypi.org/project/android-localisation/)
|
|
33
|
-
[](https://github.com/BharathKmalviya/android-llm-localization/blob/master/LICENSE)
|
|
34
|
-
|
|
35
|
-
A zero-dependency Python tool to translate, fix, and verify Android `strings.xml` resources using Large Language Models (LLMs) — Gemini, OpenAI, Anthropic (Claude), or any local model via Ollama.
|
|
36
|
-
|
|
37
|
-
## Why this exists?
|
|
38
|
-
|
|
39
|
-
Localizing Android apps usually involves paying for services, exporting CSVs, or manually using Google Translate. This tool translates `strings.xml` directly in your project using modern LLMs, giving significantly better context-aware translations.
|
|
40
|
-
|
|
41
|
-
**Zero dependencies** — no `pip install` of extra libraries required. Uses only Python's built-in networking.
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## Installation
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
pip install android-localisation
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
To update to the latest version:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
pip install --upgrade android-localisation
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Quick Start
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
# 1. Translate (Gemini free tier recommended)
|
|
63
|
-
android-localise translate --api-key YOUR_GEMINI_API_KEY
|
|
64
|
-
|
|
65
|
-
# 2. Fix any XML escaping issues introduced by the LLM
|
|
66
|
-
android-localise fix
|
|
67
|
-
|
|
68
|
-
# 3. Verify no format specifiers were corrupted (requires Java JDK)
|
|
69
|
-
android-localise verify
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## The Three Commands
|
|
75
|
-
|
|
76
|
-
### 1. `translate` — Translate strings into all locale directories
|
|
77
|
-
|
|
78
|
-
Reads `app/src/main/res/values/strings.xml` (English) and writes translated `strings.xml` into every `values-*` directory it finds.
|
|
79
|
-
|
|
80
|
-
**Prerequisites:**
|
|
81
|
-
- Create empty `values-<lang>/` folders for each language you want (e.g. `values-hi/`, `values-es/`)
|
|
82
|
-
- Get an API key — **[Google Gemini AI Studio](https://aistudio.google.com/) has a generous free tier**
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Basic — Gemini (default)
|
|
86
|
-
android-localise translate --api-key YOUR_GEMINI_API_KEY
|
|
87
|
-
|
|
88
|
-
# With app context for better translations
|
|
89
|
-
android-localise translate --api-key YOUR_KEY --app-context "a fitness tracking app"
|
|
90
|
-
|
|
91
|
-
# OpenAI
|
|
92
|
-
android-localise translate --api-key YOUR_KEY --provider openai --model gpt-4o
|
|
93
|
-
|
|
94
|
-
# Anthropic (Claude)
|
|
95
|
-
android-localise translate --api-key YOUR_KEY --provider anthropic
|
|
96
|
-
|
|
97
|
-
# Local model via Ollama
|
|
98
|
-
android-localise translate --provider custom --base-url http://localhost:11434/v1/chat/completions --model llama3
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
**Full arguments:**
|
|
102
|
-
|
|
103
|
-
| Argument | Description | Default |
|
|
104
|
-
|---|---|---|
|
|
105
|
-
| `--api-key` | API key (or set `GEMINI_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY` env vars) | *None* |
|
|
106
|
-
| `--provider` | AI provider: `gemini`, `openai`, `anthropic`, `custom` | `gemini` |
|
|
107
|
-
| `--model` | Model name (e.g. `gemini-2.5-flash`, `gpt-4o`, `claude-3-5-sonnet-latest`) | provider default |
|
|
108
|
-
| `--app-context` | Short description of your app to improve translation quality | *None* |
|
|
109
|
-
| `--res-dir` | Path to the Android `res/` directory | `app/src/main/res` |
|
|
110
|
-
| `--base-url` | Base URL for custom OpenAI-compatible endpoints | *None* |
|
|
111
|
-
| `--sleep` | Seconds between requests to avoid rate limits | `5.0` |
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
### 2. `fix` — Fix XML escaping issues
|
|
116
|
-
|
|
117
|
-
LLMs occasionally introduce malformed characters — curly apostrophes (`'`), unescaped quotes, or broken `%` symbols. This command cleans them all up.
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
android-localise fix
|
|
121
|
-
# or with a custom res dir:
|
|
122
|
-
android-localise fix --res-dir path/to/res
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
### 3. `verify` — Catch format specifier crashes before they happen
|
|
128
|
-
|
|
129
|
-
LLMs can corrupt Android format specifiers like `%1$s` or `%d`, which causes `UnknownFormatConversionException` crashes at runtime. This command compiles a Java verifier and dry-runs `String.format()` against every translated string.
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
android-localise verify
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
*Requires `javac` in your system PATH. Run from Android Studio's terminal if needed.*
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Recommended Workflow
|
|
140
|
-
|
|
141
|
-
1. Update your English `strings.xml`
|
|
142
|
-
2. Create empty `values-<lang>/` folders for the languages you want
|
|
143
|
-
3. `android-localise translate --api-key YOUR_KEY`
|
|
144
|
-
4. `android-localise fix`
|
|
145
|
-
5. `android-localise verify`
|
|
146
|
-
6. Build and test your app
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Supported Providers
|
|
151
|
-
|
|
152
|
-
| Provider | Default Model | API Key Env Var |
|
|
153
|
-
|---|---|---|
|
|
154
|
-
| `gemini` (default) | `gemini-2.5-flash` | `GEMINI_API_KEY` |
|
|
155
|
-
| `openai` | `gpt-4o-mini` | `OPENAI_API_KEY` |
|
|
156
|
-
| `anthropic` | `claude-3-5-sonnet-latest` | `ANTHROPIC_API_KEY` |
|
|
157
|
-
| `custom` | *(must specify)* | `OPENAI_API_KEY` or none |
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## Contributing
|
|
164
|
-
|
|
165
|
-
Issues and PRs welcome at [github.com/BharathKmalviya/android-llm-localization](https://github.com/BharathKmalviya/android-llm-localization).
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: android-localisation
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Zero-dependency Android strings.xml translation and verification using LLMs (Gemini, OpenAI, Anthropic, Ollama).
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/BharathKmalviya/android-llm-localization
|
|
7
|
+
Project-URL: Repository, https://github.com/BharathKmalviya/android-llm-localization
|
|
8
|
+
Project-URL: Issues, https://github.com/BharathKmalviya/android-llm-localization/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/BharathKmalviya/android-llm-localization/blob/master/CHANGELOG.md
|
|
10
|
+
Keywords: android,localisation,localization,strings,translation,llm,gemini,openai,anthropic,ollama,i18n,l10n
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development :: Internationalization
|
|
23
|
+
Classifier: Topic :: Software Development :: Localization
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# Android LLM Localization
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/android-localisation/)
|
|
32
|
+
[](https://pypi.org/project/android-localisation/)
|
|
33
|
+
[](https://github.com/BharathKmalviya/android-llm-localization/blob/master/LICENSE)
|
|
34
|
+
|
|
35
|
+
A zero-dependency Python tool to translate, fix, and verify Android `strings.xml` resources using Large Language Models (LLMs) — Gemini, OpenAI, Anthropic (Claude), or any local model via Ollama.
|
|
36
|
+
|
|
37
|
+
## Why this exists?
|
|
38
|
+
|
|
39
|
+
Localizing Android apps usually involves paying for services, exporting CSVs, or manually using Google Translate. This tool translates `strings.xml` directly in your project using modern LLMs, giving significantly better context-aware translations.
|
|
40
|
+
|
|
41
|
+
**Zero dependencies** — no `pip install` of extra libraries required. Uses only Python's built-in networking.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install android-localisation
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
To update to the latest version:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install --upgrade android-localisation
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# 1. Translate (Gemini free tier recommended)
|
|
63
|
+
android-localise translate --api-key YOUR_GEMINI_API_KEY
|
|
64
|
+
|
|
65
|
+
# 2. Fix any XML escaping issues introduced by the LLM
|
|
66
|
+
android-localise fix
|
|
67
|
+
|
|
68
|
+
# 3. Verify no format specifiers were corrupted (requires Java JDK)
|
|
69
|
+
android-localise verify
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## The Three Commands
|
|
75
|
+
|
|
76
|
+
### 1. `translate` — Translate strings into all locale directories
|
|
77
|
+
|
|
78
|
+
Reads `app/src/main/res/values/strings.xml` (English) and writes translated `strings.xml` into every `values-*` directory it finds.
|
|
79
|
+
|
|
80
|
+
**Prerequisites:**
|
|
81
|
+
- Create empty `values-<lang>/` folders for each language you want (e.g. `values-hi/`, `values-es/`)
|
|
82
|
+
- Get an API key — **[Google Gemini AI Studio](https://aistudio.google.com/) has a generous free tier**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Basic — Gemini (default)
|
|
86
|
+
android-localise translate --api-key YOUR_GEMINI_API_KEY
|
|
87
|
+
|
|
88
|
+
# With app context for better translations
|
|
89
|
+
android-localise translate --api-key YOUR_KEY --app-context "a fitness tracking app"
|
|
90
|
+
|
|
91
|
+
# OpenAI
|
|
92
|
+
android-localise translate --api-key YOUR_KEY --provider openai --model gpt-4o
|
|
93
|
+
|
|
94
|
+
# Anthropic (Claude)
|
|
95
|
+
android-localise translate --api-key YOUR_KEY --provider anthropic
|
|
96
|
+
|
|
97
|
+
# Local model via Ollama
|
|
98
|
+
android-localise translate --provider custom --base-url http://localhost:11434/v1/chat/completions --model llama3
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Full arguments:**
|
|
102
|
+
|
|
103
|
+
| Argument | Description | Default |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `--api-key` | API key (or set `GEMINI_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY` env vars) | *None* |
|
|
106
|
+
| `--provider` | AI provider: `gemini`, `openai`, `anthropic`, `custom` | `gemini` |
|
|
107
|
+
| `--model` | Model name (e.g. `gemini-2.5-flash`, `gpt-4o`, `claude-3-5-sonnet-latest`) | provider default |
|
|
108
|
+
| `--app-context` | Short description of your app to improve translation quality | *None* |
|
|
109
|
+
| `--res-dir` | Path to the Android `res/` directory | `app/src/main/res` |
|
|
110
|
+
| `--base-url` | Base URL for custom OpenAI-compatible endpoints | *None* |
|
|
111
|
+
| `--sleep` | Seconds between requests to avoid rate limits | `5.0` |
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### 2. `fix` — Fix XML escaping issues
|
|
116
|
+
|
|
117
|
+
LLMs occasionally introduce malformed characters — curly apostrophes (`'`), unescaped quotes, or broken `%` symbols. This command cleans them all up.
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
android-localise fix
|
|
121
|
+
# or with a custom res dir:
|
|
122
|
+
android-localise fix --res-dir path/to/res
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### 3. `verify` — Catch format specifier crashes before they happen
|
|
128
|
+
|
|
129
|
+
LLMs can corrupt Android format specifiers like `%1$s` or `%d`, which causes `UnknownFormatConversionException` crashes at runtime. This command compiles a Java verifier and dry-runs `String.format()` against every translated string.
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
android-localise verify
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
*Requires `javac` in your system PATH. Run from Android Studio's terminal if needed.*
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Recommended Workflow
|
|
140
|
+
|
|
141
|
+
1. Update your English `strings.xml`
|
|
142
|
+
2. Create empty `values-<lang>/` folders for the languages you want
|
|
143
|
+
3. `android-localise translate --api-key YOUR_KEY`
|
|
144
|
+
4. `android-localise fix`
|
|
145
|
+
5. `android-localise verify`
|
|
146
|
+
6. Build and test your app
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Supported Providers
|
|
151
|
+
|
|
152
|
+
| Provider | Default Model | API Key Env Var |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| `gemini` (default) | `gemini-2.5-flash` | `GEMINI_API_KEY` |
|
|
155
|
+
| `openai` | `gpt-4o-mini` | `OPENAI_API_KEY` |
|
|
156
|
+
| `anthropic` | `claude-3-5-sonnet-latest` | `ANTHROPIC_API_KEY` |
|
|
157
|
+
| `custom` | *(must specify)* | `OPENAI_API_KEY` or none |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Contributing
|
|
164
|
+
|
|
165
|
+
Issues and PRs welcome at [github.com/BharathKmalviya/android-llm-localization](https://github.com/BharathKmalviya/android-llm-localization).
|
|
166
|
+
|
|
167
|
+
Releases are fully automated — bumping the version in `pyproject.toml` and pushing to `master` triggers a build and publish to PyPI automatically.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
*Created to make Android localization accessible, free, and completely automated.*
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "android-localisation"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.1"
|
|
8
8
|
description = "Zero-dependency Android strings.xml translation and verification using LLMs (Gemini, OpenAI, Anthropic, Ollama)."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{android_localisation-1.0.0 → android_localisation-1.0.1}/android_localisation.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|