let's create a multilingual site in wordpress
DESCRIPTION
A talk focussed on translating your site from code perspective. Focussed on how to use GlotPress.TRANSCRIPT
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 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
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' );
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
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
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');
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
USER DASHBOARD
• Similar as the profile page• More focussed on the projects the user is working
on• Shows a filtered locale page
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
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