How to enable or configure the core multilingual function of AnQiCMS?

As an experienced website operation expert, I fully understand the importance of multilingual websites for enterprises to expand into the international market.auto CMS (AnQiCMS) is an efficient and flexible content management system, naturally understands this, and provides powerful and practical multilingual support features.

Today, let's delve into how AnQiCMS enables and configures its core multilingual feature, helping your website easily go international.

The cornerstone of the multi-language function of AnQi CMS

In AnQiCMS, the implementation of multilingualism is not a simple one-click operation, it integrates multiple levels of system design to ensure that both content and interface can accurately reach users of different languages. Its core advantage lies in its ability to supportMulti-site managementandFlexible Content ModelThese are a solid foundation for implementing multilingual websites. Through AnQiCMS, you can make content directly accessible to global users, greatly enhancing the efficiency of international market expansion.

System built-in language package support, which is the first line of defense for multilingual functionality. But it is clear that AnQiCMS handles "multilingual" mainly in two dimensions: one isBackground management interface and system built-in prompt language switchingSecondly,The actual content displayed on the website front end (articles, products, pages, etc.) as well as the translation of static text in templates。Understanding these dimensions is the key to efficiently configuring multi-language features.

Step 1: Configure the system default language pack (backend interface and built-in prompts)

Firstly, AnQiCMS provides support for the default language package of the system, which mainly affects the background management interface as well as some prompts generated by the system on the frontend.

You can find in the AnQiCMS backendGlobal SettingsFind the "Default language package" option.Currently, the system is built with Chinese and English language packs for your selection.Once you set the default language here, the corresponding background interface text, system messages, and so on will be displayed in the selected language.

It is important to note that this setting only changes the built-in text display of the system and will not automatically translate the articles, documents, categories, and other content that have already been published on your website.This means that for actual content, we need to adopt a more refined strategy.

Step 2: Implement deep multilingualization of the website's frontend content

To allow your website content (such as news articles, product details, about us pages, etc.) to be presented in multiple languages to visitors, AnQiCMS mainly recommends usingMulti-site managementandtemplate translation tagsTo achieve this in combination, which provides great flexibility for content independence and SEO optimization.

2.1 Adding multilingual support to the template static text ({% tr %}Tag)

In your website template, many navigation menus, button text, footer information, etc. are usually static and require translation for different languages. AnQiCMS provides{% tr %}translation tags.

To enable this feature, you need to create a folder named in the root directory of the template.localesThis directory. In thislocalesdirectory, create a separate folder for each target language (for example,)en-usFor American English,zh-cnFor Simplified Chinese,jaused for Japanese, etc.). Within each language folder, you then create a.ymlFile (usually nameddefault.yml).

For example, your file structure might look like this:

/template/your_theme/
├── locales/
│   ├── en-us/
│   │   └── default.yml
│   └── zh-cn/
│       └── default.yml
└── ... (其他模板文件)

Inzh-cn/default.ymlIn it, you can define key-value pairs:

"yourLocation": "您的位置"
"readMore": "阅读更多"

Anden-us/default.ymlauto

"yourLocation": "Your Location"
"readMore": "Read More"

When you need to use these static texts in the template, you can simply call{% tr "yourLocation" %}or{% tr "readMore" %}The system will automatically load and display the corresponding translation content based on the current website's language settings, allowing your website interface to switch seamlessly.

2.2 Manage multi-language content (through multiple sites)

For dynamic content such as articles, products, and single-page websites, AnQiCMS encourages you to adopt the 'multi-site' strategy.This means that the content of each language can be considered as an independent "site", although they may share the same core program of AnQiCMS, they are independent in content management.

The specific operation process is as follows:

  1. Plan a separate domain name or subdirectory for each language.For example,www.yourbrand.comFor the Chinese site,en.yourbrand.comorwww.yourbrand.com/enFor the English site.
  2. Create a new site for each language through the "Multi-site Management" feature of AnQiCMS.When creating a new site, you need to specify a separate database name and site root directory for it (even if they share the same AnQiCMS program directory), and set the corresponding website address and administrator account password. For example, the database name for an English site isyourbrand_en_db, The root directory of the site is/app/yourbrand_en.
  3. Publish and manage the corresponding language content in each independent language site.For example, publish English articles in the English site backend and Chinese articles in the Chinese site backend.The benefits of doing this is that the content in each language can be optimized independently for SEO, keyword settings, etc., without interfering with each other.

This separation of management approach, although it may require you to switch between different sites to publish content, brings significant advantages such as clear content structure, independent database, and maximized SEO effects, which is very suitable for enterprise-level and global content operations.

Third step: Display the language switcher on the website frontend ({% languages %}Tag)

To make it convenient for visitors to switch the website language, AnQiCMS provides{% languages %}tags to build the language switcher.

This tag can retrieve the list of all multilingual sites that have been configured.You can iterate over these sites in the template to display their language names, links, even language emojis or icons.

The following is a sample code snippet for creating a language switcher:

{%- languages websites %}
{%- if websites %}
<div class="language-switcher">
    <span>切换语言:</span>
    {%- for item in websites %}
    <a href="{{item.Link}}" {% if item.Nofollow == 1 %} rel="nofollow"{% endif %}>
        {%- if item.LanguageIcon %}
        <img src="{{item.LanguageIcon}}" alt="{{item.LanguageName}}" />
        {%- else %}
        {{item.LanguageEmoji}}
        {% endif %}
        {{item.LanguageName}}
    </a>
    {%- endfor %}
</div>
{%- endif %}
{%- endLanguages %}

This code will enable your website to display a clear language switch option, which users can click to jump to the website of the corresponding language.

Fourth step: Optimize International SEO (Hreflang Tags)

For multilingual websites,hreflangTags are the key to international SEO.It can tell search engines which pages are alternative language versions of the same content, thus avoiding duplicate content issues, and ensuring that users can see the correct language pages when searching.

You can use{% languages %}Tags on your website,<head>Some parts are dynamically generatedhreflangTags:

{%- languages websites %}
{%- for item in websites %}
<link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
{%- endfor %}
{%- endLanguages %}

This code will generate a separate version for each language of the website<link rel="alternate" hreflang="xx">Label, of whichhrefpoints to the URL of this language version,hreflangthen specifies the language code (for examplezh-CNoren-US). This is crucial for improving your website's visibility and ranking in global search engines.

Summary

The Anqi CMS provides a comprehensive solution for building efficient multilingual websites through its multi-site management, flexible template tags, and deep SEO support.From the backend system language configuration, to the translation of static text in front-end templates, to the independent multi-site management of core content, and finally to the language switching display and SEO optimization, AnQiCMS strives to provide operators with a stable, flexible and easy-to-use tool.As long as you follow the above steps and reasonably plan and configure, your AnQiCMS website can easily overcome language barriers and successfully expand into the global market.

Common Questions (FAQ)

1.How does AnQiCMS handle the multilingual translation of dynamic content such as articles, products, etc?Is it directly adding different language versions on the same content editing page, or are there other methods?

AnQiCMS mainly achieves multi-language translation of dynamic content through “Multi-site Management”.This means that each language version of the article or product is usually created as an independent website content item and managed in the corresponding language's "site".For example, you will have a Chinese site for publishing Chinese articles, and an English site for publishing English articles.