block-development-examples
block-development-examples copied to clipboard
[Tracking Issue] Update plugin Readme files to include more detailed information
What?
We need to update each plugin to explain the learning goal/objective, provide details on the code, and link to any relevant references as needed.
- [x] basic-block-translations-3df23d
- [ ] basic-esnext-a2ab62
- [ ] block-dynamic-rendering-64756b
- [ ] block-static-rendering-b16608
- [ ] block-supports-6aa4dd
- [ ] controls-a9cfe0
- [x] data-basics-59c8f8
- [ ] dynamic-block-b0bce7
- [ ] editable-block-1b8c51
- [ ] format-api-f14b86
- [ ] inner-blocks-dcd824
- [ ] interactive-blocks-demos-99def1
- [x] interactivity-api-block-833d15
- [ ] meta-block-bb1e55
- [x] minimal-block-ca6eda
- [ ] minimal-block-no-build-e621a6
- [ ] non-block-react-wp-data-56d6f3
- [ ] plugin-sidebar-9ee4a6
- [ ] recipe-card-744e8a
- [ ] slotfill-2fb190
- [x] stylesheets-79a4c3
ReadMe Example to follow
Basic Block Translation 3df23d
The goal of this example is to showcase how to use translations in a block.
| Folder | Short description | Tags | ID (❓) | Download .zip | Live Demo |
|---|---|---|---|---|---|
| 📁 | Basic Block with Translations | STATIC RENDERING |
3df23d |
📦 |
Understanding the Example Code
Both the edit.js and save.js files import the __ function @wordpress/i18n to apply translations to the texts used in the code.
- The
__function receives the text and a namespace as parameters - At
index.phpwe tell WordPress our JavaScript contains translations, using thewp_set_script_translations()function. - At
languages/folder there are all the translations files (the source files and the.moones actually used to apply the translations)
Related resources
Note Check the Start Guide for local development with the examples