
If any plugin, or even WordPress itself, includes the same strings used in a different context, the GetText() function will still provide the correct translation, because we have provided our own text domain (wpml_theme). This allows texts to be translated in their correct context. The second argument, wpml_theme, in both these calls is the Text domain. For example, in the comment number display, we use: It is similar to _e(), but does not echo the translation. When you do not need to echo the string (for example, when it is the argument of a function), you should use the _() call. In our example, we will use a GetText echo call: _e().Ĭan you see the difference? Translation without echo We need to wrap those texts – which we will continue calling strings from now on – into GetText functions.

The strings Name and required need to be translated. Here is a very simplified version of the field requesting the first name: The form for leaving new comments asks for the visitor’s name, email and website and includes a submit button. Usually, WordPress themes and plugins include some hardcoded texts. Making the theme and plugin texts translatable

This makes it easier for your users to translate it to other languages and even share those MO files with you.įurthermore, most of the texts are shared between different themes and plugins, so it is just a little one-time investment which you can reuse later over and over. You will also see how your premium theme or plugin value increases, not only if it is already translated to several languages, but also if it includes a POT file. They will deeply appreciate it when they start translating their site’s contents. Not only it is a powerful feature to advertise, but it is a real time saver for your clients and a way to reach a bigger market. It is also a good practice and a smart idea to create all your themes and plugins as translation-ready. Adding your translation to your theme or plugin.Īlthough it involves multiple steps, creating multilingual themes and plugins is really simple.

Collecting all the texts for translation.Identifying and marking texts that need to be translated.

The entire process for theme and plugin localization includes: This page explains how to turn the theme or plugin you created into a multilingual one. In order to run multilingual WordPress sites, all your content as well as your themes and plugin strings, need to be localized.
