How to configure AnQiCMS to implement multilingual content switching and display?

Today, with the increasing popularity of globalization, multilingual support for websites is no longer an optional feature, but an important cornerstone for enterprises to expand into international markets and serve global users.AnQiCMS (AnQiCMS) is an efficient and customizable enterprise-level content management system that fully considers this need and provides a flexible multilingual content switching and display solution.This article will discuss in detail how to configure and manage multi-language content in AnQiCMS, making your website easily accessible to the world.


I. AnQiCMS Multilingual Function Overview

AnQiCMS was designed with multilingual support from the beginning, aiming to help users efficiently promote global content.One of its core functions is to support the switching and display of multilingual content, which allows the website to meet the access needs of users from different languages.From the built-in language package of the system, to the localization of fixed text in templates, and to the multi-language version management of core content (such as articles, products), AnQiCMS provides a relatively complete mechanism.It is particularly noteworthy that its powerful multi-site management function provides an excellent solution for achieving an independent and complete multilingual site cluster.


II. Configuring the Basic Language Environment of AnQiCMS

Before starting to manage multilingual content, we need to configure the basic language environment of AnQiCMS first.This mainly includes the settings of the system default language package and the localization of fixed text in the template.

1. Set the Default System Language Package

AnQiCMS provides a "default language package" option, mainly used for switching the system backend interface, prompt information, and built-in text language.This is very helpful for operators to operate the backend in different language environments.

  • Operation path: Log in to the AnQiCMS backend and go to the "Global Function Settings".
  • In the settings, you will see the "Default Language Pack" option, currently supporting "Chinese" and "English".
  • Select the default language you want and save it.

Please note: This setting only affects the interface language of the AnQiCMS system itself, and will not automatically translate the specific content of your website articles, products, etc.The localization of website content requires more detailed configuration later.

2. Fixed text in the localization template (translation tags)

The website template often includes some fixed and unchangeable text, such as navigation menu items (Home, About Us), and the location information before the copyright information at the bottom of the page, etc.This text also needs to be switched according to the language environment. AnQiCMS passes through{% tr %}Translate labels andlocalesThe directory structure to support this localization.

  • Preparation:

    • Under the root directory of your website template (usually/template/your_template_name/), create a subdirectory namedlocales.
    • Inlocalesin the folder, create a subfolder for each target language, such aszh-cn(Simplified Chinese),en-us(American English).
    • Create a file in each language subfolder,.ymllanguage files in thedefault.yml.
  • Configure language file:

    • Open.zh-cn/default.ymlYou can define Chinese key-value pairs, for example:
      
      "yourLocation": "您的位置"
      "homePage": "首页"
      
    • Open.en-us/default.ymlYou can define English key-value pairs, for example:
      
      "yourLocation": "Your Location"
      "homePage": "Home"
      
  • Use translation tags in the template:

    • In your template file, any fixed text that needs to be switched according to language can be{% tr "键名" %}replaced with tags. For example:
      
      <span>{% tr "yourLocation" %}</span>
      <a href="/">{% tr "homePage" %}</a>
      
    • When the website language is switched, AnQiCMS will automatically load the correspondingdefault.ymlGet and display the corresponding text from the file.

3. Implement multilingual content management: Build a multilingual site cluster

AnQiCMS is the most powerful and recommended multilingual content management system, which uses its "multi-site management" feature to build independent language station clusters.This means you can create an independent website for each language, each with its own domain (or subdomain), content, and template.This method can achieve high isolation of content, making it easy to manage, and more friendly for search engine optimization (SEO).

1. Create an independent site for each language

Through the multi-site management feature, you can easily create and manage websites in different languages.

  • Operation path: Log in to the backend of your AnQiCMS main site and navigate to 'Multi-site Management'.
  • Click the "Add new site" button.
  • Enter site information:
    • Site name: To distinguish different language versions, for example, "AnQiCMS English Site".
    • Site root directory:Specify an independent root directory for the new language site, for example/app/en_anqicms_com。This ensures that the data for each site is stored independently.
    • website address:Enter the domain name or subdomain of the new site, for exampleen.yourdomain.comMake sure the domain is resolved to your server.
    • Administrator account/passwordSet up independent backend login credentials for the new site.
    • Database nameSpecify an independent database name, for exampleen_anqicms_dbThus, the content data of different language sites will be completely isolated.
    • Select the template to use: You can choose an existing template for the new site or upload a template customized for that language.
  • Click "OK" to complete the site creation.

Repeat the above steps to create a separate site for each language you support. For example, you might have awww.yourdomain.com(Chinese main site), en.yourdomain.com(English site),jp.yourdomain.com(Japanese site) etc.

2. Release content on new language sites

Each new language site has an independent backend management interface.You need to log in to the backend of each language site, then follow the normal content publication process to publish the corresponding language version of the content.

  • Content typeIncluding articles, products, single pages, categories, tags, etc., each language site needs to be created and managed separately.
  • Template customization: To better adapt to the reading habits of different languages and market demands, you can choose or customize different templates for each language site.

The advantages of this multi-site model lie in:

  • Content is completely isolatedDifferent language versions of content do not interfere with each other, management is clear.
  • Independent SEO strategyEach language site can have independent keyword, TDK (title, description, keywords) settings and pseudo-static rules, which is beneficial for targeted SEO optimization.
  • Personalized operation: Based on the regional and cultural differences of different language users, more accurate content marketing and user experience design can be carried out.

IV. Implement multi-language switching and SEO optimization

A multilingual website must not only be able to manage multilingual content but also facilitate language switching for users and ensure that search engines can correctly identify different language versions.

1. User language switching menu

The front-end of the website needs to provide an intuitive language switcher, making it convenient for users to select their preferred language version. AnQiCMS provides{% languages %}Tag to get all configured multilingual site information, making it easy to build a language switch menu.

  • Operation instructionsIn your website template (usually the headerheader.htmlor footerfooter.htmland other public parts), use{% languages %}Label cycles output language switch link.

    {%- languages websites %}
    {%- if websites %}
    <div class="language-switcher">
        <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 %}
    
  • item.LinkIt will automatically point to the root directory of the corresponding language site.

  • You can useitem.LanguageIcon(Language Icon),item.LanguageEmoji(Language Emoji) oritem.LanguageName(Language Name) to display the switch options.

2. Configure Hreflang tags to optimize SEO