In today's global internet environment, allowing websites to support multiple language displays has become a key step for many enterprises to expand into international markets and serve diverse user groups.AnQiCMS (AnQiCMS) is a powerful content management system that comes with flexible multilingual support mechanisms, helping users easily switch the display of website content in multiple languages.

To set up multi-language content switching functionality for your Anqi CMS website, we need to understand two main implementation approaches: one is for the websitetemplate-level translation of interface text, another is aimed atIndependent management of core contentThis is usually achieved through the multi-site function of Anqi CMS.

1. Multilingual support at the interface level: Using template translation

The AnQi CMS allows you to translate various hints, navigation names, button texts, and other texts in the website through language package files, which are usually fixed texts in the template.

Implementation method:

  1. Create language package file:Under your template directory, create a folder namedlocales. Inside this folder, create a subfolder for each target language, for exampleen-us(American English),zh-cn(Simplified Chinese). 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
      โ””โ”€โ”€ ...
      
  2. Edit language package content:Indefault.ymlIn the file, define the translation content in key-value pairs.

    • zh-cn/default.ymlExample:
      
      "yourLocation": "ๆ‚จ็š„ไฝ็ฝฎ"
      "homePage": "้ฆ–้กต"
      
    • en-us/default.ymlExample:
      
      "yourLocation": "Your Location"
      "homePage": "Home"
      
  3. Use translation tags in the template:In your template file, use{% tr "้”ฎๅ" %}tags to call the corresponding translation text.

    • For example, you can inbash.htmlorindex.htmlAs written in the template file:
      
      <div>{% tr "yourLocation" %}๏ผš<a href="/">{% tr "homePage" %}</a></div>
      
      AnQi CMS will automatically load the corresponding language pack according to the current website's default language settings,default.ymland display the translated text in the file.
  4. Set the default language package of the website:Log in to the AnQi CMS backend, navigate to "Backend Settings" -> "Global Settings".Here, you can see the option for the 'default language package'.Select the language you want the site to display by default, for example, 'Chinese' or 'English'.This will decide{% tr %}Which language package file does the label read by default.

This method is very suitable for translating static elements and unified interfaces of the website.

Second, multilingual switching at the content level: flexible application of the 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" function.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's content as an independent website. For example, your main website iswww.yourdomain.com(English), you can create a sub-siteen.yourdomain.comorwww.yourdomain.com/en(English), they share the same AnQi CMS system, but the content, database, and configuration are independent.

Detailed setup steps:

  1. Step 1: Plan the multilingual site structureBefore starting the setup, please clarify how you want the multilingual site to be presented. Common patterns include the following:

    • Different top-level domains: yourdomain.com(Chinese),yourdomain.de(German)
    • Different subdomains: www.yourdomain.com(Chinese),en.yourdomain.com(English),fr.yourdomain.com(French)
    • Different subdirectories: www.yourdomain.com(Chinese),www.yourdomain.com/en(English),www.yourdomain.com/fr(French) The Anqi CMS multi-site management is very flexible and can support these modes.
  2. Step 2: Add and configure a new language site in the background

    • Log in to the main site background:Log in with the administrator account of the AQCMS site you initially installed (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', 'French site', etc., for easy identification.
      • Site root directory: This is crucial!Each language site requires an independent physical directory to store its cache and specific data. The recommended naming method is/app/en.yourdomain.comor/www/wwwroot/yourmaindomain.com/enMake sure these directories are unique and exist on the server or can be created by the system.
      • Website address:Enter the complete URL you plan for the language site, for examplehttps://en.yourdomain.comorhttps://www.yourdomain.com/enMake sure to parse these domain names or subdirectories to your server in advance and configure the reverse proxy of the Web server (Nginx/Apache), pointing to the port of the main program of the Safe CMS (usually 8001).
      • Admin account password:Set an independent admin 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 for each language is completely separated. Selecting 'Reuse default database account information' can simplify the configuration.
      • Select the template to use:You can choose the same template as the main site or a customized template for a specific language.
    • Repeat this step:Repeat the above steps 'Add new site' for each language you plan to support.
  3. **Step 3: Template