42
LET'S CREATE A MULTILINGUAL SITE Marko Heijnen WordCamp Tokyo 2014

Let's create a multilingual site in WordPress

Embed Size (px)

DESCRIPTION

A talk focussed on translating your site from code perspective. Focussed on how to use GlotPress.

Citation preview

LET'S CREATE A MULTILINGUAL SITEMarko HeijnenWordCamp Tokyo 2014

MARKO HEIJNEN

•Founder  of  CodeKitchen  

•Working  for  1&1  

•Lead  developer  of  GlotPress  

•Core  contributor  for  WordPress

WORDPRESS DEVELOPER

The Netherlands

TODAY’STOPICS

• Current status of WordPress • How to make your code translatable• Creating language files• What is GlotPress • Using GlotPress • Cool new (upcoming) features • Multilingual plugins

CURRENT STATUS

CURRENT STATUSDOWNLOADABLE PACKAGES

• 137 locales with a wp_locale!

• 49 locales are up to date• 7 locales are one major version behind• 17 locales are behind by two or more major version• 64 locales don’t have a package!

• Oldest version is 2.8.5.

CURRENT STATUSLANGUAGE PACKS

• Only generated when all necessary projects are 100% completed• Automatic updates of the files in your installation!

• 137 locales with a wp_locale• 40 locales have a language pack

CURRENT STATUSDOWNLOADS PER SEPTEMBER 12TH 2014

HOW TO MAKE YOUR CODE TRANSLATABLE

Check out for more: http://wceu2013.ottopress.com

CORE FUNCTIONS

Basics  func*ons  __() _e()!Not so basics  func*ons  _x() _ex() _n()!esc_html__() esc_html_e() esc_html_x()!esc_attr__() esc_attr_e() esc_attr_x()

CORE FUNCTIONS

• Always only use static strings• Don’t use I18N functions on variables• Always provide text domains like

_e( ‘string’,'textdomain')

PROVIDING MORE INFORMATION

Context • _x('buffalo', 'an animal', 'plugin-slug');• _x('Buffalo', 'a city in New York', 'plugin-slug');• _x('buffalo', 'to bully or intimidate', 'plugin-slug');!

Translator comment /* translators: description for a picture of a cat */_e( 'Cat', 'plugin-slug' );

CREATING LANGUAGE FILES

POMO FILES

• Translation consists, mostly, of creating POMO files.!

• POT file – Portable Object Template!

• PO file – Portable Object• MO file – Machine Object

MAKEPOT.PHP

• Finds all current/future I18N functions• Handles plugin/theme headers (and Text Domain header)• Finds translator comments• Generates a POT file you can use for translation!

• Can be found at http://develop.svn.wordpress.org/trunk/tools/i18n/• Example: php makepot.php wp-theme theme-location/my-theme !

• Grunt: https://www.npmjs.org/package/grunt-wp-i18n

USING GLOTPRESS

WHAT IS IT

• GlotPress is a collaborative, web-based software translation tool• GlotPress will let you, or an entire team, to translate

their favourite software• It is open-source like WordPress is!

• Is being used on translate.wordpress.org

TRANSLATE.WORDPRESS.ORG

TRANSLATE.WORDPRESS.COM

WP-TRANSLATE.ORG - OWN PROJECT

FEATURES

• Different roles: Translators, Validators and Admins• Translate strings• Validate strings• Manage strings by reject/approve them• Having a glossary with common words• Import/Export different formats

SETTING UP GLOTPRESS

svn up http://glotpress.svn.wordpress.org/ .

CREATING GP-CONFIG.PHP

• No UI yet for filling in the file• Copy paste gp-config-sample.php to gp-config.php• Update the database configurations• Update the unique keys!

You can use the user tables from WordPress • define('CUSTOM_USER_TABLE', 'wp_users');• define('CUSTOM_USER_META_TABLE',

'wp_usermeta');

INSTALLING GLOTPRESS

DONE INSTALLING GLOTPRESS

FIRST VIEW

TRANSLATIONS OVERVIEW

TRANSLATION FLOW

EXPORT

NEW FEATURES THAT ARE HELPING YOU OUT

LOCALE PAGE

LOCALE PAGE

GLOSSARY

NOTIFICATIONS

• Receive updates as a validator for waiting strings• Receive updates for projects you translated!

• There is code but we need to check how we want to do this in a good way

PROFILE PAGES

USER DASHBOARD

• Similar as the profile page• More focussed on the projects the user is working

on• Shows a filtered locale page

DECLINE WITH FEEDBACK VALIDATING THE STRING

DECLINE WITH FEEDBACK TRANSLATING THE STRING AGAIN

LOT’S MORE THINGS

• New design• Better workflow• A real GlotPress site as GlotPress.org• Release a 1.0 beginning next year!

• And a lot of the input I receive from theWordPress community

MULTILINGUAL PLUGINS

ON WORDPRESS.ORG

• Polyglang• qTranslate• WPML (Premium)!

• Multisite Language Switcher• Multilingual Press• Zanto

BABBLE HTTPS://GITHUB.COM/CFTP/BABBLE

• For translating Post types and taxonomies• A lot of things still to come• Doesn’t work out of the box for taxonomies due to

missing filters in WordPress!

• More for developers• No extra tables• Uses all the power WordPress gives us

THANK YOU FOR LISTENING聞いていただき、ありがとうございます

QUESTIONS? ご質問?

@markoheijnen - markoheijnen.com