Internationalization and Localization process WordPress is an easy process with this introduction.
At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Services.
Let’s look at how our Support Team helped our customers learn more about Internationalization and Localization process in WordPress.
All About Internationalization and Localization process WordPress
Internationalization or I18N involves internationalizing or adapting our plugin or theme to translate it to any language we prefer. Furthermore, localization or L10n involves localizing or translating our internalized tools to a language we prefer.
Interestingly many people make the mistake of using internationalization and localization interchangeably. However, as seen above, these terms refer to two different facets of the translation process.
For instance, I18n makes our theme translatable while L10n involves actually translating our theme to a different language.
WordPress relies on the following gettext libraries to load the translations:
- POT (Portable Object Template): This file generates strings for translation. Although, the file does not contain any translations.
- PO (Portable Object): These files consist of translations as well as the original strings.
- MO (Machine Object): These files help functions load the translations. Although the files are not human-readable, they are very important.
How to prepare a theme for internationalization
According to our Support Techs, preparing a theme for internationalization is an easy task. It can be done by including the following function within functions.php:
function my_theme_load_theme_textdomain() { load_theme_textdomain( 'my-theme', get_template_directory() . '/languages' ); } add_action( ‘after_setup_theme','my_theme_load_theme_textdomain' );
Then we have to edit the text strings. Moreover, the strings have to be translated and thereby not hardcoded. This is done by wrapping the original strings in a WordPress localization function. Some of the popular localization functions include:
- __()
This function returns the translation of the argument.
- _e()
This function echo the string to the browser.
- esc_html__()
This function escapes as well as returns the translation of the argument.
- esc_html_e()
This function escapes & echos the translation of the argument.
After the theme files are ready, we have to generate the POT file. Then, we have to use Poedit, an open-source application to generate PO and MO files based on the POT file for the corresponding language.
Additionally, we can localize an existing WordPress by navigating to Settings> General. Then choose the language we want from the Site Language dropdown list.
[Need assistance with a different issue? We are available 24/7.]
Conclusion
In a nutshell, our skilled Support Engineers at Bobcares introduced us to the facets of translation in WordPress, namely, Internationalization and Localization. We also learned how to set these processes up to our advantage.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
var google_conversion_label = "owonCMyG5nEQ0aD71QM";
0 Comments