You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`translate` still accepts legacy `translate.provider` and `translate.model` if you have older config files. For larger projects, `translate.sources = [...]` can fan out parallel runs from config.
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 projects, `translate.input.sources = [...]` can fan out parallel runs from config.
155
159
156
160
`annotate` also supports `annotate.inputs = [...]` for config-driven in-place runs across multiple xcstrings files.
Copy file name to clipboardExpand all lines: langcodec-cli/README.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,7 @@ langcodec translate \
99
99
- config defaults from `langcodec.toml`
100
100
- multiple target languages for multi-language outputs
101
101
- live progress updates
102
+
-`--ui auto|plain|tui` for dashboard or plain terminal output
102
103
- preflight validation before model requests
103
104
- translation result summaries at the end
104
105
@@ -120,21 +121,26 @@ langcodec annotate \
120
121
- preserving manual comments
121
122
- config defaults from `langcodec.toml`
122
123
- source shortlisting before agent lookup
124
+
-`--ui auto|plain|tui` for dashboard or plain terminal output
123
125
-`--dry-run` and `--check` for CI-friendly runs
124
126
125
127
## Example Config
126
128
127
129
```toml
128
-
[ai]
129
-
provider = "openai"
130
-
model = "gpt-4.1-mini"
130
+
[openai]
131
+
model = "gpt-5.4"
131
132
132
133
[translate]
134
+
concurrency = 4
135
+
136
+
[translate.input]
133
137
source = "locales/Localizable.xcstrings"
134
-
source_lang = "en"
135
-
target_lang = "fr,de"
138
+
lang = "en"
136
139
status = ["new", "stale"]
137
-
concurrency = 4
140
+
141
+
[translate.output]
142
+
lang = ["fr", "de"]
143
+
status = "translated"
138
144
139
145
[annotate]
140
146
input = "locales/Localizable.xcstrings"
@@ -149,7 +155,7 @@ langcodec translate
149
155
langcodec annotate
150
156
```
151
157
152
-
Legacy configs using `translate.provider` and `translate.model` still work. For larger repos, `translate.sources = [...]` can fan out parallel runs from config.
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.
153
159
154
160
For annotate fan-out runs, use `annotate.inputs = [...]` and omit `annotate.output` so each catalog is updated in place.
"--provider is required (or set ai.provider in langcodec.toml, or use legacy translate.provider, or configure exactly one provider API key)"
99
+
"--provider is required (or configure exactly one provider section like [openai] in langcodec.toml, set translate.provider, or configure exactly one provider API key)"
89
100
.to_string(),
90
101
),
91
102
_ => Err(
92
-
"Multiple provider API keys are configured; specify --provider or set ai.provider in langcodec.toml"
103
+
"Multiple provider API keys are configured; specify --provider or configure a single provider section in langcodec.toml"
93
104
.to_string(),
94
105
),
95
106
}
96
107
}
97
108
98
109
pub(crate)fnresolve_model(
99
110
cli:Option<&str>,
100
-
shared_cfg:Option<&str>,
101
-
legacy_cfg:Option<&str>,
111
+
config:Option<&CliConfig>,
112
+
provider:&ProviderKind,
113
+
translate_cfg:Option<&str>,
102
114
) -> Result<String,String>{
103
115
cli.map(ToOwned::to_owned)
104
-
.or_else(|| shared_cfg.map(ToOwned::to_owned))
105
-
.or_else(|| legacy_cfg.map(ToOwned::to_owned))
116
+
.or_else(|| {
117
+
config.and_then(|cfg| {
118
+
cfg.provider_model(provider.display_name())
119
+
.map(ToOwned::to_owned)
120
+
})
121
+
})
122
+
.or_else(|| translate_cfg.map(ToOwned::to_owned))
106
123
.or_else(|| std::env::var("MENTRA_MODEL").ok())
107
124
.ok_or_else(|| {
108
-
"--model is required (or set ai.model in langcodec.toml, or use legacy translate.model, or set MENTRA_MODEL)"
109
-
.to_string()
125
+
format!(
126
+
"--model is required (or set [{}].model in langcodec.toml, set translate.model, or set MENTRA_MODEL)",
0 commit comments