Unlock global audience: AnQiCMS How to achieve multi-language content switching and precise display
Under the wave of globalization, websites are no longer aimed at users in a single region.Whether it is to expand the international market, serve diverse cultural groups, or enhance brand influence, multilingual support has become an indispensable ability of modern websites.AnQiCMS as an efficient content management system, deeply understands this, and provides a flexible and practical multilingual solution to help users easily switch between different language versions and correctly display content.
AnQiCMS's multilingual feature is not just a translation tool, but supports the management and display of content in multiple versions at the system level.Its core advantage lies in its ability to allow users to finely manage various components of a website according to different language needs, ensuring that users experience authentic localized content upon visiting.
Build a multilingual ecosystem: backend configuration and content organization
Firstly, the implementation of multilingual functions cannot be separated from the detailed configuration of the backend.In AnQiCMS's “Global Settings”, we can find the “Default Language Package” option.Here built-in multiple language packages such as Chinese, English, and more.After selecting a language package, the system backend interface and some built-in prompts, system copywriting will switch to the corresponding language accordingly.This provides convenience for website administrators, allowing them to operate in their own familiar language.
However, it should be made clear that this 'default language package' mainly affects the system interface and built-in text.It does not automatically translate the articles, product descriptions, or category names posted by users on the website.For these user-generated contents, AnQiCMS provides a more flexible strategy, usually through the 'Multi-site Management' feature to achieve independent maintenance of content in different languages.en.yourdomain.comFor English content,fr.yourdomain.comUsed for French content. 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 localized quality of the content, avoiding ambiguity or errors that machine translation may bring.
Flexible translation of static text:{% tr %}Application of tags
For some fixed texts that need to be translated in 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 language package files. You can find them in the template directory.localesIn the folder, create corresponding YAML format language package files for each language. For example, create for Englishen-us/default.yml, create for Chinesezh-cn/default.yml. In these files, you can define a series of key-value pairs, such as inzh-cn/default.ymlwriting"yourLocation": "您的位置",while inen-us/default.ymlwriting"yourLocation": "Your Location".
when the template calls{% tr "yourLocation" %}When, AnQiCMS will automatically extract the correct translation text from the corresponding language package file based on the current language environment.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 magic use of tags
To enable users to easily switch between different language versions, AnQiCMS provides{% languages websites %}Label.This tag can retrieve the list of all configured multi-language sites and expose site names, language codes, link addresses, even the Emoji or icons of the languages, etc.
Using this information, you can easily build an intuitive language switcher on the front end of the website.For example, displaying multiple language options in a navigation bar, where users can click to jump to the corresponding language site or page.websitesvariables, generating a link and display name for each language<a>Label, with language icon or Emoji, to provide a friendly switching experience.
It is more important that AnQiCMS's multilingual function also considers search engine optimization (SEO).When your website has multiple language versions, it is crucial to correctly indicate the relationships between these versions to search engines.hreflangLabel to solve this problem.hreflangTags inform search engines about the languages or regions of specific pages, thus avoiding issues with duplicate content and ensuring that search engines display the correct language content to the corresponding users. Combined{% languages %}Label, you can easily add it to the website<head>Partially insert these key tagshreflangLabel, greatly enhancing 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 a comprehensive and practical solution for website operators.It not only helps your website meet the needs of global content display, but also ensures that content in different language versions can be accurately discovered by target users.
Common Questions and Answers (FAQ)
Does AnQiCMS's multilingual function automatically translate the article content?AnQiCMS 提供的“默认语言包”主要用于系统后台界面和部分内置文案的本地化显示,并不会自动翻译您的文章、产品描述等用户生成内容。For this content, you usually need to create and publish a separate version for each language to ensure translation quality and localization accuracy.
How to set a separate domain name 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 a separate site for each language in the background and bind it to different domain names (such as
en.yourdomain.com)or subdirectory(such asyourdomain.com/en)。Then, you just need to maintain the content in the corresponding language for each site.Can I manage all language content within a single site?Although the 'Multi-site Management' of AnQiCMS is recommended as a language content separation method, you can also manage multiple language contents within a single site by combining custom content models, categories, or tags.For each language, set specific categories (e.g., "Articles-Chinese
hreflangThe automation management of labels. For websites targeting a global audience, it is usually recommended to use the multi-site mode.