Slide 1

Slide 1 text

WordPress Internationalization Workflows WordCamp Sofia 2018

Slide 2

Slide 2 text

Pascal Birchler
 @swissspidy

Slide 3

Slide 3 text

What This Talk is About

Slide 4

Slide 4 text

Making a Plugin Translation-Ready

Slide 5

Slide 5 text

Gutenberg + Internationalization

Slide 6

Slide 6 text

Workflow Improvements

Slide 7

Slide 7 text

WordPress Plugin Internationalization WordPress.org

Slide 8

Slide 8 text

Writing a Plugin

Slide 9

Slide 9 text

my-plugin/ my-plugin.php readme.txt

Slide 10

Slide 10 text

Slide 11

Slide 11 text

=== My Super Awesome Plugin === Contributors: swissspidy Requires at least: 4.6 Stable tag: 1.0.0 License: GPLv2 or later My WordPress plugin that does nothing.

Slide 12

Slide 12 text

WordPress.org Plugin Directory

Slide 13

Slide 13 text

wordpress.org/plugins/my-plugin

Slide 14

Slide 14 text

translate.wordpress.org

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

wp-content/ languages/ my-plugin-de_DE.mo my-plugin-de_DE.po

Slide 18

Slide 18 text

1. Write Plugin 2. Submit to WordPres.org 3. Translate 4. Done!

Slide 19

Slide 19 text

WordPress Plugin Internationalization Private Plugin

Slide 20

Slide 20 text

Writing a Plugin

Slide 21

Slide 21 text

String Extraction

Slide 22

Slide 22 text

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

makepot grunt-wp-i18n WP-CLI

Slide 25

Slide 25 text

my-plugin/ my-plugin.php languages/ my-plugin.pot

Slide 26

Slide 26 text

Manual Translation

Slide 27

Slide 27 text

my-plugin/ my-plugin.php languages/ my-plugin.pot my-plugin-de_DE.po my-plugin-de_DE.mo

Slide 28

Slide 28 text

load_plugin_textdomain( 'my-plugin', false, plugin_basename( __DIR__ ) . '/languages' )

Slide 29

Slide 29 text

1. Write Plugin 2. String Extraction 3. Translate 4. Load Translations 5. Done!

Slide 30

Slide 30 text

Comparison

Slide 31

Slide 31 text

WordPress.org Private Plugin - Very easy to use - Translation Platform - Just-in-time Translation Loading - Complicated process - String Extraction - No Translation Community - Manual Translation Loading

Slide 32

Slide 32 text

Gutenberg

Slide 33

Slide 33 text

JavaScript Internationalization

Slide 34

Slide 34 text

// my-block.js wp_enqueue_script( 'my-block' ) // editor-integration.js wp_enqueue_script( 'editor-js' ) // hacks.js wp_enqueue_script( 'other-stuff' )

Slide 35

Slide 35 text

const { __ } = wp.i18n __( 'Hello World', 'my-plugin' )

Slide 36

Slide 36 text

load_plugin_textdomain()

Slide 37

Slide 37 text

wp_set_script_translations( 'editor-js', // script handle 'my-plugin', // text domain '/path/to/translations' )

Slide 38

Slide 38 text

languages/ my-plugin-de_DE.mo my-plugin-de_DE.po my-plugin-de_DE-editor-js.json my-plugin-de_DE-my-block.json my-plugin-de_DE-other-stuff.json

Slide 39

Slide 39 text

npm install po2json po2json my-plugin-de_DE.po my-plugin-de_DE-editor-js.json -f jed1.x

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Workflow Improvements

Slide 42

Slide 42 text

WP-CLI Helpers

Slide 43

Slide 43 text

wp i18n po2json

Slide 44

Slide 44 text

Introducing Traduttore

Slide 45

Slide 45 text

translate.wordpress.org For Everyone

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

How it Works

Slide 49

Slide 49 text

1. Write Plugin 2. Translate 3. Done!

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

\Required\Traduttore_Registry\add_project( 'plugin', 'my-plugin', 'https://translate.example.com/api/translations/my-plugin/' );

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

WordPress.org & Traduttore Private Plugin - Very easy to use - Translation Platform - Just-in-time Translation Loading - JSON Translation Files - Complicated process - String Extraction - No Translation Community - Manual Translation Loading

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

github.com/wearerequired/traduttore wearerequired.github.io/traduttore

Slide 57

Slide 57 text

SaaS?

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Thank You.