uutils / uutils/coreutils

l10n: command arguments value name is not localized

Open
#9,118 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

J - Locale
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

I'm new to localization so I tried weblate. When i was improving the translation for "split", I noticed that english value names were mixed with translated value names in the documentation.
For example :

-l, --lines <NUMBER>              mettre NOMBRE lignes/enregistrements par fichier de sortie [default: 1000]
-n, --number <CHUNKS>             générer CHUNKS fichiers de sortie ; voir l'explication ci-dessous

After looking around in the source code the culprit seems to be the Arg::value_name() function.
For example, in uu/split/src/split.rs :

pub fn uu_app() -> Command {
  Command::new(uucore::util_name())
    [...]
    .arg(
      Arg::new(OPT_LINES)
        .short('l')
        .long(OPT_LINES)
        .allow_hyphen_values(true)
        .value_name("NUMBER")
        .default_value("1000")
        .help(translate!("split-help-lines")),
    )
    [...]
}

There is two ways to deal with that :

  1. If it's voluntary, then it's necessary to write some specification so that the localization does not switch between two languages too much. Does the value name must stay in english or they can be translated while the value name stays in english as usage.
  2. Change every value_name() call to something like that
.value_name(translate!("split-help-lines-value-name"))

and update the english locale accordingly.

I would gladly take care of this task but I just need to better understand the code (i'm new to l10n) so i'm not confident if replacing the value name strings with translate!() and updating the en-US.flt files is sufficient/works.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Arg::value_name() and the example in uu/split/src/split.rs, then inspect the translate! usage and the en-US.flt files. Establish whether value names should remain in English or be localized, then update the affected value_name() calls and English locale entries consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.