How to configure AnQiCMS to achieve multi-language content switching and display?

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


1. Overview of AnQiCMS multi-language function

AnQiCMS was designed with multilingual support from the outset, aiming to help users efficiently promote global content.One of its core functions is to “support the switching and display of multi-language content”, which allows the website to meet the access needs of users from different languages.From the localization of the built-in language package to the fixed text in templates, and to the multilingual version management of core content (such as articles, products), AnQiCMS provides a relatively comprehensive mechanism.Especially worth mentioning is its powerful multi-site management function, which provides an excellent solution for achieving independent and perfect multilingual site clusters.


English, configure 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 language package of the system.

AnQiCMS provides an "Default Language Pack" option, mainly used for switching the system backend interface, prompt information, and other built-in text languages.This is very helpful for operation personnel to operate the background in different language environments.

  • Operation pathEnglish, log in to the AnQiCMS backend, enter "Global Function Settings".
  • In the settings, you will see the "Default Language Pack
  • Save after selecting the default language you want.

Please noteHere's the setting that 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 further detailed configuration.

2. Localized template fixed text (translation tags)

The website template often contains some fixed and unchangeable text, such as navigation menu items ("Home", "About Us"), and the "Your Location" before the copyright information at the bottom of the page.This text also needs to be switched according to the language environment.{% tr %}translate tags andlocalesSupport this localization through the directory structure.

  • Preparation Work:

    • Under the root directory of your website template (usually)/template/your_template_name/), create a folder namedlocales.
    • InlocalesIn the folder, create subfolders for each target language, for examplezh-cn(Simplified Chinese),en-us(American English).
    • Create a language file in each language subfolder,.ymlformatted as language files, for exampledefault.yml.
  • configuration language file:

    • Openzh-cn/default.yml,You can define Chinese key-value pairs, for example:
      
      "yourLocation": "您的位置"
      "homePage": "首页"
      
    • Openen-us/default.yml,You 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 the language can be{% tr "键名" %}replaced by tags. For example:
      
      <span>{% tr "yourLocation" %}</span>
      <a href="/">{% tr "homePage" %}</a>
      
    • When the website language is switched, AnQiCMS will automatically retrieve from the correspondingdefault.ymlGet and display the corresponding text from the file.

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

AnQiCMS most powerful and recommended multilingual content management system, which uses its 'Multi-site Management' feature to build independent language station groups.This means you can create a separate website for each language, each with its own domain name (or subdomain), content, and template.This method can achieve high isolation of content, which is convenient for management, and is also more friendly to 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, navigate to 'Multi-site Management'.
  • Click the "Add New Site" button.
  • Enter site information.:
    • Site Name: To distinguish between different language versions, for example, "AnQiCMS English Site".
    • Site Root Directory:Specify a separate root directory for the new language site, for example/app/en_anqicms_com。This ensures that the data of each site is stored independently.
    • Website address:Enter the domain name or subdomain of the new site, for exampleen.yourdomain.comPlease ensure that the domain has been resolved to your server.
    • Administrator account/password: Set up independent backend login credentials for the new site.
    • Database name: Specify an independent database name, for exampleen_anqicms_db. Thus, 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 an independent 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)等。

2. In the new language site, publish content

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 regular content release 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 customizationTo better adapt to the reading habits and market demand of different languages, you can choose or customize different templates for each language site.

The advantage of this multi-site mode is:

  • Content is completely isolated: Content of different language versions does not interfere with each other, management is clear.
  • Independent SEO strategyEach language site can have independent keywords, TDK (title, description, keywords) settings, and pseudo-static rules, which is conducive to targeted SEO optimization.
  • Personalized operation: Tailored content marketing and user experience design can be performed more accurately based on the regional and cultural differences of users in different languages.

4. Implement multilingual switching and SEO optimization

An multilingual website should not only be able to manage multilingual content, but also provide convenience for users to switch languages and ensure that search engines can correctly identify different language versions.

1. User language switch menu

The website front-end needs to provide an intuitive language switcher for users to select their preferred language version. AnQiCMS provides{% languages %}Label to get all configured multi-language site information, thus easily building a language switch menu.

  • Operation guidanceIn your website template (usually the header)header.htmlOr footerfooter.htmland other public parts), use{% languages %}Label cyclic 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 choose according toitem.LanguageIcon(Language icon),item.LanguageEmoji(Language Emoji) oritem.LanguageName(Language name) to display the switch options.

2. Configure Hreflang tag to optimize SEO