2016-08-17 18:44:15 +02:00
|
|
|
# Packages
|
2016-05-05 15:20:18 +02:00
|
|
|
|
|
|
|
You can publish libraries (also known as packages or extensions)
|
|
|
|
that users can then add to their scripts. These typically
|
|
|
|
provide a driver for a particular hardware device you can connect
|
|
|
|
to a microbit.
|
|
|
|
|
2016-08-18 03:23:08 +02:00
|
|
|
* [pxt-max6675](https://github.com/Microsoft/pxt-max6675) -- TypeScript
|
2016-08-16 08:16:10 +02:00
|
|
|
* [pxt-neopixel](https://github.com/Microsoft/pxt-neopixel) -- TypeScript + ARM Thumb assembly package
|
2016-08-18 03:23:08 +02:00
|
|
|
* [pxt-sonar](https://github.com/microsoft/pxt-sonar) -- TypeScript
|
|
|
|
* [pxt-i2c-fram](https://github.com/microsoft/pxt-i2c-fram) -- TypeScript
|
|
|
|
|
2016-05-05 15:20:18 +02:00
|
|
|
* [Sample C++ extension](https://github.com/Microsoft/pxt-microbit-cppsample)
|
|
|
|
* [Sample TypeScript extension](https://github.com/Microsoft/pxt-microbit/tree/master/libs/i2c-fram)
|
|
|
|
|
2016-08-17 18:44:15 +02:00
|
|
|
## Finding packages
|
2016-05-05 15:20:18 +02:00
|
|
|
|
2016-05-27 16:06:24 +02:00
|
|
|
From the editor, the user clicks on **More** then **Add Package** and searches for the package.
|
|
|
|
|
|
|
|
To see the list of packages, click on **More** then **Show Files** to see the project file list.
|
|
|
|
|
|
|
|
To remove a package, click on the garbage button in the file list next to the package.
|
|
|
|
|
2016-08-17 18:44:15 +02:00
|
|
|
## Publishing packages
|
2016-05-05 15:20:18 +02:00
|
|
|
|
2016-08-25 17:44:53 +02:00
|
|
|
Packages can be published from the pxt command line. Check out [the docs](https://www.pxt.io/packages).
|
2016-06-01 16:42:03 +02:00
|
|
|
|
2016-08-17 18:44:15 +02:00
|
|
|
## Localizing packages
|
2016-06-01 16:42:03 +02:00
|
|
|
|
|
|
|
It is possible to package localization strings for the **jsDoc** description associated to the API in the package.
|
|
|
|
|
|
|
|
When compiling a package, the PXT compiler generates a `strings.json` file under the `_locales/` folder.
|
|
|
|
This file contains a map from the symbol name to the en
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
...
|
|
|
|
"basic": "Provides access to basic micro:bit functionality.",
|
|
|
|
...
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
"basic.clearScreen": "Eteint toutes les diodes."
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
_locales/
|
|
|
|
_locales/fr/strings.json
|
|
|
|
_locales/pt-BR/strings.json
|
|
|
|
```
|