From 3bafedc841d92760f87c122f4b067b179abad445 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Mon, 9 Dec 2024 12:53:26 +0000 Subject: [PATCH] Test new block help localization --- .../fr/machine-learning-jsdoc-strings.json | 7 +++++ _locales/fr/machine-learning-strings.json | 13 ++++++++ docs/_locales/fr/on-ml-start.md | 30 +++++++++++++++++++ docs/on-ml-start.md | 28 +++++++++++++++++ pxt.json | 6 +++- pxtextension.ts | 2 +- 6 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 _locales/fr/machine-learning-jsdoc-strings.json create mode 100644 _locales/fr/machine-learning-strings.json create mode 100644 docs/_locales/fr/on-ml-start.md create mode 100644 docs/on-ml-start.md diff --git a/_locales/fr/machine-learning-jsdoc-strings.json b/_locales/fr/machine-learning-jsdoc-strings.json new file mode 100644 index 0000000..1a5079c --- /dev/null +++ b/_locales/fr/machine-learning-jsdoc-strings.json @@ -0,0 +1,7 @@ +{ + "mlrunner.customOnEvent": "FR - Register a TypeScript function to run when an event is raised.\n* This custom version of the MakeCode onEvent function is needed due to:\nhttps://github.com/microsoft/pxt-microbit/issues/5709\n*", + "mlrunner.customOnEvent|param|flags": "FR - The specified event flags are ignored and configured via pxt.json.", + "mlrunner.customOnEvent|param|handler": "FR - The function to call when the event is detected.", + "mlrunner.customOnEvent|param|src": "FR - The ID of the component to listen to.", + "mlrunner.customOnEvent|param|value": "FR - The event value to listen to from that component." +} \ No newline at end of file diff --git a/_locales/fr/machine-learning-strings.json b/_locales/fr/machine-learning-strings.json new file mode 100644 index 0000000..33cdaf8 --- /dev/null +++ b/_locales/fr/machine-learning-strings.json @@ -0,0 +1,13 @@ +{ + "ml.event.Unknown|block": "FR - unknown", + "ml.getCertainty|block": "FR - certainty (\\%) ML $event", + "ml.isDetected|block": "FR - is ML $event detected", + "ml.onStart|block": "FR - on ML $event start", + "ml.onStopDetailed|block": "FR - on ML $event stop $duration (ms)", + "ml.onStop|block": "FR - on ML $event stop", + "mlrunner|block": "FR - mlrunner", + "{id:category}Ml": "FR - Ml", + "{id:category}MlEvent": "FR - MlEvent", + "{id:category}Mlrunner": "FR - Mlrunner", + "{id:group}micro:bit (V2)": "FR - micro:bit (V2)" +} diff --git a/docs/_locales/fr/on-ml-start.md b/docs/_locales/fr/on-ml-start.md new file mode 100644 index 0000000..dabde4a --- /dev/null +++ b/docs/_locales/fr/on-ml-start.md @@ -0,0 +1,30 @@ +# file read + +FR + +Reads the contents of a file from the file system + +```sig +files.read("/path/to/file.txt", "UTF-8") +``` + +## Parameters + +* **path**: a string that contains the path to the file on disk +* **encoding**: the encoding of the file to be read + +## Example + +This example reads from a file on disk and prints the contents to the console. + +```blocks +const contents = files.read("/path/to/file.txt", "UTF-8"); +console.log(contents) +``` + +## See also +* [write file](./write-file) + +```package +my-custom-extension=github:username/extension-repo +``` \ No newline at end of file diff --git a/docs/on-ml-start.md b/docs/on-ml-start.md new file mode 100644 index 0000000..ba80a29 --- /dev/null +++ b/docs/on-ml-start.md @@ -0,0 +1,28 @@ +# file read + +Reads the contents of a file from the file system + +```sig +files.read("/path/to/file.txt", "UTF-8") +``` + +## Parameters + +* **path**: a string that contains the path to the file on disk +* **encoding**: the encoding of the file to be read + +## Example + +This example reads from a file on disk and prints the contents to the console. + +```blocks +const contents = files.read("/path/to/file.txt", "UTF-8"); +console.log(contents) +``` + +## See also +* [write file](./write-file) + +```package +my-custom-extension=github:username/extension-repo +``` \ No newline at end of file diff --git a/pxt.json b/pxt.json index a7d51a1..831a400 100644 --- a/pxt.json +++ b/pxt.json @@ -11,7 +11,11 @@ "shims.d.ts", "enums.d.ts", "pxtextension.ts", - "pxtextension.cpp" + "pxtextension.cpp", + "docs/on-ml-start.md", + "docs/_locales/fr/on-ml-start.md", + "_locales/fr/machine-learning-jsdoc-strings.json", + "_locales/fr/machine-learning-strings.json" ], "testFiles": [ "autogenerated.ts", diff --git a/pxtextension.ts b/pxtextension.ts index 1fa1ee0..6bbb0f0 100644 --- a/pxtextension.ts +++ b/pxtextension.ts @@ -56,7 +56,7 @@ namespace ml { //% weight=50 //% parts="v2" //% group="micro:bit (V2)" - //% help=none + //% help=github:machine-learning/docs/on-ml-start export function onStart(event: MlEvent, body: () => void): void { event.onStartHandler = body; const wrappedBody = () => {