How does AnQiCMS provide visitors with language switching options for content display?

In today's globally interconnected digital age, websites can provide content to users of different languages, which has become a basic requirement.No matter whether your business is aimed at the global market or simply wants to cover users in different dialect regions within the country, a website that supports language switching can significantly improve user experience and brand influence.AnQiCMS (AnQiCMS) understands this need and provides an efficient and flexible solution to help your website seamlessly switch between multilingual content.

AnQi CMS was designed with global operation needs in mind, its multilingual support feature is not just a simple switch, but built on a flexible and powerful architecture.The core lies in the 'Multi-site Management' capability.www.yourdomain.comWhile the English content is throughen.yourdomain.comorwww.yourdomain.com/en/Operate independently in various ways.This strategy brings significant advantages: different language sites can have independent SEO strategies, content structures, and user groups, thereby achieving more precise operations and promotion.

On this basis, Anqi CMS provides the core 'multilingual support' function.This includes the default language package settings at the system level.After you configure the Chinese or English language pack in the background, the system built-in management interface text, such as menu items, button names, etc., will automatically switch according to your choice.However, it should be clarified that this feature is mainly aimed at the system operation interface and will not automatically translate the articles, products, or single-page content published on your website.This means that if your website needs to provide both Chinese and English versions, you still need to create and maintain the corresponding content for each language.

So, how does AnQi CMS achieve multi-language switching in terms of website content presentation? We can understand it from two levels:

Firstly, for the actual content that visitors browse on the website, such as article details, product introductions, company profile pages, etc., this content needs to be created separately by operators in the background according to different language sites.For example, if you publish an article about the 'Advantages of AnQiCMS' on a Chinese site, then on an English site, you need to publish another article with the same content but in English, titled 'Advantages of AnQiCMS'.This "one content, one language" model ensures the accuracy and professionalism of translation, because human translation always conforms better to the context and the habits of the target audience than machine translation.

Secondly, for the static and structural text on the website, such as navigation menus, footer copyright information, common button text, form prompts, etc., AnQi CMS provides a very convenient 'translation tag' mechanism. You can create a folder named in the root directory of the website templatelocalesThe directory, and create a separate folder for each language (such aszh-cn/en-us)。Each language folder contains one or more.ymllanguage package files in thedefault.yml)。In thisymlIn the file, you can define key-value pairs, for example"yourLocation": "您的位置". In the template, when you need to display this text, just use{% tr "yourLocation" %}This translation tag.The system will automatically extract and display the correct text from the corresponding language package file based on the language selected by the current visitor.This greatly simplifies the maintenance of templates, no need to create a completely independent set of templates for each language.

After the multilingual preparation at the content and template level is ready, the next step is how to allow visitors to easily select and switch to their preferred language.The AnQi CMS provides the label 'Get multi-language site list'.{% languages websites %}Such a label, you can easily get a list of all configured multilingual sites.This tag will return an array containing information about each language site, you can iterate through this information to provide visitors with an intuitive language switch option.

For example, you can add code like this in the header or footer of a website:

{%- 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 %}
        {{item.LanguageEmoji}}
        {% endif %}
        {{item.LanguageName}}
    </a>
    {%- endfor %}
</div>
{%- endif %}
{%- endlanguages %}

This code generates a list of languages, each with a link to its corresponding language site.You can choose to display the name of the language (such as "Chinese", "English"), use language emojis (such as 🇨🇳, 🇬🇧), or custom language icons to make the switch options clearer and more beautiful.

To better inform search engines of the multilingual versions of your website and thus enhance international SEO effects, you can also add a<head>area.hreflangtag. Anqi CMS'slanguagesTags also support generating this information:

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

Such a multilingual implementation not only enhances the international image of the website, but also provides a friendly visit experience for visitors of different languages.They can easily choose the language version that best suits their needs, thereby better understanding your content and services.AnQi CMS, through its flexible architecture and powerful functions, provides a solid technical support for your website to go global.


Frequently Asked Questions (FAQ)

1. Will AnQi CMS automatically translate the article content on my website?Will not.The multilingual support of AnQi CMS is mainly reflected in the system architecture, allowing you to create and manage sites or content in different languages.But for specific articles, product descriptions, and other content, you need to manually create or translate them into the target language and publish them on the corresponding language sites.This ensures the accuracy and professionalism of the translation, better fitting the context of the target audience.

2. How can I add a new language version to my website?In most cases, you need to create a new site and bind a new domain (such as en.yourdomain.com) or configure a subdirectory (such aswww.yourdomain.com/en/). Then, you can publish the corresponding language content under this new site. Also, don't forget to update the website template'slocalesCreate a corresponding language package file under the directory (for exampleen-us/default.yml), used to translate the static text in the template.

3. What is the difference between the 'default language package' and 'translation tags'?The default language package is mainly used to control the language of the AnQi CMS backend management interface, which affects the menus, buttons, and other system-level text you see in the backend. The 'translation tags' (such as{% tr "key" %}It is used in front-end website templates, it allows you to store fixed text content in a language package file (.ymlIn it, and dynamically display the corresponding translated text based on the visitor's selected language.