In an era of increasing globalization, it is an important step to allow your website content to be presented in multiple languages to expand the market and serve users in different regions.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that fully considers this need, providing a variety of solutions to help you easily configure and switch between multilingual content.
Next, we will explore how to effectively manage and display multilingual content in AnQi CMS.
The multilingual concept of AnQi CMS: distinguishing between system and content.
In Anqi CMS, multilingual support is mainly reflected in two levels:
- System language package:This mainly affects the background management interface and some built-in system prompts. For example, you can choose to display the background interface in Chinese or English.
- Content-level multilingual:This is what we commonly call the multilingual display of website content (articles, products, single pages, etc.)Flexible strategies are provided by Anqi CMS, allowing you to choose the implementation method that suits your actual needs.
It is very important to understand the difference between the two. Switching the system language package will not automatically translate the content of your website articles, while displaying website content in multiple languages requires you to adopt corresponding strategies for configuration and management.
Configure the system-level language package
First, let's take a look at how to configure the system-level language of Anqi CMS. It's very simple, just a few steps to complete:
After entering the Anqi CMS backend management interface, find the menu on the left“Background Settings”and click to enter, selectGlobal function settings.
In this page, you will see a name“Default language package”The option. Anqi CMS currently built-in Chinese and English language packages. You can choose 'Chinese' or 'English' as needed.
Select and save after, your admin interface and some system default prompts (such as "Home", "Contact us", etc. are passed through the template{% tr "yourLocation" %}The static text called by the label will switch to the corresponding language.
Please note that, as mentioned earlier, this setting will not automatically translate your articles, product descriptions, and other dynamic content. That part requires a more refined strategy to manage.
Manage multilingual content: Flexible content strategy
The AnQi CMS provides two main content multilingual management strategies, you can choose according to your business scale, content independence, and operating costs.
Strategy one: Utilize multi-site management to achieve fully independent multi-language sites
For scenarios where the content has high independence, SEO strategies require high customization, or it is desired for each language version to have an independent domain and management team, the AnQi CMS is designed.Multi-site managementThe feature is your ideal choice.
Through multi-site management, you can create an independent secure CMS site for each language. For example, you may have:
www.yourdomain.comAs the Chinese main stationen.yourdomain.comorwww.yourdomain.com/en/As an English sub-site
How to implement:
- Create multiple site instances:You can deploy multiple AnQi CMS instances on the same server, each instance corresponds to a language version.The AnQi CMS supports running multiple instances on a single server through different ports, and it uses reverse proxies (such as Nginx, Apache, Baota Panel, 1Panel, etc.) to direct different domain names or subdirectories to different instances.In the "Multi-site Management" section of the AnQi CMS backend, you can conveniently add and configure these new sites, specifying independent databases and root directories for each site to ensure data does not interfere with each other.
- Publish content independently:The backend of each language site can independently publish and manage the content of that language. For example, on the English site's backend, you only publish English articles and English product information.
- Template and data interconnection (optional):Although the content is independent, you can achieve a certain degree of interconnectivity at the template level.For example, on a Chinese site page, you may need to display the corresponding English version link.This can be used with the Anqi CMS template tags in
siteIdParameters to call data from other sites.- For example, if you want to display a specific document from another site (assuming the English site with site ID 2) on the current site, you can use:
{% archiveDetail enArticle with name="Title" id="123" siteId="2" %} <p>对应的英文文章标题:{{ enArticle }}</p> - Similarly, when implementing language switching on the front end, it is also necessary to obtain links to all language sites, which will be detailed later.
- For example, if you want to display a specific document from another site (assuming the English site with site ID 2) on the current site, you can use:
The advantage of this method lies in:Content is completely isolated, management is clear, which is conducive to independent SEO optimization and operation for different language markets.
Strategy two: Manage multi-language fields through content models within a single site.
If your multilingual content differences are not great, or your budget is limited and you do not want to maintain multiple independent CMS instances, you can go through within a secure CMS siteCustom content modelManage multilingual content.
How to implement:
- Extend the content model:AnQi CMS provides the "Flexible Content Model" feature. You can add language-specific fields for "Articles", "Products", or custom content models.
- For example, in your article model, in addition to the default
TitleandContentyou can also add:Title_EN(English title)Content_EN(English content)Title_ES(Spanish title)Content_ES(Spanish content)
- These custom fields can be configured under the "Content Management" section,“Content Model”choose the field type (single-line text, multi-line text, etc.), and name it.
- For example, in your article model, in addition to the default
- Fill in when content is published:When publishing articles or products, editors need to manually fill in the content corresponding to each language.
- The condition is displayed in the template: In the front-end template, you can use the language selected for the current page (usually determined by URL parameters or cookies), to
ifLogical judgment tag to display the corresponding language content.- For example, in
detail.htmlIn the detail page template:{% if currentLanguage == "en" %} <h1>{{ archive.Title_EN }}</h1> <div>{{ archive.Content_EN|safe }}</div> {% else %} <h1>{{ archive.Title }}</h1> <div>{{ archive.Content|safe }}</div> {% endif %} currentLanguageThis variable usually needs to be judged on the backend and passed into the template.
- For example, in
The advantage of this method lies in:The maintenance cost is relatively low, all content is managed on a single backend, making it convenient for content editors to operate.However, for websites with large amounts of content and many languages, it may lead to a complex content model that is not as clear to manage as multiple sites.
Language switching is implemented on the front end.
No matter which strategy you adopt, you need to provide users with a convenient language switching function on the front end. Anqi CMS provides this for you.languagesLabel, allows you to easily build a language switcher and optimize SEO.hreflang.
Language switcher
languagesThe tag can retrieve the list of all multilingual sites configured (if multiple sites are configured).You can add a language switch button or dropdown menu at the top, bottom, or other prominent location on the website.
`twig {%- languages websites %}