Unlock global audience: How AnQiCMS achieves multi-language content switching and precise display
Under the wave of globalization, websites are no longer aimed at users in a single region.No matter whether it is to expand the international market, serve a diverse cultural group, or enhance brand influence, multilingual support has become an indispensable ability for modern websites.AnQiCMS as an efficient content management system, fully understands this, and provides a flexible and practical multilingual solution to help users easily switch between different language versions and display content correctly.
AnQiCMS's multilingual feature is not just a simple translation tool, but supports content multi-version management and display at the system level.Its core advantage lies in its ability to allow users to finely manage the various components of a website according to different language needs, ensuring that users can experience the authentic localized content when visiting.
Build a multi-language ecosystem: Back-end configuration and content organization
Firstly, the implementation of multilingual functions cannot be separated from the detailed configuration on the backend.In AnQiCMS's 'Global Settings', we can find the 'Default Language Pack' option.This built-in package includes various languages such as Chinese, English, and more. After selecting a language package, the system backend interface and some built-in prompts and system text will switch to the corresponding language.This provides convenience for website administrators to operate in their familiar language.
However, it should be clearly stated that this "default language package" mainly acts on the system interface and built-in text.It does not automatically translate the content posted by users on the website, such as articles, product descriptions, or category names.For this user-generated content, AnQiCMS provides a more flexible strategy, usually through the 'multi-site management' feature to achieve independent maintenance of different language versions of content.This means you can create independent sites for each target language, for exampleen.yourdomain.comFor English content,fr.yourdomain.comContent for French. Each site can be independently deployed, but managed through the unified backend of AnQiCMS, which greatly reduces the complexity of operation and maintenance.
In this multi-site mode, you need to create and publish corresponding articles, products, or pages for each language separately.Although this means that content creators need to manually translate and publish, it ensures the accuracy and localization quality of the content, avoiding ambiguity or errors that may arise from machine translation.
Flexible translation of static text:{% tr %}The application of tags
For some fixed texts that need to be translated on the website interface, such as navigation menu items, button text, copyright statements, etc., AnQiCMS provides a very convenient translation tag:{% tr %}.
The working principle of this tag is based on the language package file. You can find it in the template directory.localesIn the folder, create a corresponding YAML format language package file for each language. For example, create for Englishen-us/default.yml, create for Chinesezh-cn/default.ymlIn these files, you can define a series of key-value pairs, such as inzh-cn/default.ymlwrite in"yourLocation": "您的位置", and inen-us/default.ymlwrite in"yourLocation": "Your Location".
when the template is called{% tr "yourLocation" %}When, AnQiCMS will automatically extract the correct translation text from the corresponding language package file according to the current language environment and display it.This mechanism allows website developers and operators to separate interface text from page logic, greatly improving the reusability and maintenance efficiency of templates.
Front-end language switching and SEO optimization:{% languages %}The clever use of tags
To allow users to easily switch between different language versions, AnQiCMS provides{% languages websites %}The tag can retrieve the list of all configured multilingual sites and expose site names, language codes, link addresses, even the Emoji or icons of languages, etc.
Using this information, you can easily build an intuitive language switcher on the website frontend.For example, multiple language options are displayed in a navigation bar, and the user can click to jump to the corresponding language site or page.Generally, we use loop structures to traversewebsitesvariables, generating one with a link and display name for each language<a>Tags, combined with language icons or Emoji, provide a friendly switching experience.
What is more important, AnQiCMS's multilingual feature also takes into account search engine optimization (SEO).It is crucial to correctly indicate the relationship between multiple language versions of your website to search engines.AnQiCMS supports throughhreflangTags to solve this problem.hreflangThe tag tells the search engine what language or regional variants a specific page has, thereby avoiding duplicate content issues and ensuring that the correct language content is displayed to the corresponding users. Combined{% languages %}Tags, you can easily place on the website's<head>Partially insert these key pointshreflangTags, greatly enhance the visibility and ranking of internationalized content
AnQiCMS's multilingual support feature, through its built-in language package management, flexible static text translation tags, and powerful multi-site and language switching mechanism, provides website operators with a comprehensive and practical solution.It not only helps your website meet the needs of global content display, but also ensures that the content of different language versions can be accurately found by target users.
Frequently Asked Questions (FAQ)
Will the multilingual function of AnQiCMS automatically translate the content of my articles?The default language package provided by AnQiCMS is mainly used for localizing the system backend interface and some built-in text, but it will not automatically translate your articles, product descriptions, and other user-generated content.You usually need to create and publish separate versions for each language to ensure translation quality and localization accuracy.
How to set up a separate domain or subdirectory for each language?AnQiCMS recommends using its powerful "Multi-site Management" feature to implement independent deployment of different language versions. You can create an independent site for each language in the background and bind it to different domain names (such as
en.yourdomain.com) or subdirectory (such asyourdomain.com/enThen, you just need to maintain the content corresponding to the language in each site.Can I manage all language content within a single site?Although AnQiCMS's "Multi-site Management" is the recommended language content separation method, you can also manage multiple language content within a single site by combining custom content models, categories, or tags.For each language, set a specific category ("Article-Chinese", "Article-English") or add language tags to the content.However, this method may require more complex template logic on the front end to identify and display the content in the corresponding language, and it is not conducive to
hreflangAutomated tag management. For websites aimed at a global audience, it is usually recommended to use a multi-site mode.