Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WordPress Internationalization Workflows

WordPress Internationalization Workflows

I've presented an updated version of my WordPress I18N Workflows talk at WordCamp Johannesburg 2018.

In this presentation I'm explaining how internationalization and localization work in WordPress and how one can leverage the powers of WordPress, GlotPress, and WP-CLI to improve the translation workflow in their WordPress projects.

Pascal Birchler

October 26, 2018
Tweet

More Decks by Pascal Birchler

Other Decks in Technology

Transcript

  1. WordPress
    Internationalization
    Workflows
    WordCamp Johannesburg 2018

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

    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. Internationalization
    Done Right
    bit.ly/i18nDoneRight

    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. Language Packs

    View Slide

  18. WordPress Plugin Internationalization
    Behind the Scenes

    View Slide

  19. WordPress Plugin Internationalization
    WordPress.org

    View Slide

  20. Writing a Plugin

    View Slide

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

    View Slide

  22. /**
    * 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

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

  24. WordPress.org
    Plugin Directory

    View Slide

  25. wordpress.org/plugins/my-plugin

    View Slide

  26. translate.wordpress.org

    View Slide

  27. View Slide

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

    View Slide

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

    View Slide

  30. WordPress Plugin Internationalization
    Private Plugin

    View Slide

  31. Writing a Plugin

    View Slide

  32. String Extraction

    View Slide

  33. /**
    * 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

  34. makepot
    grunt-wp-i18n
    Poedit

    View Slide

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

    View Slide

  36. Manual Translation

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  40. Comparison

    View Slide

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

  42. Introducing
    Traduttore

    View Slide

  43. WordPress.org
    For Everyone

    View Slide

  44. translate.wordpress.org
    For Everyone

    View Slide

  45. View Slide

  46. View Slide

  47. How it Works

    View Slide

  48. WP-CLI

    View Slide

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

    View Slide

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

    View Slide

  51. View Slide

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

    View Slide

  53. View Slide

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

  55. required.com/en/blog/

    View Slide

  56. 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. Gutenberg

    View Slide

  62. JavaScript
    Internationalization

    View Slide

  63. View Slide

  64. Thank You.

    View Slide