Skip to content

Commit acc6a91

Browse files
Adopt @microbit/ui-patterns' LanguageDialog
Upgrade @microbit/ui to 0.1.0-alpha.25 and add @microbit/ui-patterns 0.1.0-alpha.2. The dialog becomes a thin wrapper over the shared pattern (flat grid, preview markers, deployment-sourced help-translate link); its hardcoded English preview footnote is finally a translated message. The ui upgrade also brings <html lang> tracking the language setting, via SharedUIProvider. First-run language now matches browser/OS preferences (after the ?l= hint) via the shared getDefaultLanguageId — previously only ?l= was honoured. Language ids take the registry's canonical BCP 47 casing (zh-CN, zh-TW, es-ES, ga-IE) and the KnownLanguageId union; stored settings and inbound ?l= links with the old lowercase ids keep working via case-insensitive reads, and the lowercase-keyed consumers (catalog imports, typeshed/pyright locale) normalise at their boundaries. Panda includes the package's sources, compile-lang merges its catalogs, and our help-translate string retires in its favour (`language` stays: the menu item).
1 parent 2dbc143 commit acc6a91

35 files changed

Lines changed: 917 additions & 312 deletions

bin/compile-lang.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ import { fileURLToPath } from "node:url";
2121
const require = createRequire(import.meta.url);
2222
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
2323
const formatjs = require.resolve("@formatjs/cli/bin/formatjs");
24-
const packageLangDirs = ["@microbit/ui"].map((name) => ({
25-
name,
26-
dir: path.dirname(require.resolve(`${name}/lang/ui.en.json`)),
27-
}));
24+
const packageLangDirs = ["@microbit/ui", "@microbit/ui-patterns"].map(
25+
(name) => ({
26+
name,
27+
dir: path.dirname(require.resolve(`${name}/lang/ui.en.json`)),
28+
})
29+
);
2830

2931
for (const file of fs.readdirSync(path.join(root, "lang")).sort()) {
3032
const inputs = [path.join(root, "lang", file)];

lang/ui.ca.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "Ajuda i suport",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "Ajuda a traduir",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "Ressaltar l'estructura del programa",
372368
"description": "Code structure setting label"

lang/ui.de.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "Hilfe & Support",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "Beim Übersetzen helfen",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "Codestruktur hervorheben",
372368
"description": "Code structure setting label"

lang/ui.en.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "Help & support",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "Help translate",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "Highlight code structure",
372368
"description": "Code structure setting label"

lang/ui.es-es.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "Ayuda y asistencia",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "Ayudar a traducir",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "Resaltar la estructura del código",
372368
"description": "Code structure setting label"

lang/ui.fr.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "Aide et support",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "Contribuer à la traduction",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "Surligner la structure du code",
372368
"description": "Code structure setting label"

lang/ui.ga-ie.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "Cabhair & tacaíocht",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "Cabhair a aistriú",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "Aibhsigh struchtúr an chóid",
372368
"description": "Code structure setting label"

lang/ui.ja.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "ヘルプとサポート",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "翻訳を手伝う",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "コード構造を強調表示",
372368
"description": "Code structure setting label"

lang/ui.ko.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "도움말 및 지원",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "번역 지원",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "코드 구조 하이라이트",
372368
"description": "Code structure setting label"

lang/ui.lol.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,6 @@
363363
"defaultMessage": "crwdns331530:0crwdne331530:0",
364364
"description": "Menu item for link to support site"
365365
},
366-
"help-translate": {
367-
"defaultMessage": "crwdns331532:0crwdne331532:0",
368-
"description": "Help translate menu option text"
369-
},
370366
"highlight-code-structure": {
371367
"defaultMessage": "crwdns331534:0crwdne331534:0",
372368
"description": "Code structure setting label"

0 commit comments

Comments
 (0)