In the presentation I show you how you can make your theme translatable, whilst developing it. I also show you how to create a multilingual WordPress site using the WPML Multilingual plugin, once you've got your site up and running.
This was presented at our recent WP Melbourne WordPress Meetup:-
http://www.meetup.com/WordPress-Melbourne/
2. About me
Designer/Developer @ Maddison Designs
!
WordPress Theme & Plugin Developer
!
WordPress Theme & Plugin Directory contributor
!
Provides support on official WordPress Support Forum
!
Created Easy WP Guide (over 100K downloads)
!
Co-Organiser Melbourne WordPress WordCamp 2013
!
Co-Organiser for monthly WP Melbourne WordPress Meetups
3. Last month [May 2014], for the first time
in history, the non-English downloads of
WordPress passed the English downloads.
In the future, if we do our job right, the
usage of WordPress will democratise
publishing. It will resemble every language
in the world. “
— Matt Mullenweg
7. Making your theme Translatable
__( $text, $domain )
(two underscores)
$translated = __( ‘Hello World!’, ‘mytextdomain’ );
The most basic translation function. Returns the text in the
correct language.
8. _e( $text, $domain )
_e( ‘Some text to translate and display.’, ‘mytextdomain’ );
The same as __() except it echoes the text instead of returning
the value.
9. _n( $single, $plural, $number, $domain )
_n( ‘There is a comment’, ‘There are comments’, get_comments_number(), ‘mytextdomain’ );
Return the plural or single form based on the $number
10. _x( $text, $context, $domain )
_x( ‘post link’, ‘A link to the post’, ‘mytextdomain’ );
_x( ‘post link’, ‘Submit a link’, ‘mytextdomain’ );
Used when there’s the chance the text could be found in more
than two places, but with different context. Allows you to
provide a short description to clarify the text being translated.
11. _ex( $text, $context, $domain )
_ex( ‘post link’, ‘A link to the post’, ‘mytextdomain’ );
_ex( ‘post link’, ‘Submit a link’, ‘mytextdomain’ );
The same as _x() except it echoes the text instead of returning
the value.
12. _nx( $single, $plural, $number, $context, $domain )
_nx( ‘A comment!’, ‘Yay! Multiple comments!’, $number, ‘Comments title’, ‘mytextdomain’ );
A hybrid of _n() and _x(). It supports contexts and plurals.
13. Making your Content Translatable
With the WPML plugins, you can…
!
- provide your content in over 40 languages
!
- give your site visitors handy tools like ‘language switchers’
!
- access powerful translation management tools
!
- get easy access to professional translators (for a cost)
!
- make your WooCommerce store multilingual
!
- translate theme & plugin texts
23. You can only switch languages on pages that are translated
24. Where to Go for Help
Translating WordPress
http://codex.wordpress.org/Translating_WordPress
!
Official WordPress Translators Team Blog
http://make.wordpress.org/polyglots
WPML
http://wpml.org
!
WPML Getting Started Guide
http://wpml.org/documentation/getting-started-guide
!
Translating your Theme
http://code.tutsplus.com/tutorials/translating-your-theme--wp-25014
25.
26. Questions?
I’m Anthony Hortin
You can find me here
!
@maddisondesigns
maddisondesigns.com
!
@easywpguide
easywpguide.com
!
!
!
!