Skip to content

Text available for translation is out of sync with source code #1960

@victorlin

Description

@victorlin

Text available for translation can be defined by all translation entries in src/locales/en, and the diff-lang npm script is based on this concept. However, the contents of src/locales/en are out of sync with what's actually translatable, which is defined as all English strings that are passed through react-i18next's t() function.

Generally, I'd like to propose that all English text in the interface is passed through t() and has an entry in src/locales/en, which should have no unused entries.

These are 4 problem scenarios in the current code. I've added examples and specific actions based on the above proposal.

  1. Text is translated, but the English text is no longer in the source code.

    Examples: using data from, Num mutations, Branch leading to

    Action: update/remove these. Some are the result of the English text being reworded. In trivial cases such as Branch leading to which changed to Branch leading to {{tipLabel}}, the existing translations can still be used by doing a replacement similar to this find/replace. In other cases, a new entry should be added per (3) or (4), or if there is no longer any corresponding English text, the entry should be removed.

  2. Text is translated, but the English text is not passed through t().

    Example: Diversity

    Action: update the code to pass the English text through t() so that these translations are used.

  3. The English text is passed through t(), but text is not available for translation.

    Example: Clear {{filterName}} filter

    Action: add entries to src/locales/en.

  4. The English text is not passed through t() and text is not available for translation.

    Examples: Focus on selected, Jan/Feb/Mar/…

    Action: (2) + (3): update the code to pass the English text through t(), and add entries to src/locales/en.

I manually searched to find these, and my guess is there are more instances of each. It would be good to write a script to find these more easily and check regularly, as we are frequently updating English text in the interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions