block-development-examples icon indicating copy to clipboard operation
block-development-examples copied to clipboard

[Tracking Issue] Update plugin Readme files to include more detailed information

Open ryanwelcher opened this issue 2 years ago • 0 comments

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.

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.php we tell WordPress our JavaScript contains translations, using the wp_set_script_translations() function.
  • At languages/ folder there are all the translations files (the source files and the .mo ones actually used to apply the translations)

Related resources


Note Check the Start Guide for local development with the examples

ryanwelcher avatar Nov 13 '23 17:11 ryanwelcher