How to use the multilingual feature of AnQi CMS to display content in different languages?

Calendar 👁️ 61

In today's global digital environment, the diversity of website content has become the key to attracting and retaining users from different regions.AnQiCMS (AnQiCMS) is well aware of this need and provides a flexible and powerful multilingual function to help users easily display content in different languages, thereby effectively expanding market influence.

This article will deeply explore how to utilize the multi-language capabilities of Anqi CMS, from backend configuration to frontend display, realizing the internationalization of website content in an all-round way.

First, embrace multilingualism: why is it crucial for your website?

Imagine, your business is flourishing, customers are all over the world.If your website is only presented in a single language, you will miss the opportunity to connect with a large number of potential users.Multilingual support is not just about translating text, but also about conveying respect and convenience to users from different cultural backgrounds.

From a practical operational perspective, a multilingual website has significant advantages:

  • Expand into the international market:Directly reach non-native users, eliminate language barriers, increase brand exposure and business opportunities.
  • Improve user experience:Users tend to browse websites in their native language, thereby increasing the website's dwell time, conversion rate, and customer satisfaction.
  • Optimize Search Engine Optimization (SEO):Optimizing search engines for different languages and regions can help your website rank better in local search results and bring more targeted traffic.The multi-language function provided by AnQi CMS is exactly to help you achieve these goals.

The implementation path of the multilingual function of AnQi CMS

The multilingual capability of AnQi CMS is mainly realized by combining the following two methods:

  1. Multi-site management:This is the core mechanism for implementing independent operation of multilingual content. By creating an independent site for each language, you can completely separate the content, configuration, and even templates of different languages, ensuring the accuracy and localization of the content.
  2. Template tags and localization translation:For general static text on the website interface (such as navigation menu items, button text, copyright statements, etc.), AnQi CMS provides a convenient template translation mechanism that allows for multi-language switching without modifying a large amount of code.

Next, we will detail the specific configuration and usage method.

Section 3: Back-end configuration: laying a solid foundation for multilingual websites

In Anqi CMS, the management of multilingual content is not just simple content translation, but is realized based on a powerful architecture of 'multiple sites'.This means that you need to create a separate site for each target language.

  1. Set default language package (system level):First, you can find the "Default Language Pack" option in the "Global Settings".You can choose the language of the AnQi CMS backend interface and system built-in tips (currently built-in Chinese and English).Please note:This settingIt only affects the backend interface language and system default textThe translation will not automatically translate the articles, products, categories, and other content you publish on your website. The translation and display of website content need to be completed in conjunction with multi-site management.

  2. Use multi-site management to create a language version site:This is a key step in implementing multilingual content display. For example, if you want to provide both Chinese and English versions, you can create two independent sites in the 'Multi-site Management' section of the Anqi CMS backend:

    • A site for Chinese content, for examplecn.yourdomain.com.
    • Another site for English content, for exampleen.yourdomain.com. Each site will have its own database table (if the database information is not reused), its own backend administrator account, its own template, and most importantly - its own content.This way, you can publish fully localized articles, products, pages, and categories for each language version site, ensuring the accuracy and relevance of the content.
  3. Publish content for each language site:After creating language versions of the site, you need to log in to the backend of each site and publish corresponding content for that language.

    • Articles, products, single pages:Add and publish translated articles, product details, and standalone page content under each language site.
    • Categories and tags:Create category structures and tags that match the language habits for each language site.Through this content management method, users of different languages will directly see fully localized content when visiting the corresponding language sites.

Four, at the template level: implement the dynamic display of multilingual interfaces

After the content is prepared in the background, the display of the front-end template is also important.AnQi CMS provides dedicated tags to help you build a friendly multilingual switch interface and localized text display.

  1. Build a dynamic language switcher:languagesTag languagesThe tag is used to get the list of all multilingual sites you have configured in AnQi CMS.By this label, you can easily create a language switch menu on the website frontend, allowing users to freely choose their preferred language version.

    {%- languages websites %}
    {%- if websites %}
    <nav class="language-switcher">
        <span>切换语言:</span>
        {%- for item in websites %}
        <a href="{{item.Link}}" {% if item.Language == currentLanguageCode %}class="active"{% endif %}>
            {%- if item.LanguageIcon %}
            <img src="{{item.LanguageIcon}}" alt="{{item.LanguageName}}"/>
            {%- else %}
            {{item.LanguageEmoji}}
            {% endif %}
            {{item.LanguageName}}
        </a>
        {%- endfor %}
    </nav>
    {%- endif %}
    {%- endLanguages %}
    

    Code analysis:

    • {%- languages websites %}Define a variable namedwebsitesthat will contain information about all multilingual sites.
    • {% for item in websites %}: Traverse each language site.
    • {{item.Link}}: Generate the access link for the current language site, click to jump to the corresponding language website.
    • item.LanguageName: Display the name of the language (such as 'Chinese', 'English').
    • item.LanguageEmojioritem.LanguageIcon: Used to display the emoji or icon corresponding to the language, enhancing the visual effect.
    • hreflang: In order to better support SEO, you can use the HTML attribute<head>add in thehreflangto guide search engines to identify the relationship between different language versions of web pages. Anqi CMS also provides convenience for this:
      
      {%- languages websites %}
      {%- for item in websites %}
      <link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
      {%- endfor %}
      {%- endLanguages %}
      
      item.LanguageProvides standard language codes (such aszh-CN/en-US), very suitable forhreflanglabel usage
  2. Translates static text in the translation template:trTagIn addition to dynamic content on the website, there are also a large number of static texts (such as "Home", "About Us" in the navigation bar, "Copyright" in the footer, etc.). Anqi CMS providestrLabel (i.e., translate),配合language package files to conveniently translate these static texts.

    Usage steps:

    • Create language package file:Create a file named under your current template directory,locales. Then in thelocalesCreate a subfolder for each language inside the folder, named after the standard code of that language (for examplezh-CN/en-US). Create a folder for each language.default.ymlFile. For example, your directory structure may be as follows:
      
      /template/your_template_name/locales/
      ├── en-US/
      │   └── default.yml
      └── zh-CN/
          └── default.yml
      
    • Edit language package content:Indefault.ymlIn the file, define your translation text in key-value pairs.zh-CN/default.yml:
      
      yourLocation: "您的位置"
      homePage: "首页"
      aboutUs: "关于我们"
      
      en-US/default.yml:
      
      yourLocation: "Your Location"
      homePage: "Home"
      aboutUs: "About Us"
      
    • Using the templatetrTags:“`twig

Related articles

How to customize the content model of AnQi CMS to meet the display needs of different content types?

In website operation, we often encounter such situations: different types of content require different fields to describe and display.For example, a news article may only need a title, content, and publication time; while a product detail page may require product name, price, inventory, image set, and detailed parameters, etc.If all the content is cramped into a fixed template or data structure, it not only leads to chaos in management, but also makes the front-end display look awkward.

2025-11-07

How to implement independent display of multi-site content in AnQi CMS?

In today's internet environment, businesses and content operators often need to manage multiple independent websites, each of which may represent different brands, product lines, or content themes.AnQiCMS (AnQiCMS) offers a powerful multi-site management capability, providing users with an efficient and flexible solution, making it possible to independently display the core content of each site under a unified backend management interface.

2025-11-07

How to display complex fields (such as image groups) customized by the background content model in AnQiCMS templates?

In Anqi CMS, the flexibility of website content is one of its core advantages.Through the powerful content model function, we can customize various fields according to business needs, thereby realizing diverse content display.It is particularly important to understand the data structure and template tag usage when we need to display complex fields customized by the background content model, such as image groups.

2025-11-07

How to replace a specific keyword in a string with another keyword and display it in AnQiCMS?

During the operation of a website, we often encounter the need to flexibly adjust specific text on the page.Sometimes it's to correct spelling errors, sometimes it's to unify brand terms, or maybe just for A/B testing.AnQiCMS (AnQiCMS) is an efficient content management system that fully considers these detailed requirements and provides simple yet powerful tools to help us achieve these goals.Today, let's talk about how to easily replace a specific keyword with another one in AnQiCMS

2025-11-07

How to optimize the URL display and improve SEO of the pseudo-static function in AnQi CMS?

In website operation, a clear and friendly URL address not only allows visitors to understand the page content at a glance, but is also an indispensable part of search engine optimization (SEO).A disorganized, dynamic URL with a large number of parameters, which may deter search engine spiders and make it difficult for users to remember and share.AnQi CMS knows this, integrating SEO-friendliness into the system from the very beginning, and its powerful static function is the highlight of it.What is pseudo-static and why is it so important?

2025-11-07

How to import content in bulk and display it efficiently on the front end?

In today's fast-paced digital world, updating and maintaining website content is the key to successful operation.Especially for websites with massive amounts of information or those that need frequent updates, how to efficiently batch import content and present it beautifully on the front end has become a challenge that every operator must face.AnQiCMS as an enterprise-level content management system provides a powerful and flexible solution in this regard, making content management easy and effortless.

2025-11-07

How does the Anqi CMS advanced SEO tool affect the display of the website in search results?

In today's fiercely competitive online environment, whether a website can stand out in search engines is directly related to its visibility and ability to attract potential users.For users who want to improve the performance of their website in search results, AnQiCMS provides a series of advanced SEO tools that are not only powerful but also designed to be easy to understand and operate, allowing website operators to optimize content more effectively and thus achieve better display effects in search engines.### Basic Optimization: The Foundation for Search Engine Friendly Sites How a website performs in search engines

2025-11-07

How to implement batch replacement of keywords or links across the entire site to update the display effect?

In website operations, content updates and maintenance are the norm. Whether it involves adjusting brand names, changing promotional links, or optimizing specific keywords, it may require modifying a large amount of website content.If the website has a large amount of content, manually searching and replacing one by one is undoubtedly a huge project that is time-consuming and labor-intensive. It is not only inefficient but also prone to errors, which can lead to broken links, missing keywords, and even affect the website's SEO performance and user experience.Fortunately, for friends using AnQi CMS, we have a powerful and practical tool

2025-11-07