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