Skip to content

Commit

Permalink
Test new block help localization
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed Dec 9, 2024
1 parent 62ab8f9 commit 3bafedc
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 2 deletions.
7 changes: 7 additions & 0 deletions _locales/fr/machine-learning-jsdoc-strings.json
Original file line number Diff line number Diff line change
@@ -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."
}
13 changes: 13 additions & 0 deletions _locales/fr/machine-learning-strings.json
Original file line number Diff line number Diff line change
@@ -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)"
}
30 changes: 30 additions & 0 deletions docs/_locales/fr/on-ml-start.md
Original file line number Diff line number Diff line change
@@ -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
```
28 changes: 28 additions & 0 deletions docs/on-ml-start.md
Original file line number Diff line number Diff line change
@@ -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
```
6 changes: 5 additions & 1 deletion pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pxtextension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down

0 comments on commit 3bafedc

Please sign in to comment.