Skip to content

Commit 39467d5

Browse files
committed
docs: add langcodec config example
1 parent 9bb2119 commit 39467d5

3 files changed

Lines changed: 63 additions & 0 deletions

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,23 @@ This is a `0.9.1` release available on [crates.io](https://crates.io/crates/lang
105105
- Strict status filtering note: `langcodec --strict view --status ...` requires explicit status metadata (supported in v1: `.xcstrings`).
106106
- Translate defaults to `new,stale`, writes `needs_review`, skips plurals, and supports `langcodec.toml` for translate-specific defaults.
107107

108+
#### Example `langcodec.toml`
109+
110+
Save this as `langcodec.toml` in your project root, or point to it with `--config`.
111+
The CLI discovers `langcodec.toml` by searching the current directory and then parent directories.
112+
113+
```toml
114+
[translate]
115+
provider = "openai"
116+
model = "gpt-4.1-mini"
117+
source_lang = "en"
118+
target_lang = "fr"
119+
concurrency = 4
120+
status = ["new", "stale"]
121+
```
122+
123+
There is also a commented example file at `langcodec.toml.example` in the repository root.
124+
108125
#### Plurals
109126

110127
- Android `<plurals>` are fully supported. They convert to the internal `Translation::Plural` representation and back to `<plurals>` with quantities `zero/one/two/few/many/other`.

langcodec-cli/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,24 @@ Behavior:
109109
- writes in-place by default and supports `--dry-run`
110110
- supports translate defaults from `langcodec.toml`
111111

112+
Example `langcodec.toml`:
113+
114+
```toml
115+
[translate]
116+
provider = "openai"
117+
model = "gpt-4.1-mini"
118+
source_lang = "en"
119+
target_lang = "fr"
120+
concurrency = 4
121+
status = ["new", "stale"]
122+
```
123+
124+
Config notes:
125+
126+
- save the file as `langcodec.toml` in your project root, or pass `--config /absolute/path/to/langcodec.toml`
127+
- config discovery walks upward from the current directory until it finds `langcodec.toml`
128+
- CLI flags still override config values
129+
112130
Provider/auth notes:
113131

114132
- choose a Mentra provider with `--provider` (`openai|anthropic|gemini`) or `translate.provider` in config

langcodec.toml.example

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Example langcodec.toml
2+
#
3+
# langcodec looks for this file in the current directory and then walks up
4+
# parent directories until it finds one. You can also pass an explicit path:
5+
# langcodec translate --config /absolute/path/to/langcodec.toml
6+
#
7+
# Today, config file support is used by the `translate` command.
8+
9+
[translate]
10+
# Required unless you pass --provider.
11+
# Supported values: openai, anthropic, gemini
12+
provider = "openai"
13+
14+
# Required unless you pass --model or set MENTRA_MODEL.
15+
model = "gpt-4.1-mini"
16+
17+
# Optional, but useful when the source contains multiple languages.
18+
source_lang = "en"
19+
20+
# Required unless you pass --target-lang.
21+
target_lang = "fr"
22+
23+
# Optional. Defaults to 4.
24+
concurrency = 4
25+
26+
# Optional. Defaults to ["new", "stale"].
27+
# Only target entries with one of these statuses will be translated.
28+
status = ["new", "stale"]

0 commit comments

Comments
 (0)