How does AnQi CMS support the publishing of multilingual content and front-end switching display?

Calendar 👁️ 71

In today's globalized business environment, whether a website can support multilingual content publishing and switching has become an important standard for measuring its internationalization capabilities.AnQiCMS (AnQiCMS) is an efficient content management system that fully considers this need, providing users with a flexible and practical multilingual content solution.

To understand how AnQiCMS supports multilingual, we can look at two main aspects: one is the management and publication of core content such as actual articles, products, and pages; the other is the translation and switching of fixed text in website templates (such as navigation names, button text).

The publication and management of multilingual content: multi-site strategy

The core mechanism of AnQiCMS handling multilingual core content is its powerfulMulti-site managementFunction. When you need to provide independent content for users of different languages, the most direct and efficient method is to use this feature.

In particular, you can create a separate site for each target language. For example, if your business needs to support Chinese, English, and Japanese, you can set up three sites:

  • Main site (for examplewww.yourdomain.com, for Chinese content
  • English site (for exampleen.yourdomain.com)
  • Japanese site (for examplejp.yourdomain.com)

Each site has its own independent database, content, and template configuration, but can share the same AnQiCMS program.This means that the content of each language will be independently published and managed on its dedicated site, without interference, ensuring the accuracy and professionalism of the content.When operating in the background, you can log in to the corresponding language site backend and add, edit, and publish articles, products, or single pages for that language, just like managing a single site.The advantage of this method lies in its ability to maintain high flexibility in structure, SEO optimization, and operational strategy for content in different languages, avoiding confusion that may arise from managing multiple languages in a single content library.

It is worth noting that the "default language package" option in the global feature settings mainly affects the language of the backend management interface and some built-in system prompts.It will not automatically translate the core content of your website, such as articles, products, etc.Therefore, for the core content of different languages, we still need to maintain separate sites.

Front-end multi-language switch and display

On the website front-end, allowing visitors to easily switch languages is a key factor in improving user experience. AnQiCMS provides a very practical template tag for this:{% languages %}.

This tag will automatically retrieve all the multilingual site information you have configured in the AnQiCMS backend, including the site's language name, language code, link address, and even the language emoticons or icons that can be used for display.You can use this tag to build a dynamic language switcher in website templates, such as in the header or footer.

Here is a commonly used code example showing how to generate a language switch link:

{%- 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}}
        {% endif %}
        {{item.LanguageName}}
    </a>
    {%- endfor %}
</div>
{%- endif %}
{%- endLanguages %}

This code will iterate over all configured multilingual sites and generate a toggle option for each site that includes links and language names (or icons, emojis).Clicking on this will take you to the website in your language.

In addition, to better serve international users and optimize search engine rankings, configure correctlyhreflangtags are crucial.hreflangThe tag can tell search engines that a specific page is an alternative version for pages in other languages or regions, thus avoiding duplicate content issues and improving international SEO effects. You can also take advantage of{% languages %}Tags to dynamically generate these importanthreflangTags, usually placed in HTML's<head>Area:

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

Translation of fixed text in the{% tr %}Tag

In addition to the core content, there are many fixed texts in the website template, such as the "Home" page, "Contact Us", "Submit" button, copyright information prompt, and so on.This also needs to be translated according to the language set by the website to provide a complete localization experience.AnQiCMS provided this for{% tr %}(translate) tag.

Use{% tr %}Label needs some simple configuration:

  1. Create a folder named under your template root directory:locales.
  2. InlocalesInside the folder, create a subdirectory for each target language, such as:en-us(English),zh-cn(Simplified Chinese),ja(Japanese) etc.
  3. Create one or more in each language subdirectory,.ymlfile (for exampledefault.yml), for storing the translation key-value pairs.

For example,zh-cn/default.ymlFiles may include:

"yourLocation": "您的位置"
"homePage": "首页"
"contactUs": "联系我们"

Corresponding toen-us/default.ymlThe file may contain:

"yourLocation": "Your Location"
"homePage": "Home"
"contactUs": "Contact Us"

Where you need to use these translated texts in the template, you just need to use{% tr "键名" %}format. For example:

<a href="/">{% tr "homePage" %}</a>
<p>{% tr "contactUs" %}</p>

When the website visitor switches language, AnQiCMS will automatically load the corresponding language based on the current site settings,.ymlRead and display the corresponding translation text in the file, ensuring that the text information on the front-end page is fully adapted to the target language.

Summary

AnQiCMS combines flexibility withMulti-site managementStrategy to carry the core content of different languages, utilizing{% languages %}TagAchieve front-end language switching and SEO optimization, and leverage{% tr %}TagManage the translation of static text in the template. This set of comprehensive and well-defined mechanisms provides solid support for enterprises and content operators to build efficient, professional global multi-language websites, facilitating borderless content dissemination.


Frequently Asked Questions (FAQ)

How to create and manage content in different languages for AnQiCMS?You need to use the "Multi-site Management" feature of AnQiCMS. Create an independent site for each target language (for exampleen.yourdomain.com/fr.yourdomain.comThen, log in to the backend of each site independently to publish and manage articles, products, single pages, and other core content in that language.This ensures that the content is independent between different language versions, making it easy for fine-grained operations and SEO.

2. Will changing the 'Default Language Pack' in the background translate my website content?I don't know. The 'Default Language Pack' in the global function settings mainly affects the display language of the AnQiCMS backend management interface, as well as some built-in system prompts and date formats.It does not automatically translate the core content (such as article titles, body text, product descriptions, etc.) that has been published on your website. This content needs to be manually entered or translated on the corresponding language site before it can be published.

How to translate fixed button or navigation text such as 'Submit' or 'Home' in website templates?For text that is fixed in the template and does not change with the article content, you can use AnQiCMS's{% tr "键名" %}translation tags. First, create the template directory.localesFolder, and create subdirectories for each language (such asen-us), and then create.ymlfiles (such asdefault.yml), and write key-value pairs into them. For example,"homePage": "Home". Then, use them in the template.{% tr "homePage" %}Call it, the system will automatically display the correct translation based on the current website's language settings.

Related articles

How to customize the content model to meet the display needs of different business types (such as articles, products)?

In AnQi CMS, the content model is the core element for constructing the website content structure, which provides powerful flexibility, allowing you to customize the fields and display methods of content according to different business needs (such as publishing articles, displaying products, managing events, etc.).Understand and make good use of this feature, it will greatly enhance the management efficiency and display effect of your website content. ### Understanding Anqi CMS Content Model In Anqi CMS, the content model can be considered as the "blueprint" or "skeleton" of the content.It defines which information fields a certain type of content should include. For example

2025-11-09

How does AnQiCMS implement independent display and management of content for multiple sites?

In today's increasingly rich digital content, many enterprises and content operators often need to manage multiple websites at the same time.This may be because there are multiple brands, product lines, a need to serve users in different regions or languages, or operating multiple independent content branches.Traditionally, this means that it requires deploying and maintaining multiple independent CMS systems, which not only consumes time and effort but also increases operational costs and complexity.Luckyly, AnQiCMS has fully considered this pain point from the beginning of its design, one of its core highlights is to provide a powerful multi-site management function

2025-11-09

How does AnQiCMS's 'Content Management' feature affect the parameter escaping strategy when generating URLs?

The functions provided by AnQi CMS in content management have a profound impact on the parameter escaping strategy when generating URLs for websites.This is not just about the beauty of the URL, but also a key link to the website's SEO performance and user experience.Understanding the underlying mechanism can help us better build and manage websites. **One, Static Rule: The Foundation of URL Structure** Firstly, AnQiCMS lays the foundation for URL structure through its powerful "static and 301 redirect management" function.The static rules define how the URL of a website is presented to visitors and search engines

2025-11-09

How does `CanonicalUrl` work with URL parameter escaping in AnQiCMS to optimize SEO?

In website operation, Search Engine Optimization (SEO) is a key link to enhance website visibility and attract targeted user traffic.Among them, how to effectively handle duplicate content and normalize URLs is an important detail that cannot be ignored in SEO strategy.AnQiCMS (AnQiCMS) is a system designed for content operation teams, providing powerful and flexible functional support in this aspect.This article will discuss how `CanonicalUrl` in AnQiCMS works together with the URL parameter escaping feature to optimize the website's SEO performance.

2025-11-09

How to configure the static rules to optimize URL structure and improve search engine visibility?

In website operation, a clear and meaningful URL structure is not only a manifestation of website aesthetics but also a key factor in improving search engine visibility and user experience.When it comes to how to configure pseudo-static rules to optimize URL structure and improve search engine visibility?When discussing this topic, AnQiCMS (AnQiCMS) provides very flexible and powerful tools to help us easily achieve this goal.Understanding URL Rewriting: Why is it so important for optimization?Before delving into the configuration, let's talk about what pseudo-static is and why it is so important for your website

2025-11-09

What advanced SEO tools does AnQiCMS provide to improve a website's performance in search results?

Search engine optimization (SEO) is the key to the success of a website in today's digital world.An excellent website content management system (CMS) not only helps you efficiently organize and publish content, but should also be built-in with powerful SEO features to ensure your website has good visibility in search engine results.AnQiCMS is a platform that provides a series of advanced tools, aimed at helping your website stand out in a highly competitive online environment.First, the basic architecture of the website is crucial for SEO.AnQiCMS provides strong support for URL optimization

2025-11-09

What practical uses does the batch replacement feature for all-site content have for optimizing content display?

Operate a website, especially a website with a large amount of content, the most annoying thing is that you need to make unified adjustments to a large number of published content.Whether it is the transformation of the company's strategic direction, the upgrade of the product line, or the adjustment of the SEO keyword strategy, manually modifying hundreds or even thousands or even tens of thousands of articles one by one is not only inefficient, but also prone to omissions and errors.This not only consumes valuable human resources, but may also affect the overall image of the website and search engine performance.The "Full Station Content Bulk Replacement" feature of AnQi CMS is specifically designed to solve this pain point, making content optimization and display management unprecedentedly efficient and accurate

2025-11-09

How to use anti-crawling and watermark management features to protect the display rights of original content?

Today, with the increasing prevalence of digital content, the value of original content becomes more and more prominent, but it also faces unprecedented risks of misuse.Hardly created articles, carefully designed images, may be collected by crawlers, copied and pasted by others in a moment, not only let the original creator's efforts go to waste, but may also affect the search engine ranking of the website, damaging the brand reputation.To effectively protect the original display rights of our website, AnQiCMS (AnQiCMS) provides a practical anti-crawling and watermark management function to help us build a solid content protection barrier.###

2025-11-09