How to implement the switch of multilingual sites and the setting of default language package in AnQiCMS?

Calendar 👁️ 76

AnQiCMS Multi-language Site Switching and Default Language Pack Settings Deep Analysis

In today's global internet environment, website support for multiple languages has become a key to expanding the market and enhancing user experience.AnQiCMS as a system dedicated to providing an efficient and customizable content management solution also offers flexible and powerful multilingual support.This article will elaborate on how to implement multi-language site switching in AnQiCMS, as well as the setting of the default language package.

I. Default Language Pack Settings: Management Interface and System Text

First, let's understand the 'default language package' settings in AnQiCMS.This setting is mainly for the system backend management interface and the system prompt text built into AnQiCMS, which determines the language you use when operating the backend.

To configure the default language package, you can follow these steps:

  1. Enter the backend settings:Log in to the AnQiCMS admin panel, and you can find the 'Admin Settings' option in the left navigation bar.
  2. Select the global function settings:Click "Background Settings" and select the first submenu item "Global Function Settings".
  3. Configure the default language package:In the "Global Feature Settings" page, scroll down until you see the "Default Language Pack" option.AnQiCMS currently has Chinese and English language packs available for selection.You can choose 'Chinese' or 'English' according to your usage habits or team requirements.

Important reminder:The default language package setting here only changes the language of the system interface.For example, menu names, button text, and system notifications will be displayed in the language you choose.It does not automatically translate or switch the content you publish on the website frontend (such as articles, product descriptions, category names, etc.), these contents need to be implemented through the subsequent introduction of frontend multilingual switching and content management strategies.

II. Front-end multi-language switching: content localization and user experience

After the default language package is configured and the background management interface is ready, the next step is how to implement the switch of multilingual content on the website front-end, so that users of different languages can see the corresponding content and provide a localized browsing experience.This mainly depends on the powerful content management capabilities and flexible template tags of AnQiCMS.

AnQiCMS provides a namedlanguagesA template tag used to retrieve the list of multilingual sites configured. Through this tag, you can dynamically generate a language switcher in the website template and provide for search engineshreflangTags to optimize the SEO of multilingual websites.

1. Obtain the list of multilingual sites and implement a switcher.

languagesThe tag will return an array object containing all the multi-language site information that has been configured. You can iterate over this array to create language switch links on the frontend.

{%- 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 %} {# 否则显示 Emoji 或语言名称 #}
        {{item.LanguageEmoji}}
        {% endif %}
        {{item.LanguageName}}
    </a>
    {%- endfor %}
</div>
{%- endif %}
{%- endLanguages %}

In the above code:

  • websitesThe variable contains detailed information for each language site.
  • item.LinkThis is the access link for the language site.
  • item.LanguageNameIs the display name of the language (such as “Chinese”, “English”).
  • item.LanguageEmojianditem.LanguageIconIt can be used to display icons or emojis representing languages.

You can place this code in the header, footer, or sidebar of a website where users are accustomed to finding the language switch function.

2. UsehreflangTag optimization SEO

For multilingual sites, in order to help search engines understand the relationship between different language versions, AnQiCMS also supports bylanguagestag generationhreflangLabel. This is crucial to avoid penalties for duplicate content and to ensure that the most relevant language version is displayed in search results.

Place the following code in the block of your website template.<head>Inside:

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

Hereitem.LanguageIt will output the corresponding language code (such aszh/en)item.LinkIt is the URL of this language version.

3. Management strategy of multilingual content.

To truly implement the switch of multi-language content on the front-end, you need to combine the "Multi-site Management" feature of AnQiCMS and create and manage independent content for each target language.

  1. Create independent language sites:One of the core advantages of AnQiCMS is that it supports the creation and independent management of multiple sites. You can set up an independent site for each target language, for example:

    • Main site (default language, such as Chinese):www.yourdomain.com
    • English site:en.yourdomain.comorwww.yourdomain.com/en/
    • Other language sites:fr.yourdomain.comorwww.yourdomain.com/fr/In this mode, each language site has its own domain or subdirectory, and the content, templates, and SEO settings can all be managed independently.You can add and configure these sites in the "Multi-site Management" feature in the background.
  2. Targeted content creation and management:In each independent language site, you can target and manage the content of that language.For example, post English articles and product information on English websites, while posting Chinese content on Chinese websites.AnQiCMS provides flexible content models, document management, classification, and tag features, ensuring that you can efficiently organize and publish content in different languages.

  3. Template localization:Even if the content is independently managed, the website template also needs to be localized to ensure that the interface elements, navigation, system prompts, and other elements also conform to the habits of the target language. In addition to the system text switching provided by the default language package, you can also use the translation tags in the AnQiCMS template tags{% tr %}To handle custom text translation in the template. This requires you to create the correspondinglocalesfolder and language files (such asen-us/default.yml), and then use{% tr "your_key" %}to call the translated content in the template.

Configure the default language package reasonably and skillfully utilizelanguagesTemplate tags, combined with multi-site management strategies, AnQiCMS can help you efficiently build and maintain enterprise-level websites with multilingual capabilities.Whether it is to improve the user experience or expand the international market, AnQiCMS provides a solid technical foundation and flexible operation space.


Frequently Asked Questions (FAQ)

  1. **Question: Why did I set up the background?

Related articles

How to add custom parameters to meet the specific information display requirements in the contact information settings?

During the process of building and operating a website, displaying contact information is often a crucial link.It is not only a bridge for visitors to communicate with you, but also a key element for building trust and improving conversion rates.AnQiCMS (AnQiCMS) understands this need, providing basic contact information settings while also giving users great flexibility, allowing you to customize and display various contact information according to your unique business needs.This article will guide you to a deep understanding of how to set up custom contact information parameters in Anqi CMS to meet the specific information display needs of your website template

2025-11-07

How to design and apply custom rewrite rules to generate SEO-friendly URLs using `filename` or `catname`?

The structure of website links plays a crucial role in Search Engine Optimization (SEO).A clear, meaningful URL with keywords not only helps search engines better understand the page content, but also improves the user experience.AnQiCMS (AnQiCMS) provides powerful pseudo-static functionality, allowing us to flexibly design and apply SEO-friendly URL rules, where巧妙利用`filename`和`catname`variables are the key to achieving this goal.Why URL structure is important for SEO

2025-11-07

How to configure Baidu and Bing API interfaces for link push function to improve page inclusion efficiency?

In content operation, it is a key link to improve website traffic and visibility by allowing search engines to quickly discover and index our pages.Manually submitting links is inefficient and prone to omission.Fortunately, AnQiCMS provides a convenient link push function that can help us automatically submit new or updated pages to major search engines like Baidu and Bing, thereby significantly improving the page inclusion efficiency.Why link promotion is crucial for SEO

2025-11-07

How does the newly added Markdown editor of AnQiCMS support the correct display of mathematical formulas and flow charts?

## Make Content More Vivid: How AnQiCMS Markdown Editor Elegantly Presents Mathematical Formulas and Flowcharts The recent upgrade of AnQiCMS has brought an integrated Markdown editor, which undoubtedly brings great convenience to content creation.For operators who need to write technical documents, tutorials, reports, or any content that includes complex logic display, it is undoubtedly a blessing to be able to directly insert mathematical formulas and flowcharts into the article and have them displayed correctly.This article will discuss in detail how to implement this feature in AnQiCMS

2025-11-07

How to build a complex document parameter filtering interface using the `archiveFilters` tag, such as real estate, product filtering?

In website operation, providing users with an efficient and accurate content filtering function is the key to improving user experience and content discoverability.Whether it is complex real estate information, massive product SKUs, or professional industry documents, a well-designed filtering interface can allow users to quickly locate the information they need.In Anqi CMS, the `archiveFilters` tag is a powerful tool for building such complex filtering interfaces.### Understand the core of the filter interface: content model and custom parameters Build a flexible filtering function

2025-11-07

How to display article comments using the `commentList` tag and integrate reply and like functions?

When building a vibrant website, the article comment feature is undoubtedly a core element to enhance user interaction and promote the development of a content community.AnQiCMS as an efficient and flexible content management system, provides us with powerful template tags, making it simple and intuitive to integrate and display comments.Today, let's delve into how the `commentList` tag in AnQiCMS helps us display article comments and cleverly integrate reply and like functions.

2025-11-07

How to dynamically generate a guestbook form with custom form field types using the `guestbook` tag?

It is crucial to provide a convenient user communication channel in modern website operations, and a message board is one of the efficient ways to do so.AnQiCMS (AnQiCMS) fully understands this need, through its powerful template tag system, especially the `guestbook` tag, allowing you to dynamically generate guestbook forms on your website flexibly, and easily customize form fields to meet various business scenarios.

2025-11-07

How to effectively use `if` and `for` tags for conditional judgment and data looping in AnQiCMS templates?

In AnQiCMS template development, `if` and `for` tags are undoubtedly the core tools for building dynamic content and flexible layouts.They allow us to display content based on specific conditions or efficiently loop through data, thereby transforming static templates into rich, user-responsive pages.AnQiCMS uses syntax similar to the Django template engine, making these operations intuitive and powerful.

2025-11-07