In order to meet the needs of global content operations, allowing your website to support the switching and correct display of multi-language content is a key step to expand the market and improve user experience.AnQiCMS (AnQiCMS) is a feature-rich content management system that provides an intuitive and powerful multilingual solution to help you easily meet this challenge.Next, we will discuss in detail how to achieve this goal in AnQiCMS.
The core concept of AnQiCMS multilingual support
AnQiCMS was designed from the outset to consider the need for multilingual content.The core feature list clearly points out that it supports the switching and display of multilingual content, meets the needs of global content promotion, and aims to allow content to directly face users of different languages, helping enterprises to expand their international market.System language package/Multi-site managementas well asTranslation tag at the template levelCombined in a way to ensure the internationalization of the website interface and the localization of content
1. Multilingual configuration of the system backend and built-in information
First, AnQiCMS provides multilingual support for its own interface. In the website background,Global SettingsIn it, you can find the 'default language package' option.Currently, the system is built with Chinese and English languages.After selecting the corresponding language package, the backend management interface and some built-in text generated by the system (such as certain prompt information, system messages, etc.) will be displayed according to the language you select.
It is noteworthy that the "default language pack" here is mainly for the system UI and built-in, non-user customized content.It will not automatically translate your articles, product descriptions, category names, and other core business content.For these core contents published and managed by users, a more flexible strategy needs to be adopted.
2. Multilingual implementation of core content: multi-site management
For articles, products, single-page websites, and other core content, AnQiCMS recommends using its powerfulMulti-site managementTo implement the distinction and management of multilingual versions. This means you can create an independent sub-site for each target language (such as:en.yourdomain.comrepresenting the English site,fr.yourdomain.comRepresents the French site), or through subdirectories (such as: yourdomain.com/en//yourdomain.com/fr/) to distinguish.
3. Translation at the template level and language switching
To enable the front-end website to display content and interface elements correctly according to the user's selected language, AnQiCMS provides convenient translation tags and multi-language site list tags in template design.
Translation of static text:{% tr %}Tag
For some fixed texts in website templates, such as navigation menu items, button text, copyright statements, etc., you can use AnQiCMS's{% tr %}Manage translation tags. This requires you to create a folder namedlocalesin the template directory, and create subfolders anddefault.ymlfiles for each language. For example:
./locales
├── en-us
│ └── default.yml (内容如:yourLocation: "Your Location")
└── zh-cn
└── default.yml (内容如:yourLocation: "您的位置")
Then, in your template, you can use{% tr "yourLocation" %}this method to call the translation. When the user switches languages, the system will automatically use the correspondingdefault.ymlRead and display the translated text in the file, allowing the website interface to seamlessly switch to the target language.
Language switcher and Hreflang tags:{% languages %}Tag
To provide users with convenient language switching functionality, you can use{% languages websites %}Label. This label can retrieve the list of all configured multilingual sites and provides information such as each site's language name, link, and icon. By traversing thiswebsitesVariable, you can easily build a language switch menu.
Here is an example of code to create a language switcher.
{%- languages websites %}
{%- if websites %}
<div class="language-switcher">
<span>切换语言:</span>
{%- for item in websites %}
<a href="{{item.Link}}" {% if item.Language == currentLanguage %}class="active"{% endif %}>
{%- if item.LanguageIcon %}
<img src="{{item.LanguageIcon}}" alt="{{item.LanguageName}}"/>
{%- else %}
{{item.LanguageEmoji}}
{% endif %}
{{item.LanguageName}}
</a>
{%- endfor %}
</div>
{%- endif %}
{%- endlanguages %}
This code snippet will generate a list of link, each link points to a site in a different language.item.LinkIt will automatically direct to the homepage of the corresponding language site.
To better support search engine optimization (SEO), especially to help search engines understand the structure of your multilingual content, it is recommended to place on the page's<head>the tag withhreflangProperty.{% languages %}The tag can also help you achieve this:
{%- languages websites %}
{%- for item in websites %}
<link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
{%- endfor %}
{%- endlanguages %}
This helps search engines correctly match different language versions of content to the target audience, avoid duplicate content issues, and enhance the search visibility in the international market.
Summary
By using AnQiCMS's system-level language package, multi-site management features, and flexible template translation tags, you can build a fully functional, user-friendly multilingual website. The core idea is to use multi-site management to isolate and publish different language versions of content, ensuring the quality of content localization; utilizing{% tr %}Label to translate static text in the template to maintain interface consistency; finally, through{% languages %}Label building language switching function and optimizing SEO, helping your website to succeed globally.
Frequently Asked Questions (FAQ)
Does the AnQiCMS 'default language package' setting automatically translate the content of the articles I publish?No, the default language package is mainly used to translate the AnQiCMS backend management interface and some built-in system information on the front end.The core content you publish, such as articles and product descriptions, needs to be manually created and managed in different language versions, usually through the multi-site management feature to achieve content isolation.
Can I post articles in multiple languages on the same site and switch through a dropdown menu?AnQiCMS is a core multilingual content management solution based on "multi-site management".This means you will create a separate site for each language to store the corresponding language content.It is technically possible to implement multilingual content switching within a single site through secondary development, but this may increase the complexity of content management and may not comply with the default design philosophy of AnQiCMS.Recommend using multi-site management to ensure clear and efficient content management.
What is
hreflangWhat is the role of tags in a multilingual website?hreflangTags are HTML attributes used to tell search engines that a web page is a specific language or regional version of content.It is very important in multilingual websites, it can help search engines display the most relevant web version to users who use specific languages or are located in specific regions, thus avoiding duplicate content issues, improving SEO effects, and enhancing user experience.{% languages %}These labels are automatically generated, simplifying the configuration.