AnQiCMS Multi-language Site Switching and Deep Analysis of Default Language Package Settings
In today's globalized internet environment, website support for multiple languages has become a key factor in expanding markets and improving user experience.AnQiCMS as a system dedicated to providing an efficient and customizable content management solution also offers flexible and powerful multilingual support.This article will elaborate on how to implement the switching of multilingual sites in AnQiCMS, as well as the setting of the default language package.
I. Default Language Package Settings: Management Interface and System Text
Firstly, let's understand the 'default language package' settings in AnQiCMS.This setting is mainly for the system backend management interface and the system prompt text built into AnQiCMS. It determines the language you use when operating the backend.
To configure the default language package, you can follow the steps below:
- Enter background settings:After logging in to the AnQiCMS management background, you can find the 'Background Settings' option in the left navigation bar.
- Select global function settings:After clicking "Background Settings", select the first submenu item "Global Function Settings".
- Configure the default language package:In the "Global Function SettingsAnQiCMS currently includes Chinese and English language packages for you to choose from.You can choose 'Chinese' or 'English' based on your usage habits or team needs.
Important reminder:Here is the default language package setting that only changes the language of the system interface.For example, menu names, button text, and system notifications will be displayed in the language you choose.It will not automatically translate or switch the content you publish on the website frontend (such as articles, product descriptions, category names, etc.), which needs to be realized through the subsequent introduction of frontend multilingual switching and content management strategies.
II. Front-end multi-language switching: Content localization and user experience
The default language package is configured for the background management interface, and the next step is how to implement the switch of multilingual content on the website front-end, so that users of different languages can see the corresponding content and provide a localized browsing experience.This mainly depends on the powerful content management capabilities and flexible template tags of AnQiCMS.
AnQiCMS provides a namedlanguagesThe template tag, specifically used to retrieve the list of configured multilingual site lists. Through this tag, you can dynamically generate a language switcher in the website template and provide for search engineshreflangTags, to optimize the SEO of multilingual websites.
1. Get the list of multilingual sites and implement a switcher.
languages标签会返回一个包含所有已配置多语言站点信息的数组对象。您可以通过循环遍历这个数组,创建前端的语言切换链接。
{%- languages websites %}
{%- if websites %}
<div>
<span>切换语言:</span>
{%- for item in websites %}
<a href="{{item.Link}}">
{%- if item.LanguageIcon %} {# 如果有语言图标,则显示图标 #}
<img src="{{item.LanguageIcon}}" alt="{{item.LanguageName}}"/>
{%- else %} {# 否则显示 Emoji 或语言名称 #}
{{item.LanguageEmoji}}
{% endif %}
{{item.LanguageName}}
</a>
{%- endfor %}
</div>
{%- endif %}
{%- endLanguages %}
In the above code:
websitesThe variable contains detailed information for each language site.item.LinkIt is the access link for the language site.item.LanguageNameIs the display name of the language (such as “Chinese”, “English”).item.LanguageEmojianditem.LanguageIconIt can be used to display icons or emoticons representing the language.
You can place this code in the header, footer, or sidebar of the website, or any other location where users are accustomed to finding the language switch function.
2. UtilizehreflangLabel optimization SEO
For multi-language sites, in order to help search engines understand the relationship between different language versions, AnQiCMS also supports throughlanguagesTag GenerationhreflangLabels. This is crucial for avoiding duplicate content penalties and ensuring that users see the most relevant language version in the search results.
Place the following code in your website template's<head>block:
{%- languages websites %}
{%- for item in websites %}
<link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
{%- endfor %}
{%- endLanguages %}
Hereitem.LanguageIt will output the corresponding language code (such aszh/en)item.LinkThe URL for the language version is.
III. Management strategy for multilingual content.
To truly implement the front-end language switching of multi-language content, you need to combine the 'Multi-Site Management' feature of AnQiCMS, and create and manage independent content for each target language.
Create an independent language site:One of the core advantages of AnQiCMS is that it supports the creation and independent management of multiple sites. You can set up an independent site for each target language, for example:
- Main Station (default language, such as Chinese):
www.yourdomain.com - English Site:
en.yourdomain.comorwww.yourdomain.com/en/ - Other Language Sites:
fr.yourdomain.comorwww.yourdomain.com/fr/In this mode, each language site has its own domain name or subdirectory, and content, templates, and SEO settings can be managed independently.You can add and configure these sites in the "Multi-site Management" feature in the background.
- Main Station (default language, such as Chinese):
Targeted Content Creation and Management:In each independent language site, you can create and manage the content specifically for that language.For example, publish English articles and English product information on English sites, while publishing Chinese content on Chinese sites.AnQiCMS provides a flexible content model, document management, categorization, and tagging features to ensure you can efficiently organize and publish content in different languages.
Template Localization:Even if the content is independently managed, the website template also needs to be localized to ensure that interface elements, navigation, system prompts, and other elements also conform to the habits of the target language. In addition to the system text switching provided by the default language package, you can also use the translation tags in the AnQiCMS template tags
{% tr %}Handle custom text translations in the template. This requires you to create the corresponding.localesfolders and language files (such as.en-us/default.yml), and then use them to call the translated content in the template.{% tr "your_key" %}to call the translated content.
Through reasonable configuration of the default language package, clever use oflanguagesTemplate tags, combined with multi-site management strategies, AnQiCMS can help you efficiently build and maintain enterprise-level websites with multilingual capabilities.Whether it is to improve user experience or expand the international market, AnQiCMS provides a solid technical foundation and flexible operational space.
Common Questions (FAQ)
- **Question: Why did I set the background