Webico
Localization
WordPress theme contains a localization option which allows to make your site bilingual or multilingual. Your site can attract more visitors from other countries. Using plugins and other options listed below you can customize your site, add posts, create new tags or categories, and then easily change the language for each of them.
Manual Localization
WordPress offers a very easy option to change languages in your theme.
- go to Settings > General in your theme's dashboard;
- at the bottom of your page you will find Site Language option. Choose the needed language in the dropdown menu and click Save Changes button;
- after the language has been switched, you need to translate your theme. To do so, go to wp-content > themes > theme name > languages, where you should have the proper language files installed in this directory.
If you do not see the language you want to use in the list, you can manually install language packs in WordPress.
WordPress uses a gettext system for translations, where a main .pot template file can be found and used. Each language consists of two files: with .po and .mo extension. You will need a .mo file for your language.
- go to the WordPress translation teams page . Check if there is a WordPress translation available for your language;
- click on the percentage value to see the status of the translation progress in your language and then click on current WordPress version;
- you will be transferred to GlotPress (a web-based app used by WordPress team to manage and translate WordPress projects);
- go to the bottom until you see the Export section;
- in the dropdown, select Machine Object Message Catalog (.mo) and then click on Export link.
- repeat the same actions for Portable Object Message Catalog (.po) and then click on the Export link;
- download and unzip the language pack on your computer. Connect to your website using an FTP client. Once connected, upload the language files to /wp-content/languages folder;
- once the file has been uploaded, go to the WordPress dashboard;
- go to Settings > General > Site Language option, and you will find the language you have just uploaded.
Poedit
WordPress theme can also be localized by using Poedit program. Localization becomes possible because of using GNU gettext framework for translation and such types of files as POT (Portable Object Template), PO (Portable Objects) and MO (Machine Objects) files.
Installing Poedit
- to start your theme's localization you need to download and install Poedit;
- once Poedit has been installed, open it, and go to File > New Catalog;
- go to Catalog Properties window > Translation Properties tab > Fill in your project's information. Note! Each tab in the Catalog Properties window should be filled.
- go to the Sources paths tab. Enter the path for the folder which will be used by Poedit program to search for source files containing text you need to translate;
- go to the Sources keywords tab. Define the functions to be used to localize the text in files, _() and _e(). Click OK button;
- on this step name and save your POT file. We recommend to choose .pot extension and save the file in a folder in your theme directory;
- Poedit will scan folders specified in the Sources path tab, once you click OK button. The program will generate a list of the localized text in your theme's files;
- the final step - save your POT file, and your theme is ready for translation!
Localization using Poedit
- open Poedit and select Create new translation. In the pop-up window select WordPress theme you need to translate. Your theme's default translation template in THEMEXXX/lang/YYY.po (where THEMEXXX is the name of your theme and YYY – default language of the theme). Open it;
- in the appeared dropdown menu select a language you need to translate your theme to. Click OK button and go ahead to translate your theme;
- highlight any string you want to translate in the Source text section. In the Translation section enter a desired translation of the source string:
- after your theme has been translated, save the file in the same directory as the original template;
- upload the .po file you have saved on previous step, and .mo file (the same as you have saved, but containing .mo extension, is generated automatically by Poedit) to the corresponding directory on your hosting account;
- open wp-config.php file, which is located in your WordPress installation, and add it to the line: define ("WPLANG", "ZZZ");, where ZZZ is the name of the file you have used to save your translation;
- your theme will now appear translated!
Loco Translate Plugin
With Loco Translate you can do built-in translation and editing of your files via WordPress admin panel, and use such tools as extracting strings and generating templates. Loco Translate has protected language directory for saving custom translations. It supports native MO file compilation and PO features. The plugin has such important features as configurable PO file backups and built-in WordPress local codes.
Installing Loco Translate plugin
- unzip all files to the /wp-content/plugins/loco-translate directory;
- log into WordPress admin and activate the Loco Translate plugin through the Plugins menu;
- go to Loco Translate > Home in the left-hand menu to start translating.
Polylang plugin
Polylang plugin provides a number of useful options, such as RTL language support, ability to make your site either bilingual or multilingual, automatic copy of categories, post tags, etc. when adding a new post or page translation, and customizable language switcher.
Installing Polylang plugin
- unzip all files to the /wp-content/plugins/polylang directory;
- log into WordPress admin and activate the Polylang plugin through the Plugins menu;
- go to the languages settings page and create the languages you need;
- add the language switcher widget to let your visitors switch the language.
Make sure you are using WordPress 4.0 or later and that your server is running PHP 5.2.4 or later (same requirement as WordPress itself). If you tried other multilingual plugins, deactivate them before activating Polylang.
Note! Your theme should be with the corresponding .mo files (Polylang automatically downloads them when they are available for themes and plugins in this repository). If your theme is not internationalized yet, please refer to the Theme Handbook.
The WordPress Multilingual Plugin (WPML)
WPML plugin is a user-friendly plugin which help you to build multilingual sites both personal and corporate ones. With WPML you will be able to translate pages, menus, posts and the whole texts. Every WordPress theme that uses API runs multilingual with this plugin.Installing WPML plugin
- log in to your WPML.org account;
- go to the Downloads section;
- log into WordPress admin and activate the Polylang plugin through the Plugins menu;
- download the needed WPML components. You will receive a ZIP file for each one of WPML’s components;
- unzip each file. A directory will be created;
- download the needed WPML components. You will receive a ZIP file for each one of WPML’s components;
- upload the unzipped directories to /wp-content/plugins directory;
- go back to the Plugins page and enable the newly uploaded/added plugins;
- follow WPML’s setup wizard to add languages to your site.
The first time you use WPML, you need to manually download it and install. Then, register to receive automated updates to future versions.
You can find more detailed instructions and guides in WPML Documentation.
Additional information about Localization can be also found on Zemez Support Portal.