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.
-
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.
-
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.
-
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.
-
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.
Text available for translation can be defined by all translation entries in
src/locales/en, and thediff-langnpm script is based on this concept. However, the contents ofsrc/locales/enare out of sync with what's actually translatable, which is defined as all English strings that are passed through react-i18next'st()function.Generally, I'd like to propose that all English text in the interface is passed through
t()and has an entry insrc/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.
Text is translated, but the English text is no longer in the source code.
Examples:
using data from,Num mutations,Branch leading toAction: update/remove these. Some are the result of the English text being reworded. In trivial cases such as
Branch leading towhich changed toBranch 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.Text is translated, but the English text is not passed through
t().Example:
DiversityAction: update the code to pass the English text through
t()so that these translations are used.The English text is passed through
t(), but text is not available for translation.Example:
Clear {{filterName}} filterAction: add entries to
src/locales/en.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 tosrc/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.