Why do I need the Multilingual Tools plugin?
The Multilingual Tools plugin can help theme and plugin developers to test their products’ multilingual capabilities. It will automatically add language code or custom notices to translated content, allowing the developer to review what is working correctly and what requires modification to be translated.
With this tool you can:
- Automatically generate strings for translations
- Add language information to duplicated posts
- Generate a WPML configuration file (wpml-config.xml)
The end result of using the Multilingual Tools plugin is shown below:
How do I install and use Multilingual Tools to automatically generate translations?
This tool allows developers running development sites to check if their theme/plugin is multilingual ready.It is free and available to download here. It will produce a duplicate of the original content appended with the language code and modify any existing translations; therefore, you should never run it on production or client sites.
Note that WPML Multilingual CMS, WPML String Translation, and WPML Translation Management plugins are required for Multilingual Tools to work.
The Multilingual Tools plugin will automatically generate translations (appending language code with original strings) for:
- Posts, pages, and custom types
- Custom fields
- Tags, categories, and custom taxonomies
- All translatable strings
Automatic translation generation is achieved by following these three steps:
Basic WPML setup
In this tutorial, we will activate the “Twenty Sixteen” theme, and install and activate WPML Multilingual CMS, WPML String Translation, WPML Translation Management, and Multilingual Tools plugins.
WPML’s Getting Started Guide will help you to set up WPML in only a few minutes. Make sure to add at least one secondary language and set the language switcher (which is an easy way to switch between languages) to be displayed in the footer area in the front end.
Scanning your theme/plugin code for text
Every WordPress theme and plugin has some hard-coded text. If you’ve followed the WordPress coding guidelines, all these texts will be wrapped in gettext calls, described in the WordPress i18n guide. If not, now would be a great time to fix this.
Now, WPML is capable of translating all strings that are wrapped in Gettext calls and also has translations for the WordPress core text.
Auto-duplicate content for other languages
Now that we have all strings scanned, we can generate translations for the site. Remember that the Multilingual Tools plugin will only translate the sample content that you’ve created. If your theme or plugin requires test content, you should populate it first.