How to configure and use the multi-language support feature of AnQiCMS?

In the current globalized digital environment, a website that supports multiple languages can undoubtedly greatly expand its user base and enhance its brand influence.AnQiCMS (AnQi Content Management System) is an efficient tool designed specifically for enterprise-level content management, naturally well-versed in this field, and provides comprehensive and flexible multilingual support functions.As an experienced website operations expert, I will guide you to deeply understand how AnQiCMS implements multi-language configuration and usage, helping your website go international.

The core concept of AnQiCMS multilingual support

In AnQiCMS, multilingual support is not just about translating all text, but takes a layered and flexible strategy.It divides the multilingual needs of the website into several levels: system interface language, translation of fixed text in templates, and the most core, multilingual site management that carries the business content.Understanding this core concept is the key to efficiently configuring and using the AnQiCMS multilingual function.

In short, AnQiCMS encourages the management of content in different languages (such as articles, product details, single pages, etc.) in independent sites, which complements its "multi-site management" feature.At the same time, for the background operation interface, system prompt information, and some fixed text in the template that does not change with the content, it is realized through built-in language packages and template translation tags.

Configure and use the specific steps of AnQiCMS multilingual feature

Step 1: Build multilingual site architecture

AnQiCMS handles multilingual content mainly through the 'Multi-site Management' feature.This means that if you plan to have a Chinese version and an English version of the website, you will usually establish an independent website for each language version.The benefits of doing so are that each language site can have its own domain, independent content, independent SEO optimization strategy, and they do not interfere with each other, making management clearer.

In AnQiCMS backend, you can easily add a new language site through the "Multi-site Management" module. When creating a new site, you can configure an independent domain for it (for example,en.yourdomain.comoryourdomain.com/en/),and specify a default template.Although the content is independent, these sites all share the same AnQiCMS core program and database, which greatly simplifies the complexity of deployment and maintenance.

Operation prompt:When adding a new site, please make sure to specify a "default language pack" that matches the language (such as "English" for an English site), which will affect the language of the new site's backend interface and some system prompts.

第二步:Configure the default language package and backend language

AnQiCMS has built-in multiple language packages for translating the back-end operation interface, system prompt messages, and some common texts that do not belong to the article content.You can find the 'Default Language Pack' option under 'Global Settings' in 'Background Settings'.

When you select a specific language package (such as “English”) for a site, the backend management interface of that site will be displayed in English, and built-in system-level texts such as “Read More”, “Latest Articles”, etc. will also be switched to English accordingly.

Important notice:The default language package mainly affects the text at the system level.Your article title, content, category name, and other specific business content will not be automatically translated.The translation of this content requires you to create and manage it independently on each language site.

Step 3: Use the template to translate tags ({% tr %})

For some hard-coded texts in the website front-end template that do not change with the article content (such as "Home{% tr %}Translate label. This makes the UI text translation of the template very efficient.

To use this feature, you need to create a file named in the root directory of the current template.localesThe folder. In this folder, create a subfolder for each language (for examplezh-CNRepresents Simplified Chinese,en-USrepresenting American English). In each language folder, create anotherdefault.ymlFile, used to store translation text in key-value pair form.

Example:Assuming you have a fixed text such as 'Your location' in your template.

  1. Create a language file: template/your_template_name/locales/zh-CN/default.yml
    
    yourLocation: "您的位置"
    
    template/your_template_name/locales/en-US/default.yml
    
    yourLocation: "Your location"
    
  2. Use in the template:In your HTML template file (such asbase.htmlorheader.html), you can use{% tr "yourLocation" %}Come to call translation. When the user visits the Chinese site, it will display "Your location"; when visiting the English site, it will display "Your location".

This approach allows the static text in the front-end template to dynamically switch according to the language set for the current site, without the need to maintain a separate template file for each language.

Fourth step: Implement language switching between sites and SEO optimization

To allow users to easily switch between different language versions and for search engines to correctly identify multilingual content, you need to add a language switcher in the template and utilizehreflangTags for SEO optimization. AnQiCMS provides{% languages %}Label to get the list of all configured multi-language sites.

  1. Create a language switcher:You can use it in your template files (usually in the header or footer){% languages websites %}Label to iterate over all language sites and generate switch links.

    {%- 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}} {# 如果有语言Emoji #}
            {% endif %}
            {{item.LanguageName}}
        </a>
        {%- endfor %}
    </div>
    {%- endif %}
    {%- endlanguages %}
    

    This code will list all multilingual sites and generate a link for each site, so that users can click and jump to the corresponding language website.

  2. Implement hreflang tags: hreflangLabels inform search engines that your website has pages in different languages or regions, which is an important SEO element. It can effectively avoid the misjudgment of multilingual content as duplicate content. You should place these tags on each page of your website.<head>Part.

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

    item.LinkIt will generate URLs for each language version,item.Languagethen generate the corresponding language code (such aszh-CN,en-US)。Thus, the search engine can accurately understand the structure of your multilingual content and display the most relevant pages to users of different languages.

Considerations for content operation strategy

Once the multilingual infrastructure is set up, content operators should note that:

  • Content independent: Maintain the independence of content on each language site. Although the themes may be the same, translation is not just a literal conversion but also requires consideration of cultural background and localization habits.
  • SEO localization:For each language market, conduct keyword research and optimize the corresponding page title, description, and content.
  • Update synchronization:Establish a reasonable content update process to ensure that all language versions of the content are updated in a timely manner, maintaining consistency of information.

AnQiCMS' multi-language support feature, combined with multi-site management and flexible template translation mechanism, provides an efficient and scalable global content management platform for enterprises and operational teams. Master these configuration and usage techniques, and your website will be able to better serve the global market.