$30 off During Our Annual Pro Sale. View Details »

WordPress Internationalization Workflows

Pascal Birchler
September 15, 2018

WordPress Internationalization Workflows

Soon after the release of WordPress 15 years ago, support for internationalization was added to the software. This meant that themes, plugins, and WordPress itself could be translated. This was a huge deal as WordPress is used all over the world, in countries where English is not the main language. WordPress was quickly translated into German, Japanese and many more languages.

Over the years, WordPress has steadily improved the way we have to work with internationalization. However, challenges still exist and there will always be new ones ahead. Projects like Gutenberg and ecosystems beyond WordPress.org force us to continuously iterate.

At WordCamp Tokyo 2018, I had the honor to talk about how to make use of the latest and greatest technology to make your WordPress plugin or theme fully internationalized. In this presentation I'm highlighting how you can leverage the powers of WordPress, GlotPress, and WP-CLI to improve the translation workflow in your WordPress projects.

Pascal Birchler

September 15, 2018
Tweet

More Decks by Pascal Birchler

Other Decks in Technology

Transcript

  1. View Slide

  2. Pascal Birchler

    @swissspidy

    View Slide

  3. What You Will Learn Today

    View Slide

  4. WordPress
    +
    Internationalization

    View Slide

  5. Making a Plugin
    Translation-Ready

    View Slide

  6. Internationalization Workflow
    Optimization

    View Slide

  7. Terminology

    View Slide

  8. The process of creating a product in such
    a way that it can be easily adapted
    to specific local languages and cultures
    Internationalization (I18N)

    View Slide

  9. The process of adapting a product or
    service to a particular language,
    culture, and desired local “look-and-feel.”
    Localization (L10N)

    View Slide

  10. “Localization is like translation
    but with a cultural twist”
    Localization

    View Slide

  11. Defines the language, region, and
    cultural preferences.
    Locale

    View Slide

  12. WordPress I18N Efforts

    View Slide

  13. Making WordPress
    Global

    View Slide

  14. translate.wordpress.org

    View Slide

  15. View Slide

  16. View Slide

  17. translate.wordpress.org
    glotpress.blog
    poedit.net

    View Slide

  18. Language Packs

    View Slide

  19. User Locales

    View Slide

  20. View Slide

  21. WordPress Plugin Internationalization
    Behind the Scenes

    View Slide

  22. WordPress Plugin Internationalization
    WordPress.org

    View Slide

  23. Writing a Plugin

    View Slide

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

    View Slide

  25. /**
    * Plugin Name: My Super Awesome Plugin
    * Plugin URI: https://wordpress.org/plugins/my-plugin/
    * Description: My WordPress plugin that does nothing.
    * Version: 1.0.0
    * Author: Pascal Birchler
    * Author URI: https://pascalbirchler.com
    */
    __( 'Translate me', 'my-plugin' );

    View Slide

  26. === 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.

    View Slide

  27. WordPress.org
    Plugin Directory

    View Slide

  28. wordpress.org/plugins/my-plugin

    View Slide

  29. translate.wordpress.org

    View Slide

  30. View Slide

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

    View Slide

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

    View Slide

  33. WordPress Plugin Internationalization
    Private Plugin

    View Slide

  34. Writing a Plugin

    View Slide

  35. String Extraction

    View Slide

  36. /**
    * Plugin Name: My Super Awesome Plugin
    * Plugin URI: https://wordpress.org/plugins/my-plugin/
    * Description: My WordPress plugin that does nothing.
    * Version: 1.0.0
    * Author: Pascal Birchler
    * Author URI: https://pascalbirchler.com
    */
    __( 'Translate me', 'my-plugin' );

    View Slide

  37. makepot
    grunt-wp-i18n
    Poedit

    View Slide

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

    View Slide

  39. Manual Translation

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  43. Comparison

    View Slide

  44. 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

    View Slide

  45. Introducing
    Traduttore

    View Slide

  46. WordPress.org
    For Everyone

    View Slide

  47. translate.wordpress.org
    For Everyone

    View Slide

  48. How it Works

    View Slide

  49. WP-CLI

    View Slide

  50. # Create a POT file for the WordPress plugin
    in the current directory
    $ wp i18n make-pot . languages/my-plugin.pot

    View Slide

  51. github.com/wp-cli/i18n-command

    View Slide

  52. View Slide

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

    View Slide

  54. View Slide

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

    View Slide

  56. required.com/en/blog/

    View Slide

  57. github.com/wearerequired/traduttore
    github.com/wearerequired/traduttore-registry

    View Slide

  58. What's Next

    View Slide

  59. Improving
    Traduttore

    View Slide

  60. Improving
    translate.wordpress.org

    View Slide

  61. JavaScript
    Internationalization

    View Slide

  62. Summary

    View Slide

  63. I18N Workflows in WordPress

    View Slide

  64. Public vs Private Projects

    View Slide

  65. Traduttore

    View Slide

  66. Future Changes

    View Slide

  67. Thank You.

    View Slide