Today, with the increasing popularity of globalization, it is an important step to allow your website content to be presented in multiple languages, so as to expand the market and serve users in different regions.AnQiCMS (AnQiCMS) is an efficient and flexible content management system that fully considers this requirement and provides various solutions to help you easily configure and switch between multi-language content.

Next, we will explore how to effectively manage and display multilingual content in Anqi CMS.

Anqi CMS multilingual concept: differentiation between system and content

In the AnQi CMS, multilingual support is mainly reflected in two levels:

  1. System-level language packages:This mainly affects the background management interface and some built-in system prompt information. For example, you can choose to display the background interface in Chinese or English.
  2. Content-level multilingual:This is what we often say is the multilingual display of website content (articles, products, single pages, etc.).English CMS provides flexible strategies, allowing you to choose the implementation method that suits your actual needs.

It is very important to understand the difference between these two.The system language pack switch will not automatically translate the content of your website articles, and the multilingual display of website content requires you to adopt the corresponding strategy for configuration and management.

Configure the system-level language package

First, let's see how to configure the system-level language of Safe CMS. This is very simple and can be completed in just a few steps:

Log in to the backend management interface of the AnQi CMS, find the left-hand menu item.“Backend Settings”Click to enter and select.“Global Function Settings”.

On this page, you will see a name called“Default Language Package”The option. Anqi CMS currently comes with Chinese and English language packs. You can select "Chinese" or "English" as needed.

Select and save, your backend interface and some default system prompts (such as "Home{% tr "yourLocation" %}Label called static text will switch to the corresponding language.

Please note that, as mentioned earlier, this setting will not automatically translate your articles, product descriptions, and other dynamic content. That part requires a more refined strategy to manage.

Manage multilingual content: Flexible content strategy

The CMS provides two main content multilingual management strategies, which you can choose according to your business scale, content independence, and operation costs.

策略一:利用多站点管理实现完全独立的多语言站(English)

For scenarios where content independence is strong, SEO strategies require high customization, or each language version has an independent domain and management team, the Anqi CMS isMulti-site managementThe function is your ideal choice.

Through multi-site management, you can create an independent secure CMS site for each language. For example, you may have:

  • www.yourdomain.comAs the main Chinese site
  • en.yourdomain.comorwww.yourdomain.com/en/As an English sub-site

How to implement:

  1. Create multiple site instances:
  2. Publish content independently:Each language site's backend can independently publish and manage its content. For example, on the English site's backend, you only publish English articles and English product information.
  3. Template and data interconnection (optional):Although the content is independent, you can achieve a certain degree of interconnection at the template level.For example, on a Chinese site page, you may need to display the corresponding English version link.siteIdParameters to call data from other sites.
    • For example, if you want to display a specific document from another site (assuming the English site with site ID 2) on the current site, you can use:
      
      {% archiveDetail enArticle with name="Title" id="123" siteId="2" %}
      <p>对应的英文文章标题:{{ enArticle }}</p>
      
    • Similarly, when implementing language switching on the front end, it is also necessary to obtain the links to all language sites, which will be introduced in detail later.

The advantage of this method is:Content is completely isolated, management is clear, which is conducive to independent SEO optimization and operation for different language markets.

Strategy two: Manage multi-language fields through content models within a single site.

If the differences in your multilingual content are not significant, or if your budget is limited and you do not want to maintain multiple independent CMS instances, you can do so within a single secure CMS site.Custom Content ModelManage multi-language content.

How to implement:

  1. Extend the content model:Auto CMS provides the "Flexible Content Model" feature. You can add language-specific fields for "Articles", "Products", or custom content models.
    • For example, in your article model, in addition to the defaultTitleandContentfields, you can also add:
      • Title_EN(English title)
      • Content_EN(English content)
      • Title_ES(Spanish title)
      • Content_ES(Spanish content)
    • These custom fields can be configured under "Content Management".“Content Model”Configure the field type (single line text, multi-line text, etc.), and name it.
  2. Content publishing time filled in:When publishing articles or products, editors need to manually fill in the corresponding field content for each language.
  3. Conditions displayed in the template:In the front-end template, you can use the language selected for the current page (usually determined by URL parameters or cookies), toifLogical judgment tag to display the corresponding language content.
    • For example, indetail.htmlIn the detail page template:
      
      {% if currentLanguage == "en" %}
          <h1>{{ archive.Title_EN }}</h1>
          <div>{{ archive.Content_EN|safe }}</div>
      {% else %}
          <h1>{{ archive.Title }}</h1>
          <div>{{ archive.Content|safe }}</div>
      {% endif %}
      
    • currentLanguageThis variable usually needs to be judged on the backend and passed to the template.

The advantage of this method is:Maintenance costs are relatively low, all content is managed on a single backend, convenient for content editors to operate.But for websites with large content and a variety of languages, it may cause the content model to be too complex, and it may not be as clear to manage as multiple sites.

Language switching is implemented on the front end

No matter which strategy you adopt, you need to provide users with a convenient language switch function on the front end. Anqi CMS provideslanguagesTags, allowing you to easily build language switchers and optimize SEO.hreflangLabel.

Language Switcher

languagesLabel can retrieve the list of all multilingual sites configured (if multiple sites are configured).You can add a language switch button or dropdown menu at the top, bottom, or other prominent position of the website.

`twig {%- languages websites %}