Skip to content

Commit

Permalink
Switch to Spanish. Attempt real documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed Dec 9, 2024
1 parent 42dee0a commit bb1ff21
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 35 deletions.
7 changes: 7 additions & 0 deletions _locales/es/machine-learning-jsdoc-strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"mlrunner.customOnEvent": "ES - 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": "ES - The specified event flags are ignored and configured via pxt.json.",
"mlrunner.customOnEvent|param|handler": "ES - The function to call when the event is detected.",
"mlrunner.customOnEvent|param|src": "ES - The ID of the component to listen to.",
"mlrunner.customOnEvent|param|value": "ES - The event value to listen to from that component."
}
13 changes: 13 additions & 0 deletions _locales/es/machine-learning-strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"ml.event.Unknown|block": "ES - unknown",
"ml.getCertainty|block": "ES - certainty (\\%) ML $event",
"ml.isDetected|block": "ES - is ML $event detected",
"ml.onStart|block": "ES - on ML $event start",
"ml.onStopDetailed|block": "ES - on ML $event stop $duration (ms)",
"ml.onStop|block": "ES - on ML $event stop",
"mlrunner|block": "ES - mlrunner",
"{id:category}Ml": "ES - Ml",
"{id:category}MlEvent": "ES - MlEvent",
"{id:category}Mlrunner": "ES - Mlrunner",
"{id:group}micro:bit (V2)": "ES - micro:bit (V2)"
}
7 changes: 0 additions & 7 deletions _locales/fr/machine-learning-jsdoc-strings.json

This file was deleted.

13 changes: 0 additions & 13 deletions _locales/fr/machine-learning-strings.json

This file was deleted.

1 change: 1 addition & 0 deletions docs/_locales/es/on-ml-start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# this is in Spanish!
1 change: 0 additions & 1 deletion docs/_locales/fr/on-ml-start.md

This file was deleted.

23 changes: 12 additions & 11 deletions docs/on-ml-start.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
# file read
# on ML start

Reads the contents of a file from the file system
Start an [event handler](https://makecode.microbit.org/---docs#doc:reference/event-handler) (part of the program that will run when something happens) This handler works when when the ML model’s estimated action changes to the action you select.

```sig
files.read("/path/to/file.txt", "UTF-8")
ml.onStart(ml.event.Unknown, function () {
basic.showString("?")
})
```

The ML model updates its estimated action several times a second, but this block only runs when the estimated action changes.

## Parameters

* **path**: a string that contains the path to the file on disk
* **encoding**: the encoding of the file to be read
- **action**: action one of the actions the machine learning model was trained on. The special value unknown represents the case where no action has a certainty above the recognition point.

## 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)
ml.onStart(ml.event.Unknown, function () {
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.Dadadadum), music.PlaybackMode.InBackground)
})
```

## See also
* [write file](./write-file)

```package
machine-learning=github:microbit-foundation/pxt-microbit-ml
```
```
6 changes: 3 additions & 3 deletions pxt.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"pxtextension.ts",
"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"
"docs/_locales/es/on-ml-start.md",
"_locales/es/machine-learning-jsdoc-strings.json",
"_locales/es/machine-learning-strings.json"
],
"testFiles": [
"autogenerated.ts",
Expand Down

0 comments on commit bb1ff21

Please sign in to comment.