Multi-language content configuration and switching of AnQi CMS: helping your website go global
In the tide of globalization, the multilingual capability of corporate websites is no longer an option, but the cornerstone of business expansion.For enterprises that want to target global users and engage in cross-cultural content dissemination, a content management system that supports multilingual functionality is crucial.AnQiCMS (AnQiCMS) is an enterprise-level system tailor-made for small and medium-sized enterprises and content operation teams, providing flexible and efficient configuration and switching methods for multi-language support, aiming to help users easily achieve global content promotion.
Understand how AnQiCMS handles multilingualism, we can break it down into several levels: the language of the system interface, the translation of fixed text in templates, and the most core - the language version management and switching of the actual website content.
1. Default language configuration of the system interface
First, AnQiCMS provides a basic "default language package" setting, which is mainly reflected in the system's backend management interface, as well as some built-in, non-user-generated text prompts.You can find and select the default language of the website in the background Global Function Settings, the system currently has built-in Chinese and English languages.Selecting this will switch the system-level text accordingly.
However, it should be emphasized that this setting only affects the interface language of the system.It does not automatically translate the articles, products, pages, and other user-generated content you post on the site.This is to ensure the accuracy and professionalism of the content, to avoid errors that may arise from machine translation.For the actual website content, we need to adopt a more refined management strategy.
2. Translation mechanism of fixed text in the template
On the front end of the website display, in addition to dynamic content, there are also a large number of navigation names, copyright statements, button texts, and other fixed texts. AnQiCMS introduces{% tr %}(translate) Translation tag, allowing you to easily perform multilingual processing on the static text in these templates.
Its working principle is, you need to create under the template directory.localesCreate a folder and within it, create subfolders for each language (such aszh-cn/en-us). Each language subfolder contains adefault.ymlfile that defines the translation of key-value pairs. For example, in Chinesedefault.ymlyou can define"yourLocation": "您的位置", in Englishdefault.ymldefined in Chinese"yourLocation": "Your location". Then in the template, you just need to use{% tr "yourLocation" %}Label, the system will automatically display the corresponding translated text based on the language version accessed by the current user.This greatly facilitates the internationalization development of templates, allowing the front-end page to seamlessly adapt to different language environments.
3. Management strategy for multilingual website content
AnQi CMS provides strong flexibility in managing multilingual content, especially through itsMulti-site managementfunctionality, providing a structured solution for building global websites.
A. Implementing completely independent multilingual content across multiple sites
This is the recommended and most perfect multilingual content management method by AnQiCMS.By using the multi-site feature, you can create an independent sub-site for each language version. For example,www.example.comcorresponding Chinese station,en.example.comCorresponding to the English site, evenfr.example.comCorresponding to the French site.
Each sub-site can have:
- An independent domain name or subdomain:Easy for users to identify and optimize for search engines.
- Independent backend management:Administrators can focus on content operations for specific languages.
- Independent content:Each language has its own articles, products, single-page contents, etc., which are independent and can be customized for the target audience rather than simple translation.This means you can publish different content for different cultural backgrounds and market preferences, or go for deep localization.
- Independent templates:Even different language versions of websites can be designed with different interface styles, providing more targeted user experience.
- Independent SEO configuration:Each language site can have its own keyword strategy, TDK settings, and better serve the international SEO goals.
The benefits of this method lie in the high degree of isolation between different language versions, clear management, and the ability to adapt to the complex needs of global operations.
B. Through custom fields to manage local multilingual content (optional options)
Although multilingual sites are the mainstream recommended solution, in certain specific scenarios, if you only need to manage the content ofPart element(For example, product names, short descriptions, etc.) for multilingual display, and at the same time, if you want these contents to be associated with the same product or article subject, then consider using the flexible AnQiCMSCustom fields for content modelFeature.
For example, you can add to the product modelProductName_en/ProductDescription_enCustom fields, used to store English product names and descriptions.In the template, determine and display the corresponding field content based on the current language environment.This method is suitable for simple translation needs or when you want to manage all language content under the same content item.But for large-scale translation of an entire article or page, a multi-site solution is still the better choice.
4. Front-end language switching and SEO optimization
To allow users to easily switch between different language versions, AnQiCMS provides{% languages %}Label. This label can retrieve and list all the multilingual site information that has been configured, including language names, language codes, link addresses, language icons (such as Emoji or custom images), and so on.
You can use it in the header, footer, or sidebar of the website,{% languages %}Label easily build a language switcher. For example, iterate through all language sites, generate a link and corresponding language identifier (such as national flag icon or language abbreviation).
{%- 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 %}
In addition, for the SEO of multilingual websites,hreflangthe correct use of tags is crucial. AnQiCMS through{% languages %}The tag can easily achieve this function, helping search engines understand that your website has multiple language versions and index them correctly for users in different language regions.
{%- languages websites %}
{%- for item in websites %}
<link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
{%- endfor %}
{%- endlanguages %}
Place this code inside the HTML's<head>block, which can effectively enhance the search engine visibility of multilingual content.
In summary, AnQiCMS distinguishes system languages, provides template static text translation tags, and takes powerful multi-site management capabilities as the core,配合flexible frontend language switching labels and SEO optimization support, to provide a comprehensive and practical solution for enterprises to build a global multi-language website.Whether it is a simple language switch or complex localization content operation, AnQiCMS can help you a lot.
Frequently Asked Questions (FAQ)
Q1: Can I create multiple language versions of the same article in AnQiCMS and manage them centrally in the background?
A1:AnQiCMS mainly supports multilingual content through its "multi-site management" feature.This means that, in most cases, you would create an independent site for each language (such as Chinese, English).Each site's content is independent and can be managed on their respective backends.Although this method does not directly manage all language versions under a single content item, it provides more thorough content localization and management flexibility.For the translation of a small number of local fields, customization of fields can be achieved, but for the large-scale translation of an entire article or page, an independent site mode is more common and easier to manage.
Q2: After setting the "default language package", will the content of my website be automatically translated into the corresponding language?
A2:Will not. The "Default language package" feature mainly affects the language of the AnQiCMS backend management interface, as well as some built-in system text prompts.It does not automatically translate the actual user-generated content you post on your website, such as articles, products, custom pages, etc.For the translation of the content itself on the website, you need to create different language versions of the content (such as publishing corresponding language articles under different language sites) or use in templates.{% tr %}Tags to handle fixed text strings.
Q3: If I use the multisite feature to manage different language versions, do the data between sites share, such as user data or product inventory?
A3:The multi-site design concept of AnQiCMS is highly independent.When you create a new child site, it usually has an independent database or at least an independent table structure to store its unique content, configuration, etc.This means that by default, content data, user data (unless specifically configured), and so on are independent of each other and do not share directly.This design ensures that language sites can operate and maintain independently, but if you need to share some data across sites (such as member information or general product inventory), you may need to use AnQiCMS extended features or secondary development to implement data synchronization or sharing mechanisms.