Files
react-native-devtools-frontend/docs/localization/locked_terms_V2.md
T
vidorteg 6d2775c5ef Modifying scripts for i18nString localization call
Modifying some scripts that verify the shape of localization calls
to work with the i18nString shorthand:

const i18nString = i18.i18n.getLocalizedString.bind(undefined, str_);

Bug: 1136655
Change-Id: I09a961136dd89e8af11ab33f413f315e61184078
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2469903
Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Christy Chen <chrche@microsoft.com>
2020-10-14 21:12:22 +00:00

1.1 KiB

How to prevent a term being localized?

Any text within the backticks will not be translated. For example, if the 'robots.txt' in string 'Requesting for robots.txt ...' should not be translated:

// in example.js file

import * as i18n from '../i18n/i18n.js';
const UIStrings = {
  /**
   * @description Example description. Note: "robots.txt" is a canonical filename and should not be translated.
   */
  requestMessage: 'Requesting for `robots.txt` ...',
};
const str_ = i18n.i18n.registerUIStrings('example.js', UIStrings);

const message = i18nString(UIStrings.requestMessage);

The string will rendered with robots.txt not translated and without the backticks around it

  'Requesting for robots.txt ...'

What should not be localized?

In general, branding related terms and code snippets are the ones to look for, and Sometimes some technical terms. Some examples:

Brandings: Lighthouse, GitHub, DevTools, Chrome Data Saver, Safari, BlackBerry Z30, Kindle Fire HDX, Pixel 2, Microsoft Lumia 550 Code snippets: localhost:9229, console.clear(), --memlog=all, url:a.com Technical terms: DOM, DIV, aria...