UNPKG

1.48 kBMarkdownView Raw
1## How to prevent a term being localized?
2
3Any text within the backticks will not be translated.
4For example, if the 'robots.txt' in string 'Requesting for robots.txt ...' should not be translated:
5
6```javascript
7// in example.js file
8
9import * as i18n from '../i18n/i18n.js';
10const UIStrings = {
11 /**
12 * @description Example description. Note: "robots.txt" is a canonical filename and should not be translated.
13 */
14 requestMessage: 'Requesting for `robots.txt` ...',
15};
16const str_ = i18n.i18n.registerUIStrings('example.js', UIStrings);
17
18const message = i18nString(UIStrings.requestMessage);
19```
20The string will rendered with robots.txt not translated and without the backticks around it
21```javascript
22 'Requesting for robots.txt ...'
23```
24
25### Phrases that are fully locked
26Any text that is fully locked should not go into the UIStrings object. To make your intention clear
27or to make TypeScript happy, there are two methods `i18n.i18n.lockedString` and `i18n.i18n.lockedLazyString`
28that can be used instead of having fully locked phrases via `i18nString`.
29
30## What should not be localized?
31In general, branding related terms and code snippets are the ones to look for, and Sometimes some technical terms. Some examples:
32
33**Brandings:**
34Lighthouse, GitHub, DevTools, Chrome Data Saver, Safari, BlackBerry Z30, Kindle Fire HDX, Pixel 2, Microsoft Lumia 550
35**Code snippets:**
36localhost:9229, console.clear(), --memlog=all, url:a.com
37**Technical terms:**
38DOM, DIV, aria...