Skip to content

Commit cafec0a

Browse files
committed
feat(split): Add localized value names
We need to add the "string" feature for the `IntoResettable<>` trait to support dynamic values like `String`.
1 parent dbfdc0f commit cafec0a

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ chrono = { version = "0.4.41", default-features = false, features = [
310310
"alloc",
311311
"clock",
312312
] }
313-
clap = { version = "4.5", features = ["wrap_help", "cargo", "color"] }
313+
clap = { version = "4.5", features = ["wrap_help", "cargo", "color", "string"] }
314314
clap_complete = "4.4"
315315
clap_mangen = "0.2"
316316
compare = "0.1.0"

src/uu/split/locales/en-US.ftl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ split-after-help = Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...;
1515
- r/N like 'l' but use round robin distribution
1616
- r/K/N likewise but only output Kth of N to stdout
1717
18+
# Variable names
19+
split-var-name-size = SIZE
20+
split-var-name-number = NUMBER
21+
split-var-name-chunks = CHUNKS
22+
split-var-name-suffix = SUFFIX
23+
split-var-name-command = COMMAND
24+
split-var-name-from = FROM
25+
split-var-name-sep = SEP
26+
split-var-name-input = INPUT
27+
split-var-name-prefix = PREFIX
28+
1829
# Error messages
1930
split-error-suffix-not-parsable = invalid suffix length: { $value }
2031
split-error-suffix-contains-separator = invalid suffix { $value }, contains directory separator

src/uu/split/locales/fr-FR.ftl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ split-after-help = Sortir des morceaux de taille fixe d'ENTRÉE vers PREFIXEaa,
1515
- r/N comme 'l' mais utiliser la distribution round robin
1616
- r/K/N pareillement mais ne sortir que le Kème de N vers stdout
1717
18+
# Noms des variables
19+
split-var-name-size = TAILLE
20+
split-var-name-number = NOMBRE
21+
split-var-name-chunks = BLOCS
22+
split-var-name-suffix = SUFFIXE
23+
split-var-name-command = COMMANDE
24+
split-var-name-from = DEPART
25+
split-var-name-sep = SEP
26+
split-var-name-input = ENTREE
27+
split-var-name-prefix = PREFIXE
28+
1829
# Messages d'erreur
1930
split-error-suffix-not-parsable = longueur de suffixe invalide : { $value }
2031
split-error-suffix-contains-separator = suffixe invalide { $value }, contient un séparateur de répertoire

src/uu/split/src/split.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,23 +238,23 @@ pub fn uu_app() -> Command {
238238
.short('b')
239239
.long(OPT_BYTES)
240240
.allow_hyphen_values(true)
241-
.value_name("SIZE")
241+
.value_name(translate!("split-var-name-size"))
242242
.help(translate!("split-help-bytes")),
243243
)
244244
.arg(
245245
Arg::new(OPT_LINE_BYTES)
246246
.short('C')
247247
.long(OPT_LINE_BYTES)
248248
.allow_hyphen_values(true)
249-
.value_name("SIZE")
249+
.value_name(translate!("split-var-name-size"))
250250
.help(translate!("split-help-line-bytes")),
251251
)
252252
.arg(
253253
Arg::new(OPT_LINES)
254254
.short('l')
255255
.long(OPT_LINES)
256256
.allow_hyphen_values(true)
257-
.value_name("NUMBER")
257+
.value_name(translate!("split-var-name-number"))
258258
.default_value("1000")
259259
.help_with_localized_default(translate!("split-help-lines")),
260260
)
@@ -263,15 +263,15 @@ pub fn uu_app() -> Command {
263263
.short('n')
264264
.long(OPT_NUMBER)
265265
.allow_hyphen_values(true)
266-
.value_name("CHUNKS")
266+
.value_name(translate!("split-var-name-chunks"))
267267
.help(translate!("split-help-number")),
268268
)
269269
// rest of the arguments
270270
.arg(
271271
Arg::new(OPT_ADDITIONAL_SUFFIX)
272272
.long(OPT_ADDITIONAL_SUFFIX)
273273
.allow_hyphen_values(true)
274-
.value_name("SUFFIX")
274+
.value_name(translate!("split-var-name-suffix"))
275275
.default_value("")
276276
.value_parser(clap::value_parser!(OsString))
277277
.help_with_localized_default(translate!("split-help-additional-suffix")),
@@ -280,7 +280,7 @@ pub fn uu_app() -> Command {
280280
Arg::new(OPT_FILTER)
281281
.long(OPT_FILTER)
282282
.allow_hyphen_values(true)
283-
.value_name("COMMAND")
283+
.value_name(translate!("split-var-name-command"))
284284
.value_hint(ValueHint::CommandName)
285285
.help(translate!("split-help-filter")),
286286
)
@@ -314,7 +314,7 @@ pub fn uu_app() -> Command {
314314
OPT_HEX_SUFFIXES,
315315
OPT_HEX_SUFFIXES_SHORT,
316316
])
317-
.value_name("FROM")
317+
.value_name(translate!("split-var-name-from"))
318318
.help(translate!("split-help-numeric-suffixes")),
319319
)
320320
.arg(
@@ -340,7 +340,7 @@ pub fn uu_app() -> Command {
340340
OPT_HEX_SUFFIXES,
341341
OPT_HEX_SUFFIXES_SHORT,
342342
])
343-
.value_name("FROM")
343+
.value_name(translate!("split-var-name-from"))
344344
.help(translate!("split-help-hex-suffixes")),
345345
)
346346
.arg(
@@ -362,7 +362,7 @@ pub fn uu_app() -> Command {
362362
.short('t')
363363
.long(OPT_SEPARATOR)
364364
.allow_hyphen_values(true)
365-
.value_name("SEP")
365+
.value_name(translate!("split-var-name-sep"))
366366
.action(ArgAction::Append)
367367
.help(translate!("split-help-separator")),
368368
)
@@ -377,12 +377,14 @@ pub fn uu_app() -> Command {
377377
.default_value("-")
378378
.value_hint(ValueHint::FilePath)
379379
.value_parser(clap::value_parser!(OsString))
380+
.value_name(translate!("split-var-name-input"))
380381
.help_with_localized_default(""),
381382
)
382383
.arg(
383384
Arg::new(ARG_PREFIX)
384385
.default_value("x")
385386
.value_parser(clap::value_parser!(OsString))
387+
.value_name(translate!("split-var-name-prefix"))
386388
.help_with_localized_default(""),
387389
)
388390
.localized_help_and_version()

0 commit comments

Comments
 (0)