integrations keyed, and the Google guide's foreign labels marked (163 -> 96)
Applies the rule added to docs/localization.md in 91b9bec9: a label quoted from
another product's interface is an identifier, so the prose around it is translated
and the label itself is left in English and NOT keyed.
Gives that decision a name in the code. <Untranslated reason="foreign-ui-label">
states it at each of the ~30 call sites, where whoever next edits the sentence will
see it, and gives the scanner something exact to skip -- without which labels that
MUST stay English count as debt forever and the area can never be held at zero. That
is the same trap as counting new Error() messages. `reason` is a closed union so a
second excuse has to be argued for rather than smuggled in as free text.
The sentences needed rephrasing, not just splitting. "Go to the [New Project] page."
decomposes into "Go to the" + link + "page." -- and the Portuguese value of that
second key is "." A key that holds a full stop is the fragmentation smell, so the
English now puts the label at a clause boundary ("Open the project creation page:"
then the link), which reads naturally in both languages and needs no node-level
interpolation. Worth knowing for phase 3: sentences with an inline link are the one
shape this catalog format cannot express, and rephrasing is the cheap way out.
Scanner: the existing SCREAMING_CONSTANT rule now allows . and - so Google's
client-secret prefix example GOCSPX-... falls under it. Same rule, wider class.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
type UntranslatedProps = {
|
||||
children: ReactNode;
|
||||
/** Why this text is not localized. Required so the decision is legible at the call site. */
|
||||
reason: 'foreign-ui-label';
|
||||
className?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Text that is deliberately NOT localized, marked as such where it is written.
|
||||
*
|
||||
* The only reason so far is `foreign-ui-label`: a label quoted from another product's interface, which
|
||||
* docs/localization.md classifies as an identifier rather than prose. "Click **Enable**" has to match
|
||||
* what the reader sees on Google's screen, and Google localises by their Google account language rather
|
||||
* than by ours — so translating it sends somebody hunting for "Ativar" in a console that says "Enable".
|
||||
*
|
||||
* It exists as a component rather than a comment for two reasons. It states the decision at every call
|
||||
* site, where the next person editing the sentence will see it. And it gives the scanner something exact
|
||||
* to skip: without that, ~40 labels that MUST stay English count as debt forever, and the area can never
|
||||
* be held at zero — the same trap as counting `new Error()` messages.
|
||||
*
|
||||
* `reason` is a closed union on purpose. A second legitimate reason should be argued for and added here,
|
||||
* not smuggled in as free text.
|
||||
*/
|
||||
export const Untranslated = ({ children, className }: UntranslatedProps) => (
|
||||
<strong className={className}>{children}</strong>
|
||||
);
|
||||
Reference in New Issue
Block a user