API / core/browseruitext
core/browseruitext
브라우저 화면 글. (원본 core/browseruitext.js 와 같은 표와 같은 로케일 고르기)
- 브라우저가 페이지 위에 그리던 것(자바스크립트 질문 창의 제목과 단추, 편집 칸 문맥 메뉴와 터치 빠른 메뉴의 항목)의 글이다. 두 엔진 모두, 웹과 데스크탑 모두 엔진이 그것을 그리므로 같은 글이 필요하다. (core/modaldialog.rs, ui/uiinputfield.rs, ui/uiinputfieldmenu.rs)
- 글은 크로미엄의 번역(chrome/app/resources/generated_resources_*.xtb, ui/strings/translations/ui_strings_*.xtb, components/strings/components_strings_*.xtb)을 grit 의 메시지 번호로 찾아 화면 꼴로 옮긴 표다. (browseruitext.json, 데스크탑 로케일 82 개) 크롬 Views 메뉴는 단축 글자 표시 "(&U)" 와 "&" 를 지워 그리고(gfx RemoveAcceleratorChar), 맥은 FixUpWindowsStyleLabel 로 지운다. 표는 지운 글이다.
- 크롬은 제 화면 언어로 그린다. 그 자리인 선호 언어(데스크탑은 시스템 선호 언어 sys-locale, 웹은 원본처럼 navigator.languages) 차례에서 크롬 규칙으로 로케일을 고른다. (l10n_util 의 GetApplicationLocale 과 language_tag_matcher: 같은 이름이 있으면 그것, es-* 는 es-419, pt 는 pt-BR, zh 는 zh-CN, zh-Hant 는 zh-TW, en 과 en-PH, en-LR 은 en-US, en-CA 와 그 밖의 en-* 는 en-GB, 옛 이름 iw, no, tl, in 은 he, nb, fil, id. 맞는 것이 없으면 en-US) zh-MO 는 CLDR 의 부모 로케일 zh-Hant-HK 를 따라 zh-HK, zh-SG 는 zh-CN 으로 본다. (크롬의 ICU4X 데이터로 돌려 보지는 않았다)
Browser UI text. (the same table and the same locale selection as the original core/browseruitext.js)
- Text for what the browser used to draw over the page (the title and buttons of JavaScript question dialogs, the items of the edit field context menu and the touch quick menu). In both engines, on the web and the desktop alike, the engine draws these, so it needs the same text. (core/modaldialog.rs, ui/uiinputfield.rs, ui/uiinputfieldmenu.rs)
- The text is a table made by looking up Chromium's translations (chrome/app/resources/generated_resources_*.xtb, ui/strings/translations/ui_strings_*.xtb, components/strings/components_strings_*.xtb) by grit message ID and converting them to their on-screen form. (browseruitext.json, 82 desktop locales) Chrome's Views menus draw with the accelerator markers "(&U)" and "&" removed (gfx RemoveAcceleratorChar), and Mac removes them with FixUpWindowsStyleLabel. The table holds the text with them removed.
- Chrome draws in its own UI language. Standing in for it, the locale is picked with Chrome's rules from the preferred languages in order (on the desktop the system preferred languages via sys-locale, on the web navigator.languages like the original). (l10n_util's GetApplicationLocale and language_tag_matcher: the same name if present, es-* is es-419, pt is pt-BR, zh is zh-CN, zh-Hant is zh-TW, en, en-PH and en-LR are en-US, en-CA and other en-* are en-GB, the old names iw, no, tl, in are he, nb, fil, id. en-US if nothing matches) zh-MO is treated as zh-HK following CLDR's parent locale zh-Hant-HK, and zh-SG as zh-CN. (not verified by running Chrome's ICU4X data)
예제Example질문 창 단추 글과 고른 로케일 읽기 (데스크탑)Read question dialog button text and the chosen locale (desktop)
use vanilla::core::browseruitext::{read_browser_ui_locale, read_browser_ui_text, BrowserUiText};
let ok_text = read_browser_ui_text(BrowserUiText::Ok);
let cancel_text = read_browser_ui_text(BrowserUiText::Cancel);
assert!(!ok_text.is_empty());
assert!(!cancel_text.is_empty());
assert!(!read_browser_ui_locale().is_empty());함수Functions
브라우저 화면 글. (고른 로케일, 그 로케일에 없으면 en-US)
- 표는 스레드마다 처음 부를 때 읽고, 그때 시스템 선호 언어로 로케일을 고른다.
Browser UI text. (the chosen locale, en-US if missing in that locale)
- The table is read on the first call per thread, and the locale is chosen then by the system preferred languages.
- textBrowserUiText
- 읽을 글 종류.Kind of text to read.
반환ReturnsString 그 로케일의 글. (en-US 에도 없으면 빈 글)Text in that locale. (empty string if missing in en-US too)
고른 로케일.
Chosen locale.
반환ReturnsString 표에서 고른 로케일 이름. (ko, en-US, zh-TW 같은 것, 맞는 것이 없었으면 en-US)Name of the locale chosen from the table. (such as ko, en-US, zh-TW, en-US if nothing matched)
BrowserUiTextenum traits Clone, Copy, Debug, PartialEq, Eq
글 종류. (표의 키)
Text kind. (the table key)
| 이름Name | 설명Description |
|---|---|
Undo | 실행 취소.Undo. |
Redo | 다시 실행.Redo. |
Cut | 잘라내기.Cut. |
Copy | 복사.Copy. |
Paste | 붙여넣기. (윈도우, 리눅스)Paste. (Windows, Linux) |
PasteMac | 붙여넣기. (맥, 번역이 다를 수 있다)Paste. (Mac, the translation may differ) |
PastePlainText | 일반 텍스트로 붙여넣기. (윈도우, 리눅스)Paste as plain text. (Windows, Linux) |
PasteMatchStyle | 붙여넣고 스타일 일치시킴. (맥)Paste and Match Style. (Mac) |
SelectAll | 전체 선택. (윈도우, 리눅스)Select all. (Windows, Linux) |
SelectAllMac | 모두 선택. (맥)Select All. (Mac) |
Emoji | 그림 이모티콘. (윈도우)Emoji. (Windows) |
EmojiMac | 그림 이모티콘 및 기호. (맥)Emoji & Symbols. (Mac) |
WritingDirection | 쓰기 방향 하위 메뉴.Writing Direction submenu. |
WritingDirectionDefault | 쓰기 방향 기본값.Writing direction default. |
WritingDirectionLeftToRight | 왼쪽에서 오른쪽으로.Left to Right. |
WritingDirectionRightToLeft | 오른쪽에서 왼쪽으로.Right to Left. |
Inspect | 검사.Inspect. |
PageSays | 질문 창 제목. (출처가 없는 페이지의 "이 페이지 내용:")Question dialog title. ("This page says" for pages without an origin) |
Ok | 확인.OK. |
Cancel | 취소.Cancel. |
PeriodKey | 단축키 글의 마침표 키 이름.Name of the period key in shortcut text. |
WindowsKey | 단축키 글의 윈도우 키 이름.Name of the Windows key in shortcut text. |
TouchCut | 터치 빠른 메뉴의 잘라내기, 복사, 붙여넣기. (ui_strings 의 IDS_APP_CUT, IDS_APP_COPY, IDS_APP_PASTE)Cut, copy and paste in the touch quick menu. (IDS_APP_CUT, IDS_APP_COPY, IDS_APP_PASTE in ui_strings) |
TouchCopy | 터치 빠른 메뉴의 복사. (IDS_APP_COPY)Copy in the touch quick menu. (IDS_APP_COPY) |
TouchPaste | 터치 빠른 메뉴의 붙여넣기. (IDS_APP_PASTE)Paste in the touch quick menu. (IDS_APP_PASTE) |