Skip to main content
We are Brand SEO Beijing serving international business, your marketing partner, Contact us by mi@mgsh.com.cn

Building Multilingual Websites – Using Polylang Plugin

Multilingual website optimization requires multilingual plug-ins, of which PolyLang is a commonly used language plug-in.
Translated the official documentation of the Polylang plugin. You can use the Polylang plugin to create a multilingual WordPress website. In the attachment, you can download the simplified Chinese translation file of this plugin. After decompressing, put it in the languages ​​directory of the Polylang plugin.
Polylang management interface

create language

Polylang has 50 predefined languages. In the Settings menu, find Languages, select the name of the language you want to add from the drop-down menu, and click Add Language.
If the language you want is not in the list, or you don't want the default setting, you can modify it yourself, there are 5 fields for each language.

  • full name: The name of the language displayed on the website, such as: English, Français, Simplified Chinese, Traditional Chinese.
  • regional settings: The language code used on WordPress, must fill in the code consistent with the WordPress locale, otherwise the theme translation will not work properly.It usually consists of two lowercase letters, an underscore, and two uppercase letters.For example: en_US, fr_FR, zh_CN.However, there are also some locales that use only two or three lowercase characters, such as: ar, el, ckb.
  • language code: This code will be used on URLs, preferably in ISO 639-1 languages ​​with two lowercase letters, such as: en, fr, cn …
  • text direction: Normal languages ​​are left-to-right, but right-to-left languages ​​are also read (Arabic, Hebrew). Polylang will tell the theme whether to use the LTR or RTL style.Note that not all themes support both text orientations (default 2011, 2012 themes support).
  • Sort: The order of languages ​​displayed on the language switcher.

Remember to click add language Buttons can be added as there are no restrictions. Polylang will automatically download the language files for you, if not, you can download them manually: svn.automattic.com/wordpress-i18n/ .Put the downloaded language files in the /wp-content/languages ​​directory.
Polylang will also try to download the default 2010, 2011, 2012 language files for these themes. If they are not downloaded, they can be downloaded manually using the above address, and then placed in the /wp-content/themes/your_theme/languages ​​directory.
For more information read: codex.wordpress.org/WordPress_in_Your_Language

Setting

  • Default Language: The default language used when someone first visits your website's homepage.
  • If you install Polylang on an existing website, a red message will appear: Some articles, pages, categories or tags have not yet set a language, do you want to set them as the default language?You can click this to quickly set the language of all existing articles, pages, categories, tags.Same goes for custom content types, custom taxonomies.Note that the URLs of articles, pages, categories or tags will not be modified.
  • Detect browser language: After checking it, if someone visits the home page of your website for the first time, the language of the website will be set according to the user's browser settings.If the language of the user's browser is not included in the website's language, the default language will be used.
  • URL modification

Important choices:

  • Set language from content:Polylang does not modify URLs as much as possible. By default, language information is added to URLs only when needed (mainly regulations), and will not be added (articles, pages, categories, tags) if they are not needed.This way, even if the plugin is disabled, most important links will not be affected.
  • language code: For example: /en/ will be added to all URLs when using compact links.So if the plugin is disabled, each URL will lose the language information, that is, all URL links will be broken.

Other related options for controlling URLs:

  • Keep /language/ in the concise link: the URL for the monthly profile would look like this: www.yoursite.com/language/en/2011/11/
  • Remove /language/ from concise links: the URL for the monthly profile will look like this: www.yoursite.com/en/2011/11/
  • Hide the URL language information for the default language, so that only the default language will hide the language information, then the URL of the monthly profile for the default language looks like this: www.yoursite.com/2011/11/
  • Redirect language pages to homepage: This option is useless without a static homepage.For example, the homepage URL looks like this: www.yoursite.com/en/

More options to control language and translation:

  • Media: Translate the title and description of the media.
  • Synchronization: Create translations of articles and pages to avoid repetitive actions, such as setting categories and tags, featured images, parent pages, and more.You can choose whether to use synchronization or not.You can also choose to use languages ​​and translations if there are custom content types or taxonomies on the site.Don't forget to click the Save Changes button at the end.

Internationalization ( i18n ) and localization ( l10n ) of themes

This step is important, otherwise your theme will not display translations when displaying articles or pages.Check with the theme author to see if the theme is internationalized (translatable) and localized (translated) for the language you want.For more information, please refer to Ning Hao.com's "WordPress Theme Development" course.
Check your theme's header.php for code like this:
<html <?php language_attributes(); ?>>
Some browsers or robots will use this line of code to check the language of your page.
language switcher

Language switch widgets ( Widgets )

Go to the widget's admin page, you can find the language switcher, which currently has five options:

  • Display language name
  • show sign
  • Force link to homepage
  • hide current language
  • Display as a drop-down menu

If you uncheck the "Show language name" and "Show logo" options, the gadget will display the language name.If you check "Use drop-down menu to display", the logo will not be displayed, regardless of whether you choose to check the "Show logo" option.
If you check "Force link to homepage", the gadget will always take the visitor to the homepage in the corresponding language. If you leave it unchecked, the language switcher will try to find the translation page. (If not found, it will return to the home page).
If "Hide current language" is checked, the widget will not display the current language.
Regardless of which option is used, the language on the toggle tool will only be displayed if at least one article or page uses that language.
Language marking images can be found at wp_content/polylang If it is found in the directory, for example, the locale is set to en_US, then the image en_US.png will be used.

Navigation menu

Your theme must support custom navigation menus and must use a theme area in the wp_nav_menu function.E.g:
wp_nav_menu(array('theme_location' => 'primary')); can
wp_nav_menu(array('menu' => 'nav menu')); No
You can create menus for each language.Then go to the Language Settings page in the Menu tab to select the correct menu for each language.
You can add a language switcher at the end of the menu.Check "Show language switcher at end of menu".
If you uncheck "Show language name" and "Show logo", the language switcher will use the language name.
If "Force link to homepage" is checked, the language switcher will take the visitor to the homepage in the correct language, otherwise it will look for a translation page (if not found, it will return to the homepage).
Check "Hide current language", the language switcher will not display the current language.
Finally remember to click the Save Changes button.

string translation

Polylang can translate user-defined strings such as website titles, slogans, widget titles.You can also choose a different language format and time format for each language.Plugins or themes may add other strings to this list.
Name: For ease of sorting.
String: The string to translate.
Translation: The translation of each string in different languages.
By default all translated strings are stored in the database, there is a checkbox that allows you to clean up unused strings in the database.

Translate categories or tags

It is very important to set the language of each existing category and tag, otherwise they will not be displayed.To set the language, just select it from the drop-down menu below the description field.

Translate articles or pages

It is very important to set the language of each existing article and page, otherwise they will not be displayed.On the right sidebar of the editing interface of an article or page, you can select a language.
For each language you have three options:

  • You can do nothing if you don't want to translate the article.
  • If the translation already exists, enter the ID of the article in the Article ID field.
  • If you want to create a new translation, click the Add link after Language.If the translated categories and tags are available, they will be automatically filled in the article translation, as well as the parent page.

Sync metadata
Polylang will synchronize some metadata and options between articles or pages and translations. The default metadata synchronization options are:

  • Classification and Labeling
  • custom field
  • Comments and ping status
  • Pinned article and publication date
  • Article format
  • Page Hierarchy, Page Templates, Page Sorting
  • Featured Image

Extended reading:
Under the epidemic situation, the limited company built a website for free and made its own website ranking!
What does SEO optimization have to do with brand building?
SEOer Partner – SEO Cooperation Join – SEO Military Academy
How can SEO vendors improve customer brand value?
What competencies should a valuable SEOer possess?

Back to Top