Multilingual support should not be a theme/plugin author’s headache. As long as the development follows WordPress standards, everything should go smoothly. Below are some basic rules and recommendations to follow:
For the Developers:
Multilingual texts in the PHP code
WordPress uses gettext libraries to display messages in the language specified by locale settings. As long as every text string in code is wrapped in gettext calls, the code is multilingual-ready:
// Wrong. Prints 'Hello' regardless of the user's language. echo 'Hello'; // Correct. Translators can supply the translation of 'Hello'. echo __( 'Hello', 'my-text-domain' );
More detailed instructions are in the WordPress i18n manual.
Multiple languages in posts and pages
WPGlobus provides an easy administrator interface for entering texts in multiple languages. For the theme authors, there is only one rule: must apply filters to the post data before printing them out:
$post = get_post(); // Wrong. Prints all languages mixed together. echo $post->post_title; // Correct. Prints only the currently selected language. echo apply_filters( 'the_title', $post->post_title );
Texts in custom fields, metas, and options
The rule here is similar to the above. A correct way is to apply the relevant filter before using the data retrieved from the database, for example:
$text_in_meta = get_post_meta( $post->ID, 'meta_key', true ); echo apply_filters( 'the_title', $text_in_meta ); $text_in_options = get_option( 'option-name' ); echo apply_filters( 'the_title', $text_in_options );
3rd-party Plugins used by Themes
If your theme relies on someone else’s plugins or libraries, you should make sure their authors follow the same rules for multilingual compatibility.
Special attention should be given to various “page composers” and advanced plugins (e.g., forms, sliders).
In some cases, when a plugin is invoked via a shortcode, it might be easier to create a separate instance (form, slider, etc.) for each language and insert their respective shortcodes to the correspondent language tab when editing post or page.
The composers and page builders are very complicated systems, and they might not work in the multi-language mode without special preparation. For example, if your theme uses WPBakery Visual Composer, the WPGlobus users will need to activate the WPGlobus for WPBakery Visual Composer plugin.