By default, WordPress does not offer the ability to create a multilingual site, however, we can add multilingual functionality to our WordPress website through plugins or online translation services. Adding multilingual content to a website is essential for some individuals or companies who want to do international business. Characterized by many WordPress websites that do foreign trade business, they often need to create content in several languages. Here we will discuss how toDeveloping WordPress Multilingual WebsitesThe
The first method: creating a multilingual site through the WordPress Multilingual plugin
WordPress multilingual plugin, the earliest is WPML, the most powerful, and then Polylang, as powerful as the setup is simpler than the WPML plugin, and then qTranslate. below we first look at the use of Polylang multilingual plugin to create a multilingual site method.
Step 1: Add Language
After the Polylang plugin is installed, the settings option is in "Settings > Language", add the language in the settings.
Step 2: Add translations to existing articles
In the Edit Article screen, click the "+" sign at the Multi-language setting, and then jump to a page to publish articles in the corresponding language, and start adding the corresponding version of the language.
Step 3: Add the language switching tool to the main navigation menu
Polylang also provides us with a language switcher, which can be added via the main navigation menu or the sidebar.
If you want to add Polylang's language switcher to a custom area, you can do so via , please refer to the article in the version for details on how to use it:WordPress Multilingual Plugin Polylang Theme Function Reference
The second way to create a multilingual site is through the WordPress Muiltisite multisite network.
This method doesn't technically count as creating a multilingual WordPress site, but it works the same way as using the Polylang plugin to create a multilingual site. However, the effect is the same as using the Polylang plugin to create a multilingual website, and the multiple languages are independent of each other. The content of the multilingual site can be different, which is different from using the Polylang plugin. It is recommended to use sub-domains when creating multilingual sites with Multisite Network.
Using the same theme with different databases
Sites in a multisite network can share the same WordPress ThemeThis is a great convenience when creating multilingual sites using a multisite network. You only need to develop an internationalized theme, use this theme in various language sub-sites, display the corresponding language according to the language of different sub-sites, and use poedit to translate the fixed strings in the theme into the corresponding language.
Display language switching tools in multilingual sites created using a multisite network
In a multilingual site created using a multisite network, the language switcher needs to be implemented by us. The idea is very simple, determine the language of the current site, and then through the php string replacement function to replace the second-level domain names of various languages can be, the example is as follows.
$lang = get_locale();
//returns the language code for zh_CN or en_US
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
// Get the full current URL
$en_link = str_replace('http://cn', 'http://www', $link);
$cn_link = str_replace('http://www', 'http://cn', $link);
If we want to make it a little easier to manage, we can use the MultilingualPress Multilingual Site Pluginto manage the association between sub-sites of different languages , the plugin through a lightweight interface , the different languages between the sub-sites of the content association , very convenient .
summarize
Both methods have their own characteristics, as for which method is better, there is no absolute conclusion, in the end, which method to use to develop WordPress multilingual website, according to the content of the multilingual website, if each article has a corresponding multilingual version, use Polylang plugin is undoubtedly more convenient, if the content of each language is not the same, then use the If the content of each language is different, then using WordPress Muiltisite is more suitable.
17 thoughts on “WordPress 多语言站点的开发设置方法 —— Polylang 插件或多站点方式”
Hello:
WPML
How to translate static in PHP to another language.
Plugins
WPML Multilingual CMS
WPML String Translation
WPML Translation Management
WPML is not used much, but static strings can be translated via .po files.
After testing, Polylang is indeed much simpler than WPML, thanks for sharing.
How to use polylang plugin, its switch button can be placed on the home page, free to switch the language of the page?
Inside the widget, you should find the language switching widget.
Can polylang put the same page in two languages?
Can polylang translate woocommerce?
There are plugins that are compatible with WooCommerce, so do a search and see.
My first plan was to build a separate site for multilingual, after reading this post of yours, I would like to inquire whether it is more convenient to build a separate site or use this plugin during the actual operation?
It's important to consider the case of a later website revamp or something.
If you want to revamp your site later on, considering that you may need to change some theme settings, it's obviously more convenient to use the Polylang plugin. To make it multisite, you need to change the theme settings twice.
I tested the plugin last night and felt it would be better to do two separate sites with high customizability.
Yes, but with two sites it's more work to maintain.
It should be about the same amount of work, just get it in the pre-translation, you use the plugin like the same article to post two articles, and the same for both stations to post only two articles.
Yes, it's about the same amount of work in terms of posting articles.
Two sites are more free and can have customized operations
Why is it that when I add a widget to the menu, it's only in Chinese and not in any other language?
Do I need to pay for these two plugins?