In today's globalized internet environment, enabling a website to support multiple language displays has become a key step for many enterprises to expand into international markets and serve diverse user groups.AutoCMS (AutoCMS) is a powerful content management system with built-in flexible multilingual support, which helps users easily switch the display of website content in multiple languages.
To set up the multi-language content switching function for your security CMS website, we need to understand two main implementation approaches: one is for the websitetemplate-level translation of interface textEnglish, Another is forindependent management of core contentEnglish, This is usually achieved through the multi-site function of Safe CMS.
1. Multilingual support at the interface level: using template translation
The Auto CMS allows you to translate various prompts, navigation names, button texts, and other texts on the website through language package files. These are usually fixed texts in the template.
Implementation method:
Create language package file:)Create a file named in your template directory,
localesfolder. Inside this folder, create a subfolder for each target language, such asen-us(American English),zh-cn(English)。In each language subfolder, create adefault.ymlfile.- For example, your file structure may look like this:
/template/您的模板名/ ├── locales/ │ ├── en-us/ │ │ └── default.yml │ └── zh-cn/ │ └── default.yml └── ...
- For example, your file structure may look like this:
Edit the language package content:In
default.ymlIn the file, translation content is defined in the form of key-value pairs.zh-cn/default.ymlExample:"yourLocation": "您的位置" "homePage": "首页"en-us/default.ymlExample:"yourLocation": "Your Location" "homePage": "Home"
Use translation tags in the template:Use it in your template file.
{% tr "键名" %}Use the tag to call the corresponding translation text.- For example, you can write it like this in the
bash.htmlorindex.htmletc. template files.
The 'auto' mode will automatically load the corresponding<div>{% tr "yourLocation" %}:<a href="/">{% tr "homePage" %}</a></div>default.ymlfiles and display the translated text.
- For example, you can write it like this in the
Set the default language package of the website:Enter the Anqi CMS backend, navigate to 'Backend Settings' -> 'Global Settings'.Here, you can see the option for the 'Default Language Pack'.Choose the language you want the current site to display by default, for example, “Chinese” or “English”.
{% tr %}Label default reads which language package file.
This method is very suitable for translating static elements and unified interfaces of websites.
二、Content-level Multilingual Switching: Flexible Application in Multi-site Mode
For websites that need to publish independent, complete multilingual content (such as product descriptions, article details, news information, etc.), Anqi CMS recommends using its powerful "Multi-site Management" feature.Manage each language as an independent site, which can ensure complete independence of content, is beneficial for SEO, and the background management logic is clear.
Core idea:Treat each language content as an independent website. For example, your main website iswww.yourdomain.com(English),You can create a child siteen.yourdomain.comorwww.yourdomain.com/en(English),They share the same security CMS system but are independent in content, database, and configuration.
Detailed setup steps:
第一步:Plan multi-language site structureBefore you start setting up, please clarify how you want your multi-language site to appear. Common patterns include the following:
- Different top-level domains:
yourdomain.com(English),yourdomain.de(German) - Different subdomains:
www.yourdomain.com(English),en.yourdomain.com(English),fr.yourdomain.com(French) - Different subdirectories:
www.yourdomain.com(English),www.yourdomain.com/en(English),www.yourdomain.com/fr(French) The multi-site management of Anqi CMS is very flexible and can support these modes.
- Different top-level domains:
第二步:In the background, add and configure a new language site
- Login to the main site admin panel:Log in with the administrator account you used to initially install the AnQi CMS site (usually your Chinese main site).
- Enter multi-site management:Find the "Multi-site Management" feature in the left navigation bar.
- Add a new site:Click the "Add New Site" button. You need to fill in the following key information:
- Site Name:For example, "English site
- Site root directory: This is the key!Each language site needs an independent physical directory to store its cache and specific data. The recommended naming convention is
/app/en.yourdomain.comor/www/wwwroot/yourmaindomain.com/enEnsure that these directories are unique, and exist on the server or can be created by the system. - Website address:Enter the full URL that you plan for the language site, for example
https://en.yourdomain.comorhttps://www.yourdomain.com/en.Make sure to preconfigure these domains or subdirectories on your server and set up the reverse proxy for your Web server (Nginx/Apache), pointing to the port of the security CMS main program (usually 8001). - Administrator account password:Set an independent backend account and password for the new language site.
- Database name:Set an independent database name for the new language site, for example
en_yourdomain_comTo ensure that content data in various languages is completely separated. Selecting 'Reuse default database account information' can simplify the configuration. - Select the template you want to use:You can choose the same template as the main site, or a template customized for a specific language.
- Repeat this step:Repeat the above 'Add new site' steps for each language you plan to support.
**Third step: Template