-
-
Notifications
You must be signed in to change notification settings - Fork 677
Description
For user-facing text whose source code is in the code of a component, Label and friends give us a nice convenient way to pass the text through translation.
When the code is in a function elsewhere, we have this way of doing it:
const getString = value => this.context.intl.formatMessage({ id: value });
and then pass getString down the stack. We only do this in MessageList and its helpers, though -- everywhere else, we just don't translate. #1538 and #1539 cover two such areas.
This pattern is the right basic architecture, but it's wordy. The state we ought to get to is that basically every string in the source code that looks like it's meant for the user is clearly marked right there for translation. To do that, we'll be writing this a lot; we need to make it concise and low-noise.
This only needs two small changes:
- Change the name to
_. This is a traditional name that's been widely used for this since at least the '90s, and the backend uses it. - Put the handy wrapper (
getStringabove, now to be called_) directly oncontext.
A good followup will be the equivalent of #1538 and #1539 with this style, and then to sweep to find untranslated strings that remain.