Skip to content

Commit e30a0c1

Browse files
committed
feat(cli): add Tolgee sync workflows
1 parent a554ffb commit e30a0c1

8 files changed

Lines changed: 2210 additions & 114 deletions

File tree

langcodec-cli/README.md

Lines changed: 91 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,89 @@
11
# langcodec-cli
22

3-
`langcodec` is a command-line tool for real localization work.
3+
`langcodec` is a localization CLI for teams shipping real apps, not demo files.
44

5-
It helps you move between Apple, Android, and tabular translation formats without building one-off scripts for every project.
5+
It handles the annoying parts of localization work in one place: format conversion, catalog cleanup, AI-assisted translation, translator-facing comment generation, and Tolgee sync for Apple string catalogs.
66

7-
Supported inputs and outputs:
7+
Supported formats:
88

99
- Apple `.strings`
1010
- Apple `.xcstrings`
1111
- Android `strings.xml`
1212
- CSV
1313
- TSV
1414

15-
## Why Use It
15+
## Why It Feels Useful
1616

17-
`langcodec` is designed for teams who need to:
17+
Most localization tooling does one small thing. `langcodec` is designed to cover the loop teams actually run:
1818

19-
- convert localization files across platforms
20-
- inspect missing, stale, or review-needed strings
21-
- normalize files to reduce noisy diffs
22-
- edit translations in place
23-
- merge or sync catalogs safely
24-
- draft translations with AI providers
25-
- generate translator-facing xcstrings comments from source usage
19+
1. Convert strings between iOS, Android, and spreadsheet formats.
20+
2. Inspect what is missing, stale, or still needs review.
21+
3. Normalize files so diffs stop being noisy.
22+
4. Draft translations with AI.
23+
5. Generate better comments for translators from real source usage.
24+
6. Pull from and push back to Tolgee without custom glue scripts.
2625

27-
Instead of treating localization as a pile of ad hoc file conversions, `langcodec` gives you one CLI that works across common formats and workflows.
26+
## The Cool Stuff
27+
28+
### AI translation with real workflow support
29+
30+
```sh
31+
langcodec translate \
32+
--source Localizable.xcstrings \
33+
--source-lang en \
34+
--target-lang fr,de,ja \
35+
--provider openai \
36+
--model gpt-5.4
37+
```
38+
39+
`translate` is built for app catalogs, not just raw text:
40+
41+
- updates multi-language files like `.xcstrings` in place
42+
- supports multiple target languages in one run
43+
- can prefill from Tolgee before using AI fallback
44+
- shows live progress with `--ui auto|plain|tui`
45+
- validates output before model requests
46+
- prints a clear result summary at the end
47+
48+
### AI-generated translator comments
49+
50+
```sh
51+
langcodec annotate \
52+
--input Localizable.xcstrings \
53+
--source-root Sources \
54+
--source-root Modules \
55+
--provider openai \
56+
--model gpt-5.4
57+
```
58+
59+
`annotate` looks through your codebase and writes better `.xcstrings` comments for translators while preserving manual comments.
60+
61+
### Tolgee sync without a pile of project scripts
62+
63+
```sh
64+
langcodec tolgee pull
65+
langcodec tolgee push --namespace WebGame
66+
```
67+
68+
Tolgee support in v1 is intentionally focused on Apple `.xcstrings`. `langcodec.toml` can now be the source of truth, and `langcodec` will synthesize the Tolgee CLI JSON config at runtime.
2869

2970
## Install
3071

3172
```sh
3273
cargo install langcodec-cli
3374
```
3475

35-
## Start Here
76+
## Quick Start
3677

37-
The CLI should teach the detailed usage directly:
78+
Use the CLI help for exact flags:
3879

3980
```sh
4081
langcodec --help
41-
langcodec convert --help
4282
langcodec translate --help
4383
langcodec annotate --help
44-
langcodec view --help
84+
langcodec tolgee --help
4585
```
4686

47-
This README is intentionally brief. Use it to understand what the tool is good at, then use built-in help for exact flags and behavior.
48-
4987
## Core Workflows
5088

5189
### Convert between ecosystems
@@ -55,7 +93,7 @@ langcodec convert -i Localizable.xcstrings -o translations.csv
5593
langcodec convert -i translations.csv -o values/strings.xml
5694
```
5795

58-
### Find untranslated or review-needed strings
96+
### Find strings that still need work
5997

6098
```sh
6199
langcodec view -i Localizable.xcstrings --status new,needs_review --keys-only
@@ -82,48 +120,6 @@ langcodec sync --source source.xcstrings --target target.xcstrings --match-lang
82120
langcodec merge -i a.xcstrings -i b.xcstrings -o merged.xcstrings --strategy last
83121
```
84122

85-
### Draft translations with AI
86-
87-
```sh
88-
langcodec translate \
89-
--source Localizable.xcstrings \
90-
--source-lang en \
91-
--target-lang fr,de,ja \
92-
--provider openai \
93-
--model gpt-4.1-mini
94-
```
95-
96-
`translate` supports:
97-
98-
- in-place updates for multi-language files like `.xcstrings`
99-
- config defaults from `langcodec.toml`
100-
- multiple target languages for multi-language outputs
101-
- live progress updates
102-
- `--ui auto|plain|tui` for dashboard or plain terminal output
103-
- preflight validation before model requests
104-
- translation result summaries at the end
105-
106-
### Generate xcstrings comments with AI
107-
108-
```sh
109-
langcodec annotate \
110-
--input Localizable.xcstrings \
111-
--source-root Sources \
112-
--source-root Modules \
113-
--provider openai \
114-
--model gpt-4.1-mini
115-
```
116-
117-
`annotate` supports:
118-
119-
- filling missing xcstrings comments
120-
- refreshing existing auto-generated comments
121-
- preserving manual comments
122-
- config defaults from `langcodec.toml`
123-
- source shortlisting before agent lookup
124-
- `--ui auto|plain|tui` for dashboard or plain terminal output
125-
- `--dry-run` and `--check` for CI-friendly runs
126-
127123
## Example Config
128124

129125
```toml
@@ -132,6 +128,7 @@ model = "gpt-5.4"
132128

133129
[translate]
134130
concurrency = 4
131+
use_tolgee = true
135132

136133
[translate.input]
137134
source = "locales/Localizable.xcstrings"
@@ -142,6 +139,24 @@ status = ["new", "stale"]
142139
lang = ["fr", "de"]
143140
status = "translated"
144141

142+
[tolgee]
143+
project_id = 36
144+
api_url = "https://tolgee.example/api"
145+
api_key = "tgpak_example"
146+
namespaces = ["WebGame"]
147+
148+
[tolgee.push]
149+
languages = ["en"]
150+
force_mode = "KEEP"
151+
152+
[[tolgee.push.files]]
153+
path = "locales/Localizable.xcstrings"
154+
namespace = "WebGame"
155+
156+
[tolgee.pull]
157+
path = "./tolgee-temp"
158+
file_structure_template = "/{namespace}/Localizable.{extension}"
159+
145160
[annotate]
146161
input = "locales/Localizable.xcstrings"
147162
source_roots = ["Sources", "Modules"]
@@ -153,11 +168,15 @@ Then run:
153168
```sh
154169
langcodec translate
155170
langcodec annotate
171+
langcodec tolgee pull
156172
```
157173

158-
When exactly one provider section is configured, `translate` and `annotate` use it automatically. If you configure multiple providers, choose one with `--provider` or `translate.provider`. For larger repos, `translate.input.sources = [...]` can fan out parallel runs from config.
174+
When exactly one provider section is configured, `translate` and `annotate` use it automatically. If you configure multiple providers, choose one with `--provider` or `translate.provider`.
175+
176+
For larger repos:
159177

160-
For annotate fan-out runs, use `annotate.inputs = [...]` and omit `annotate.output` so each catalog is updated in place.
178+
- use `translate.input.sources = [...]` to fan out translation runs
179+
- use `annotate.inputs = [...]` to annotate multiple catalogs in place
161180

162181
## Main Commands
163182

@@ -170,17 +189,18 @@ For annotate fan-out runs, use `annotate.inputs = [...]` and omit `annotate.outp
170189
- `sync`: update existing target entries from a source file
171190
- `merge`: combine multiple inputs into one output
172191
- `translate`: draft translations with AI-backed providers
173-
- `annotate`: generate translator-facing xcstrings comments with AI-backed source lookup
192+
- `tolgee`: pull and push mapped `.xcstrings` catalogs with Tolgee
193+
- `annotate`: generate translator-facing `.xcstrings` comments with AI-backed source lookup
174194
- `debug`: inspect parsed output as JSON
175195

176-
## When It Fits Best
196+
## Best Fit
177197

178-
`langcodec` is especially useful if you are:
198+
`langcodec` shines when you are:
179199

180-
- maintaining both iOS and Android apps
181-
- passing strings through translators or spreadsheets
182-
- trying to reduce localization-related CI drift
183-
- replacing fragile custom scripts with one reusable tool
200+
- shipping both iOS and Android apps
201+
- moving strings through translators, spreadsheets, and app catalogs
202+
- trying to reduce localization drift in CI
203+
- replacing fragile one-off scripts with one repeatable tool
184204

185205
## Related Docs
186206

0 commit comments

Comments
 (0)