Hi everyone, Our plan for implementing Localization V2 considers 3 phases: Infrastructure, Migration & Cleaning This CL is part of the Cleaning phase, it's goal is to remove any non-standard usage of V1 APIs (outside of the devtools_ui_strings.grd) I'm splittling these changes into small pieces following this heuristic: - make sense when logically grouped. - keep them as small as possible - can be atomically reverted. I'll follow up with other changes removing usage on presubmit, scripts and build.gn files (if any). Bug: 1136655 Change-Id: I735dc8ba1045ed4afff7deb1a43cf02a7ab55865 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2733640 Commit-Queue: Vidal Diazleal <vidorteg@microsoft.com> Reviewed-by: Simon Zünd <szuend@chromium.org>
1.4 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 ...'
Phrases that are fully locked
Any text that is fully locked should not go into the UIStrings object. To make your intention clear
or to make TypeScript happy, there are two methods i18n.i18n.lockedString and i18n.i18n.lockedLazyString
that can be used instead of having fully locked phrases via i18nString.
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...