Skip to content

Commit 15fc28e

Browse files
authored
mine package from markdown when loading tutorial (microsoft#6007)
* mine package from markdown when loading tutorial * fix other paths * updated translation page
1 parent ab0ed3b commit 15fc28e

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

common-docs/translate.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
Translations of text in the editor, in blocks, and documentation managed by [Crowdin](https://crowdin.com/project/kindscript), a translation management platform. It is free to join
44
and you can volunteer to translate parts of the web site. Translation into different languages is done by the work of people all over the world who volunteer to help MakeCode be accessible to as many people as possible.
55

6+
### ~ hint
7+
8+
Interested in how localization works in MakeCode? Watch this video for an overview of the process.
9+
10+
https://youtu.be/XpdUzpBVKFU
11+
12+
### ~
13+
14+
615
## #promo
716

817
## Localized MakeCode

webapp/src/app.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,7 +2983,12 @@ export class ProjectView
29832983
filename = pxtJson.name || lf("Untitled");
29842984
autoChooseBoard = false;
29852985
reportId = scriptId;
2986-
return files["README.md"];
2986+
const md = files["README.md"];
2987+
if (md) {
2988+
pxt.Util.jsonMergeFrom(dependencies, pxt.gallery.parsePackagesFromMarkdown(md));
2989+
features = pxt.gallery.parseFeaturesFromMarkdown(md);
2990+
}
2991+
return md;
29872992
}).catch((e) => {
29882993
core.errorNotification(tutorialErrorMessage);
29892994
core.handleNetworkError(e);
@@ -3021,9 +3026,11 @@ export class ProjectView
30213026
const md =
30223027
(lang && lang[1] && gh.files[`_locales/${lang[0]}-${lang[1]}/${mfn}`])
30233028
|| (lang && lang[0] && gh.files[`_locales/${lang[0]}/${mfn}`])
3024-
|| gh.files[mfn]
3025-
if (!md)
3026-
throw new Error(lf("Tutorial content not found"));
3029+
|| gh.files[mfn];
3030+
if (md) {
3031+
pxt.Util.jsonMergeFrom(dependencies, pxt.gallery.parsePackagesFromMarkdown(md));
3032+
features = pxt.gallery.parseFeaturesFromMarkdown(md);
3033+
}
30273034
return md;
30283035
}).catch((e) => {
30293036
core.errorNotification(tutorialErrorMessage);

0 commit comments

Comments
 (0)