localizerx 0.1.0__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.
- localizerx-0.1.0/LICENSE +21 -0
- localizerx-0.1.0/PKG-INFO +252 -0
- localizerx-0.1.0/README.md +218 -0
- localizerx-0.1.0/localizerx/__init__.py +3 -0
- localizerx-0.1.0/localizerx/__main__.py +6 -0
- localizerx-0.1.0/localizerx/cli/__init__.py +360 -0
- localizerx-0.1.0/localizerx/cli/android.py +527 -0
- localizerx-0.1.0/localizerx/cli/chrome.py +587 -0
- localizerx-0.1.0/localizerx/cli/delete.py +381 -0
- localizerx-0.1.0/localizerx/cli/i18n.py +440 -0
- localizerx-0.1.0/localizerx/cli/metadata.py +1030 -0
- localizerx-0.1.0/localizerx/cli/screenshots.py +1005 -0
- localizerx-0.1.0/localizerx/cli/translate.py +681 -0
- localizerx-0.1.0/localizerx/cli/utils.py +26 -0
- localizerx-0.1.0/localizerx/config.py +223 -0
- localizerx-0.1.0/localizerx/io/__init__.py +5 -0
- localizerx-0.1.0/localizerx/io/android.py +308 -0
- localizerx-0.1.0/localizerx/io/extension.py +198 -0
- localizerx-0.1.0/localizerx/io/i18n.py +396 -0
- localizerx-0.1.0/localizerx/io/metadata.py +219 -0
- localizerx-0.1.0/localizerx/io/screenshots.py +338 -0
- localizerx-0.1.0/localizerx/io/xcstrings.py +198 -0
- localizerx-0.1.0/localizerx/parser/__init__.py +5 -0
- localizerx-0.1.0/localizerx/parser/android_model.py +133 -0
- localizerx-0.1.0/localizerx/parser/app_context.py +101 -0
- localizerx-0.1.0/localizerx/parser/extension_model.py +163 -0
- localizerx-0.1.0/localizerx/parser/i18n_model.py +104 -0
- localizerx-0.1.0/localizerx/parser/metadata_model.py +191 -0
- localizerx-0.1.0/localizerx/parser/model.py +112 -0
- localizerx-0.1.0/localizerx/parser/screenshots_model.py +307 -0
- localizerx-0.1.0/localizerx/translator/__init__.py +6 -0
- localizerx-0.1.0/localizerx/translator/base.py +106 -0
- localizerx-0.1.0/localizerx/translator/extension_prompts.py +176 -0
- localizerx-0.1.0/localizerx/translator/gemini_adapter.py +558 -0
- localizerx-0.1.0/localizerx/translator/metadata_prompts.py +237 -0
- localizerx-0.1.0/localizerx/translator/screenshots_generation_prompts.py +177 -0
- localizerx-0.1.0/localizerx/translator/screenshots_prompts.py +185 -0
- localizerx-0.1.0/localizerx/utils/__init__.py +11 -0
- localizerx-0.1.0/localizerx/utils/context.py +51 -0
- localizerx-0.1.0/localizerx/utils/limits.py +156 -0
- localizerx-0.1.0/localizerx/utils/locale.py +535 -0
- localizerx-0.1.0/localizerx/utils/placeholders.py +124 -0
- localizerx-0.1.0/localizerx.egg-info/PKG-INFO +252 -0
- localizerx-0.1.0/localizerx.egg-info/SOURCES.txt +76 -0
- localizerx-0.1.0/localizerx.egg-info/dependency_links.txt +1 -0
- localizerx-0.1.0/localizerx.egg-info/entry_points.txt +3 -0
- localizerx-0.1.0/localizerx.egg-info/requires.txt +13 -0
- localizerx-0.1.0/localizerx.egg-info/top_level.txt +1 -0
- localizerx-0.1.0/pyproject.toml +75 -0
- localizerx-0.1.0/setup.cfg +4 -0
- localizerx-0.1.0/tests/test_android_io.py +296 -0
- localizerx-0.1.0/tests/test_android_model.py +126 -0
- localizerx-0.1.0/tests/test_chrome_translation.py +331 -0
- localizerx-0.1.0/tests/test_cli.py +558 -0
- localizerx-0.1.0/tests/test_cli_refresh.py +85 -0
- localizerx-0.1.0/tests/test_config.py +362 -0
- localizerx-0.1.0/tests/test_context_extraction.py +157 -0
- localizerx-0.1.0/tests/test_delete.py +307 -0
- localizerx-0.1.0/tests/test_extension_io.py +236 -0
- localizerx-0.1.0/tests/test_extension_model.py +173 -0
- localizerx-0.1.0/tests/test_gemini_adapter_context.py +90 -0
- localizerx-0.1.0/tests/test_i18n_io.py +335 -0
- localizerx-0.1.0/tests/test_i18n_model.py +107 -0
- localizerx-0.1.0/tests/test_locale.py +85 -0
- localizerx-0.1.0/tests/test_metadata_cli.py +372 -0
- localizerx-0.1.0/tests/test_metadata_io.py +234 -0
- localizerx-0.1.0/tests/test_metadata_limits.py +196 -0
- localizerx-0.1.0/tests/test_model.py +99 -0
- localizerx-0.1.0/tests/test_placeholders.py +190 -0
- localizerx-0.1.0/tests/test_plurals_parsing.py +84 -0
- localizerx-0.1.0/tests/test_remove_language.py +99 -0
- localizerx-0.1.0/tests/test_screenshots_io.py +335 -0
- localizerx-0.1.0/tests/test_screenshots_model.py +323 -0
- localizerx-0.1.0/tests/test_screenshots_prompts.py +354 -0
- localizerx-0.1.0/tests/test_xcstrings.py +144 -0
- localizerx-0.1.0/tests/test_xcstrings_formatting.py +127 -0
- localizerx-0.1.0/tests/test_xcstrings_plurals.py +302 -0
- localizerx-0.1.0/tests/test_xcstrings_translation_bugs.py +485 -0
localizerx-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 LocalizerX Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: localizerx
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI tool for translating Xcode String Catalogs using Gemini API
|
|
5
|
+
Author: LocalizerX Team
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/localizerx/localizerx
|
|
8
|
+
Project-URL: Repository, https://github.com/localizerx/localizerx
|
|
9
|
+
Keywords: xcode,localization,translation,xcstrings,gemini,ios
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Localization
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: typer>=0.9.0
|
|
24
|
+
Requires-Dist: httpx>=0.25.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Requires-Dist: rich>=13.0.0
|
|
27
|
+
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
32
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# ๐ LocalizerX
|
|
36
|
+
|
|
37
|
+
> **Quick Tip:** You can use `lrx` as a handy shorthand for the `localizerx` command anywhere!
|
|
38
|
+
|
|
39
|
+
Welcome to **LocalizerX**! The CLI tool designed to make your localization workflow seamless and fast. LocalizerX uses the power of the Gemini API to automatically translate your project assets across multiple platforms and formats.
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
## Why LocalizerX?
|
|
44
|
+
|
|
45
|
+
LocalizerX is built for developers who want to reach a global audience without the headache of manual translations. Whether you're building a macOS app, a Chrome extension, or a web project, we've got you covered!
|
|
46
|
+
|
|
47
|
+
### โจ Key Features
|
|
48
|
+
|
|
49
|
+
- **๐ค AI Agent Ready:** Comes with a standard Agent Skill (`use-localizerx`) for Claude Code and Gemini CLIโlet your AI agents translate your project autonomously!
|
|
50
|
+
- **๐ฆ Multi-Format Support:** Translate `.xcstrings`, fastlane metadata, Chrome Extensions, frontend JSONs, and Android `strings.xml`.
|
|
51
|
+
- **๐ ASO-Optimized:** Generate and translate App Store screenshot texts with marketing-focused prompts designed to boost your store presence.
|
|
52
|
+
- **๐ก๏ธ Safe & Smart:** Automatically preserves placeholders (`%@`, `{name}`, etc.) and respects developer comments for context.
|
|
53
|
+
- **โก Fast & Efficient:** Uses SQLite caching to avoid redundant API calls and save you money.
|
|
54
|
+
- **๐ ๏ธ Flexible:** Supports pluralization, declension forms, and character limit enforcement.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## ๐ Installation
|
|
59
|
+
|
|
60
|
+
### Requirements
|
|
61
|
+
|
|
62
|
+
- **macOS** (for the best experience)
|
|
63
|
+
- **Python 3.10+**
|
|
64
|
+
- **Gemini API key**
|
|
65
|
+
|
|
66
|
+
### 1. Using pipx (Recommended for Global Usage)
|
|
67
|
+
`pipx` installs LocalizerX in an isolated environment and makes the `localizerx` and `lrx` commands available globally.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# If you don't have pipx yet:
|
|
71
|
+
brew install pipx
|
|
72
|
+
pipx ensurepath
|
|
73
|
+
|
|
74
|
+
# Install LocalizerX
|
|
75
|
+
pipx install localizerx
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
*Note: If the package is not yet on PyPI, you can install directly from the source.*
|
|
79
|
+
|
|
80
|
+
### 2. From Source
|
|
81
|
+
If you want to use the latest version or contribute to the project:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Clone the repository
|
|
85
|
+
git clone https://github.com/khodulov-m/LocalizerX.git
|
|
86
|
+
cd LocalizerX
|
|
87
|
+
|
|
88
|
+
# Install globally using pipx
|
|
89
|
+
pipx install .
|
|
90
|
+
|
|
91
|
+
# OR for development (changes apply immediately)
|
|
92
|
+
pip install -e ".[dev]"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## โ๏ธ Setup
|
|
98
|
+
|
|
99
|
+
### 1. Your API Key
|
|
100
|
+
|
|
101
|
+
Grab your Gemini API key from the [Google AI Studio](https://aistudio.google.com/) and set it as an environment variable:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export GEMINI_API_KEY="your-api-key"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
To keep it permanent, add it to your `~/.zshrc` or `~/.bashrc`:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
echo 'export GEMINI_API_KEY="your-api-key"' >> ~/.zshrc
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 2. Initialize Your Config
|
|
114
|
+
|
|
115
|
+
Create a configuration file to set your default languages and preferences:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
lrx init
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
This creates a config file at `~/.config/localizerx/config.toml`. Here's a peek at what you can customize:
|
|
122
|
+
|
|
123
|
+
```toml
|
|
124
|
+
source_language = "en"
|
|
125
|
+
default_targets = ["ru", "fr-FR", "pt-BR", "es-MX", "ja", "de-DE", "zh-Hans"]
|
|
126
|
+
|
|
127
|
+
[translator]
|
|
128
|
+
model = "gemini-2.5-flash-lite"
|
|
129
|
+
use_app_context = true # Helps AI understand your app's context for better translations!
|
|
130
|
+
cache_enabled = true
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## ๐ How to Use
|
|
136
|
+
|
|
137
|
+
### ๐๏ธ Quick Translation
|
|
138
|
+
|
|
139
|
+
Want to translate everything to your default languages? Just run:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
lrx translate
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Or target specific languages:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
lrx --to fr,es,de
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### ๐ฑ Supporting All Your Platforms
|
|
152
|
+
|
|
153
|
+
LocalizerX is a polyglot! Hereโs how to use it for different formats:
|
|
154
|
+
|
|
155
|
+
#### **Xcode String Catalogs (.xcstrings)**
|
|
156
|
+
```bash
|
|
157
|
+
# Translate a specific file or an entire directory
|
|
158
|
+
lrx translate Localizable.xcstrings --to fr,es,de
|
|
159
|
+
lrx translate ./MyApp --to ja,ko
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### **App Store Metadata (fastlane)**
|
|
163
|
+
```bash
|
|
164
|
+
# Translate App Store name, subtitle, and description
|
|
165
|
+
lrx metadata --to de-DE,fr-FR
|
|
166
|
+
|
|
167
|
+
# Check character limits and find duplicate words for ASO
|
|
168
|
+
lrx metadata-check
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### **App Store Screenshot Texts**
|
|
172
|
+
```bash
|
|
173
|
+
# Generate marketing-optimized texts interactively
|
|
174
|
+
lrx screenshots-generate
|
|
175
|
+
|
|
176
|
+
# Translate them to reach a global audience
|
|
177
|
+
lrx screenshots --to de,fr,es
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### **Chrome Extensions**
|
|
181
|
+
```bash
|
|
182
|
+
# Translate _locales/messages.json files
|
|
183
|
+
lrx chrome --to fr,de,pt-BR
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### **Frontend i18n (JSON)**
|
|
187
|
+
```bash
|
|
188
|
+
# Works with Vue, React, Angular, and more
|
|
189
|
+
lrx i18n --to es,ja,zh-Hans
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### **Android Resources**
|
|
193
|
+
```bash
|
|
194
|
+
# Translate strings.xml (including arrays and plurals!)
|
|
195
|
+
lrx android --to fr,de --include-plurals
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### ๐งน Cleaning up Languages
|
|
199
|
+
|
|
200
|
+
Need to remove some languages from your project? LocalizerX makes it easy:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Remove French, German, and Italian translations from .xcstrings
|
|
204
|
+
lrx translate --remove fr,de,it
|
|
205
|
+
|
|
206
|
+
# Remove specific locales for Android, Chrome, or Frontend i18n
|
|
207
|
+
lrx android --remove fr,es
|
|
208
|
+
lrx chrome --remove pt-BR
|
|
209
|
+
lrx i18n --remove de
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## ๐ ๏ธ Handy Options
|
|
215
|
+
|
|
216
|
+
| Option | Short | Description |
|
|
217
|
+
|--------|-------|-------------|
|
|
218
|
+
| `--to` | `-t` | Target languages (comma-separated). |
|
|
219
|
+
| `--remove` | `-r` | Languages to remove (comma-separated). |
|
|
220
|
+
| `--src` | `-s` | Source language (default: `en`). |
|
|
221
|
+
| `--refresh` | | Add new strings and clean up stale ones automatically. |
|
|
222
|
+
| `--preview` | `-p` | Review translations before they are saved. |
|
|
223
|
+
| `--dry-run` | `-n` | See what would happen without making any changes. |
|
|
224
|
+
| `--backup` | `-b` | Creates a backup of your file before writing. |
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## ๐ป Developers & Contributors
|
|
229
|
+
|
|
230
|
+
We love contributions! To set up for local development:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
git clone https://github.com/khodulov-m/LocalizerX.git
|
|
234
|
+
cd LocalizerX
|
|
235
|
+
python -m venv .venv
|
|
236
|
+
source .venv/bin/activate
|
|
237
|
+
pip install -e ".[dev]"
|
|
238
|
+
|
|
239
|
+
# Keep the code quality high!
|
|
240
|
+
ruff check .
|
|
241
|
+
black .
|
|
242
|
+
pytest
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## ๐ License
|
|
248
|
+
|
|
249
|
+
LocalizerX is released under the [MIT License](LICENSE).
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
Made with โค๏ธ for developers everywhere.
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# ๐ LocalizerX
|
|
2
|
+
|
|
3
|
+
> **Quick Tip:** You can use `lrx` as a handy shorthand for the `localizerx` command anywhere!
|
|
4
|
+
|
|
5
|
+
Welcome to **LocalizerX**! The CLI tool designed to make your localization workflow seamless and fast. LocalizerX uses the power of the Gemini API to automatically translate your project assets across multiple platforms and formats.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Why LocalizerX?
|
|
10
|
+
|
|
11
|
+
LocalizerX is built for developers who want to reach a global audience without the headache of manual translations. Whether you're building a macOS app, a Chrome extension, or a web project, we've got you covered!
|
|
12
|
+
|
|
13
|
+
### โจ Key Features
|
|
14
|
+
|
|
15
|
+
- **๐ค AI Agent Ready:** Comes with a standard Agent Skill (`use-localizerx`) for Claude Code and Gemini CLIโlet your AI agents translate your project autonomously!
|
|
16
|
+
- **๐ฆ Multi-Format Support:** Translate `.xcstrings`, fastlane metadata, Chrome Extensions, frontend JSONs, and Android `strings.xml`.
|
|
17
|
+
- **๐ ASO-Optimized:** Generate and translate App Store screenshot texts with marketing-focused prompts designed to boost your store presence.
|
|
18
|
+
- **๐ก๏ธ Safe & Smart:** Automatically preserves placeholders (`%@`, `{name}`, etc.) and respects developer comments for context.
|
|
19
|
+
- **โก Fast & Efficient:** Uses SQLite caching to avoid redundant API calls and save you money.
|
|
20
|
+
- **๐ ๏ธ Flexible:** Supports pluralization, declension forms, and character limit enforcement.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## ๐ Installation
|
|
25
|
+
|
|
26
|
+
### Requirements
|
|
27
|
+
|
|
28
|
+
- **macOS** (for the best experience)
|
|
29
|
+
- **Python 3.10+**
|
|
30
|
+
- **Gemini API key**
|
|
31
|
+
|
|
32
|
+
### 1. Using pipx (Recommended for Global Usage)
|
|
33
|
+
`pipx` installs LocalizerX in an isolated environment and makes the `localizerx` and `lrx` commands available globally.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# If you don't have pipx yet:
|
|
37
|
+
brew install pipx
|
|
38
|
+
pipx ensurepath
|
|
39
|
+
|
|
40
|
+
# Install LocalizerX
|
|
41
|
+
pipx install localizerx
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
*Note: If the package is not yet on PyPI, you can install directly from the source.*
|
|
45
|
+
|
|
46
|
+
### 2. From Source
|
|
47
|
+
If you want to use the latest version or contribute to the project:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Clone the repository
|
|
51
|
+
git clone https://github.com/khodulov-m/LocalizerX.git
|
|
52
|
+
cd LocalizerX
|
|
53
|
+
|
|
54
|
+
# Install globally using pipx
|
|
55
|
+
pipx install .
|
|
56
|
+
|
|
57
|
+
# OR for development (changes apply immediately)
|
|
58
|
+
pip install -e ".[dev]"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## โ๏ธ Setup
|
|
64
|
+
|
|
65
|
+
### 1. Your API Key
|
|
66
|
+
|
|
67
|
+
Grab your Gemini API key from the [Google AI Studio](https://aistudio.google.com/) and set it as an environment variable:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
export GEMINI_API_KEY="your-api-key"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
To keep it permanent, add it to your `~/.zshrc` or `~/.bashrc`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
echo 'export GEMINI_API_KEY="your-api-key"' >> ~/.zshrc
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 2. Initialize Your Config
|
|
80
|
+
|
|
81
|
+
Create a configuration file to set your default languages and preferences:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
lrx init
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
This creates a config file at `~/.config/localizerx/config.toml`. Here's a peek at what you can customize:
|
|
88
|
+
|
|
89
|
+
```toml
|
|
90
|
+
source_language = "en"
|
|
91
|
+
default_targets = ["ru", "fr-FR", "pt-BR", "es-MX", "ja", "de-DE", "zh-Hans"]
|
|
92
|
+
|
|
93
|
+
[translator]
|
|
94
|
+
model = "gemini-2.5-flash-lite"
|
|
95
|
+
use_app_context = true # Helps AI understand your app's context for better translations!
|
|
96
|
+
cache_enabled = true
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## ๐ How to Use
|
|
102
|
+
|
|
103
|
+
### ๐๏ธ Quick Translation
|
|
104
|
+
|
|
105
|
+
Want to translate everything to your default languages? Just run:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
lrx translate
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Or target specific languages:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
lrx --to fr,es,de
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### ๐ฑ Supporting All Your Platforms
|
|
118
|
+
|
|
119
|
+
LocalizerX is a polyglot! Hereโs how to use it for different formats:
|
|
120
|
+
|
|
121
|
+
#### **Xcode String Catalogs (.xcstrings)**
|
|
122
|
+
```bash
|
|
123
|
+
# Translate a specific file or an entire directory
|
|
124
|
+
lrx translate Localizable.xcstrings --to fr,es,de
|
|
125
|
+
lrx translate ./MyApp --to ja,ko
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### **App Store Metadata (fastlane)**
|
|
129
|
+
```bash
|
|
130
|
+
# Translate App Store name, subtitle, and description
|
|
131
|
+
lrx metadata --to de-DE,fr-FR
|
|
132
|
+
|
|
133
|
+
# Check character limits and find duplicate words for ASO
|
|
134
|
+
lrx metadata-check
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### **App Store Screenshot Texts**
|
|
138
|
+
```bash
|
|
139
|
+
# Generate marketing-optimized texts interactively
|
|
140
|
+
lrx screenshots-generate
|
|
141
|
+
|
|
142
|
+
# Translate them to reach a global audience
|
|
143
|
+
lrx screenshots --to de,fr,es
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### **Chrome Extensions**
|
|
147
|
+
```bash
|
|
148
|
+
# Translate _locales/messages.json files
|
|
149
|
+
lrx chrome --to fr,de,pt-BR
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### **Frontend i18n (JSON)**
|
|
153
|
+
```bash
|
|
154
|
+
# Works with Vue, React, Angular, and more
|
|
155
|
+
lrx i18n --to es,ja,zh-Hans
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### **Android Resources**
|
|
159
|
+
```bash
|
|
160
|
+
# Translate strings.xml (including arrays and plurals!)
|
|
161
|
+
lrx android --to fr,de --include-plurals
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### ๐งน Cleaning up Languages
|
|
165
|
+
|
|
166
|
+
Need to remove some languages from your project? LocalizerX makes it easy:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Remove French, German, and Italian translations from .xcstrings
|
|
170
|
+
lrx translate --remove fr,de,it
|
|
171
|
+
|
|
172
|
+
# Remove specific locales for Android, Chrome, or Frontend i18n
|
|
173
|
+
lrx android --remove fr,es
|
|
174
|
+
lrx chrome --remove pt-BR
|
|
175
|
+
lrx i18n --remove de
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## ๐ ๏ธ Handy Options
|
|
181
|
+
|
|
182
|
+
| Option | Short | Description |
|
|
183
|
+
|--------|-------|-------------|
|
|
184
|
+
| `--to` | `-t` | Target languages (comma-separated). |
|
|
185
|
+
| `--remove` | `-r` | Languages to remove (comma-separated). |
|
|
186
|
+
| `--src` | `-s` | Source language (default: `en`). |
|
|
187
|
+
| `--refresh` | | Add new strings and clean up stale ones automatically. |
|
|
188
|
+
| `--preview` | `-p` | Review translations before they are saved. |
|
|
189
|
+
| `--dry-run` | `-n` | See what would happen without making any changes. |
|
|
190
|
+
| `--backup` | `-b` | Creates a backup of your file before writing. |
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## ๐ป Developers & Contributors
|
|
195
|
+
|
|
196
|
+
We love contributions! To set up for local development:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
git clone https://github.com/khodulov-m/LocalizerX.git
|
|
200
|
+
cd LocalizerX
|
|
201
|
+
python -m venv .venv
|
|
202
|
+
source .venv/bin/activate
|
|
203
|
+
pip install -e ".[dev]"
|
|
204
|
+
|
|
205
|
+
# Keep the code quality high!
|
|
206
|
+
ruff check .
|
|
207
|
+
black .
|
|
208
|
+
pytest
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## ๐ License
|
|
214
|
+
|
|
215
|
+
LocalizerX is released under the [MIT License](LICENSE).
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
Made with โค๏ธ for developers everywhere.
|