All Projects → swissspidy → gutenberg-i18n-block

swissspidy / gutenberg-i18n-block

Licence: GPL-2.0 License
Gutenberg block to demo internationalization functionality.

Programming Languages

PHP
23972 projects - #3 most used programming language
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to gutenberg-i18n-block

Gutenberg
The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
Stars: ✭ 7,409 (+21068.57%)
Mutual labels:  wordpress-plugin, gutenberg
icon-block
A simple little WordPress block that allows you add an SVG icon or graphic to your website.
Stars: ✭ 24 (-31.43%)
Mutual labels:  wordpress-plugin, gutenberg
Qtranslate Xt
qTranslate-XT (eXTended) - reviving qTranslate-X. A new community-driven plugin soon. GUTENBERG initial support now available! Built-in modules for WooCommerce, ACF, All in one SEO, Events Made Easy, Gravity Forms.
Stars: ✭ 366 (+945.71%)
Mutual labels:  i18n, wordpress-plugin
Create Guten Block
📦 A zero-configuration #0CJS developer toolkit for building WordPress Gutenberg block plugins.
Stars: ✭ 3,040 (+8585.71%)
Mutual labels:  wordpress-plugin, gutenberg
averroes
A Gutenberg compatible markdown editor. Write in Markdown, edit in Markdown and preview in HTML.
Stars: ✭ 15 (-57.14%)
Mutual labels:  wordpress-plugin, gutenberg
Glotpress Wp
🌍 🌎 🌏 GlotPress is a WordPress plugin to let you set up your own collaborative, web-based software translation tool.
Stars: ✭ 205 (+485.71%)
Mutual labels:  i18n, wordpress-plugin
disable-drop-cap
Plugin to disable drop cap in Gutenberg editor paragraph block.
Stars: ✭ 11 (-68.57%)
Mutual labels:  wordpress-plugin, gutenberg
block-navigation
Sidebar with the current post blocks and some tools to facilitate the editing process in the Gutenberg editor.
Stars: ✭ 16 (-54.29%)
Mutual labels:  wordpress-plugin, gutenberg
chatterbox
Create chat threads using WordPress Blocks inside app and device wrappers.
Stars: ✭ 18 (-48.57%)
Mutual labels:  wordpress-plugin, gutenberg
wp-block-description-list
A wordpress gutenberg block plugin for description lists.
Stars: ✭ 17 (-51.43%)
Mutual labels:  wordpress-plugin, gutenberg
ultimate-addons-for-gutenberg
Power-up the Gutenberg editor with advanced and powerful blocks that help you build websites in minutes!
Stars: ✭ 166 (+374.29%)
Mutual labels:  wordpress-plugin, gutenberg
qubely
Qubely Blocks – Full-fledged Gutenberg Toolkit
Stars: ✭ 76 (+117.14%)
Mutual labels:  wordpress-plugin, gutenberg
graphql-gutenblock-example
Example Gutenberg Block using WPGraphQL to populate the data
Stars: ✭ 17 (-51.43%)
Mutual labels:  wordpress-plugin, gutenberg
wp-to-diaspora
Automatically share WordPress posts on diaspora*
Stars: ✭ 15 (-57.14%)
Mutual labels:  wordpress-plugin
pmpro-affiliates
Create affiliate accounts with unique referrer URLs to track membership checkouts for Paid Memberships Pro
Stars: ✭ 14 (-60%)
Mutual labels:  wordpress-plugin
tutty-meta-box
Create custom fields with simple and easy to use WordPress meta box framework.
Stars: ✭ 16 (-54.29%)
Mutual labels:  wordpress-plugin
WooCommerce-Plugin-Extension-Boilerplate
Plugin boilerplate to create extensions of WooCommerce
Stars: ✭ 16 (-54.29%)
Mutual labels:  wordpress-plugin
WPGrabInfo
WP Grab Info v2
Stars: ✭ 43 (+22.86%)
Mutual labels:  wordpress-plugin
wordpress-zero-spam
The WordPress Zero Spam plugin makes blocking spam a cinch without all the bloated options. Just install, activate, and say goodbye to spam.
Stars: ✭ 67 (+91.43%)
Mutual labels:  wordpress-plugin
civicrm-wp-member-sync
CiviCRM WordPress Member Sync plugin keeps a WordPress user in sync with a CiviCRM membership by granting either a role or capabilities to a WordPress user who has that membership.
Stars: ✭ 13 (-62.86%)
Mutual labels:  wordpress-plugin

Gutenberg I18N Block

This is an example WordPress plugin to demonstrate how to build fully internationalised an localised blocks for the new block editor in WordPress.

Prerequisites

To install all npm dependencies in this repository, run npm install.

Also, you need to have WP-CLI 2.2.0 or higher installed. To update WP-CLI run wp cli update.

This has the additional benefit that the resulting POT file contains the correct references to the original JavaScript files containing translatable strings.

Not a fan of Babel?

Not everyone uses Babel in their JavaScript build process. The good thing is, you don't have to use it just for the sake of internationalization!

WP-CLI has got you covered. Simply run WP-CLI's i18n make-pot command against your final JavaScript files to extract all translatable strings.

Usage

If you want to apply the I18N functionality from this block to yours, you need three main scripts:

  1. npm run build:js
    This command runs Babel to transpile our modern JavaScript from block/src/block.js to something more browsers understand in block/block.js. It uses the @wordpress/babel-plugin-makepot Babel plugin to automatically extract all translatable strings from the JavaScript and create a POT file for them (gutenberg-i18n-block-js.pot).
    gutenberg-i18n-block-js.pot is only a temporary file and can be added to your .gitignore file.
  2. npm run build:pot
    This command uses wp i18n make-pot to create our final gutenberg-i18n-block.pot POT file that contains all texts from both the PHP side as well as the JavaScript side (gutenberg-i18n-block.pot).
    It also allows us to translate the plugin's name and description. Use this for localization.
  3. npm run build:json
    Once you have added all your translations, run this command to create the necessary JSON translation files.

Resources

A detailed step-by-step guide for JavaScript internationalization in WordPress 5.0 and beyond can be found on my blog: https://pascalbirchler.com/internationalization-in-wordpress-5-0/

Screenshots

Editor in English

Block in English

Editor in German

Block in German

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].