Joke Collection Website - Bulletin headlines - How to build a bilingual and multilingual website in wordpress?
How to build a bilingual and multilingual website in wordpress?
Plugin for WordPress Multilingual Website–polylang
Plugin Center Search Poly Lang and install
Create Language
Polylang has 5 predefined languages. In the settings menu, find the language, select the name of the language you want to add from the drop-down menu, and then click Add Language.
If the language you want is not in the list, or you don't want the default settings, you can modify it yourself. Each language has five fields.
full name: the name of the language displayed on the website, for example: English, Fran? Ais, simplified Chinese, traditional Chinese.
regional setting: the language code used in WordPress must be filled in with the code consistent with the regional setting of WordPress, otherwise the topic translation will not work normally. Generally, it consists of two lowercase letters, an underscore and two uppercase letters. For example: en_US, fr_FR, zh_CN. However, some locales only use two or three lowercase characters, such as: ar, el, ckb.
language code: this code will be used in URL, and it is better to use two lowercase letters of ISO 639-1 language, such as: en, fr, cn ...
Text direction: the general language reads from left to right, but it also reads from right to left (Arabic, Hebrew). Polylang tells the topic whether to use LTR or RTL style. Note that not all themes support two text orientations (the default themes support 211 and 212).
sorting: the order of languages displayed on the language switching tool.
remember to click the add language button, and you can add it vigorously, because there is no limit. Polylang will automatically download language files for you.
Polylang will also try to download the default language files for the themes of 21, 211 and 212. If it fails, it can be downloaded manually using the above address, and then placed in the/WP-content/themes/your _ themes/languages directory.
set
default language: the default language used when someone visits the home page of your website for the first time.
if you install Polylang on an existing website, a red prompt will appear: some articles, pages, categories or labels have not been set in language. Do you want to set them as the default language? You can click here to quickly set the language of all existing articles, pages, categories and labels. It also applies to custom content types and custom taxonomies. Note that the URL of an article, page, category or label will not be modified.
detect browser language: after checking, if someone visits the homepage of your website for the first time, the language of the website will be set according to the settings of the user's browser. If the language of the website is not the language of the user's browser, then the default language will be used.
URL modification
Important options:
Set the language from the content: Polylang does not modify the URL as much as possible. By default, language information will be added to the URL only when necessary (mainly specification files), and it will not be added if not needed (articles, pages, categories, labels). This way, even if this plug-in is disabled, most important links will not be affected.
language code: for example, /en/, which will be added to all URLs when concise links are used. In this way, if this plug-in is disabled, each URL will lose its language information, that is, all URL links will be destroyed.
Other options for controlling URL:
Keep the URL of /language/: monthly profile in concise link, and it will be like this: /language/en/211/11/
Remove the URL of /language/: monthly profile from concise link, and it will be like this: /en/211/11/
It will be the default language. In this way, only the default language will hide the language information, so the URL of the monthly profile of the default language looks like this: /211/11/
Redirect the language page to the home page: this option is useless without using the static home page. For example, the homepage URL looks like this: /en/
More options to control language and translation:
Media: the title and description of the translation media.
Synchronization: You can avoid repetitive actions when creating translations of articles and pages, such as setting categories and labels, featured images, parent pages and so on. You can choose whether to synchronize or not. If there is a custom content type or classification on the website, you can also choose to use language and translation. Finally, don't forget to click the Save Changes button.
internationalization (i18n) and localization (l1n )
Otherwise, your theme will not show translation when displaying articles or pages. Check with the author of the topic whether the topic is international (translatable) and localized (translated) in the language you need. For more information, please refer to the WordPress Theme Development course on this website.
check whether there is a similar code in the header.php of the subject:
<; html < ? php language_attributes(); ? > >
Some browsers or robots will use this line of code to check your page language.
Language switcher
Language switcher widgets
To the widget's management page, you can find the language switcher, which currently has five options:
Display the language name
Display the logo
Force link to the home page
Hide the current language
Display it in the form of a drop-down menu
If you cancel "". If you check "Show in the form of drop-down menu", the logo will not be displayed, regardless of whether you choose to check the "Show logo" option.
If you check "Force Link to Home Page", the widget will always take visitors to the home page of the corresponding language. If you don't check, the language switcher will try to find the translation page. If you don't find it, you will return to the home page.
if "hide current language" is checked, the widget will not display the current language.
No matter which option is used, the language on the switch tool will only be displayed if at least one article or page uses this language. The logo image of
language can be found in the wp_content/polylang directory. For example, if the region is set to en_US, then the image en_US.png will be used.
navigation menu
your theme must support custom navigation menus, and you must use a theme area in the wp_nav_menu function. For example:
WP _ nav _ menu (array ('theme _ location' = > 'primary')); You 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 and choose the correct menu for each language.
you can add a language switch at the end of the menu. Check "Show language switcher at the end of menu".
if "display language name" and "display logo" are not checked, the language switcher will use the language name.
if "force link to home page" is checked, the language switcher will take the visitor to the home page in the correct language, otherwise it will look for the translation page (if it cannot be found, it will return to the home page).
if "hide current language" is checked, 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 and gadget titles. You can also choose different language formats and time formats for each language. Plug-ins or themes may add other strings to this list.
name: for convenience of sorting.
string: the string to be translated.
translation: the translation of each character string in different languages.
By default, all translated strings will be saved in the database, and there is a check box that allows you to clean up useless strings in the database.
translate categories or labels
it is very important to set the language of each existing category and label, otherwise they will not be displayed. To set the language, just select it from the drop-down menu below the description field.
translating 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 bar of the editing interface of an article or page, you can choose the language.
You have three options for each language:
You can do nothing if you don't want to translate the article.
if the translation already exists, fill in the article ID field.
if you want to create a new translation, click add link after the language. If the translation classification and tags are available, they will be automatically filled in the article translation, and so will the parent page.
synchronize metadata
Polylang synchronizes some metadata and options between an article or page and translation. The default options for synchronizing metadata are:
classification and labeling
custom fields
comment and ping status
top article and publishing date
article format
page level, page template, page sorting
featured images.
- Previous article:Ktv doesn't throw slogans.
- Next article:Warm and touching mother's day greetings
- Related articles
- The theme slogan of the company’s 30th annual meeting
- The slogan of creating a national civilized city is civilized, humorous and simple.
- What are the key points of ideological and cultural propaganda work in 2022?
- How much are the taxes and fees for commercial and residential buildings in Harbin?
- What props are used for the entrance of the sports meeting?
- Anyue lemon planting area
- Special departments of Daxian People’s Hospital
- Comments given to students by military training instructors
- Is Epson billiards Joe's?
- The best way to write the word respect is