How to use the multilingual site feature tutorial two: Single site translation plugin architecture

Calendar 👁️ 270

Starting from AnQiCMS version 3.4.8, it supports more powerful multilingual site features.

AnQiCMS's multilingual function supports two ways of implementation, one is to use an independent multi-site architecture (suitable for large/highly customized needs), and the other is a single-site translation plugin architecture (suitable for small/medium-sized/rapid iteration).

Next, I will guide you through the multilingual features of AnQiCMS:

▶ Method 2: Single-site translation plugin architecture (suitable for small and medium-sized / agile iteration)

Operation steps

First step: Enable multi-language site feature

  1. Log in to the AnQiCMS backend management interface.
  2. Log in to the Anqi CMS official website account. > Note: If you are not logged in to the Anqi CMS official website, you will not be able to use the HTML page translation feature.

Log in to the Anqi CMS official website

  1. Enter [Function Management], search "Multilingual Site Support".
  2. Click to enter the Multilingual Site Support feature interface.Enter Multilingual Site Support

Step 2: Configure Multilingual Site Function

  1. Then, configure in the configuration interface:
    • Do you want to enable multilingual site support -> Yes
    • Site storage processing method -> Only the main site
    • Site display mode -> Independent domain | Independent directory
    • Main site language -> Chinese

ConfigurationClick the [Submit] button to save the configuration and proceed to the next step.

  1. In the multilingual site list, click the [Add Site] button to add a multilingual site. > Note: Site domain must be filled in only when choosing the independent domain name form, when choosing the form of independent directory and URL unchanged, no need to fill in the site domain.

Add SiteThe effect after adding:multilingual

Step 3: Mark the content to be translated

  1. Edit the template file, mainlybase.htmlIn the head section, add the harflang and languages toggle tags.multilingual

  2. Example code: Harflang in the head section:

    {%- languages websites %}
    {%- for item in websites %}
    <link rel="alternate" href="{{item.Link}}" hreflang="{{item.Language}}">
    {%- endfor %}
    {%- endLanguages %}
    

    Language switching in the header section:

    Note: Always use the code for language switching,<div class="languages">....</div>The tag needs to be a div, it also needs to have class=“languages”, otherwise the link replacement will fail.

   {%- languages languages %}
   <div class="languages">
      {%- for item in languages %}
      <a href="{{item.Link}}" class="{% if item.IsCurrent %}active{% endif %}" data-pjax="false">
         <div class="language-item">
               {%- if item.LanguageIcon %}
               <img class="language-icon" src="{{item.LanguageIcon}}" />
               {%- else %}
               <span class="language-icon">{{item.LanguageEmoji}}</span>
               {% endif %}
               <span>{{item.LanguageName}}</span>
         </div>
      </a>
      {% endfor %}
   </div>
   {%- endLanguages %}
  1. Add some explicitly non-translatable label textignore-translate="true"Property.Ignore some labels

Front-end effect

After the above configuration and template modification, the front-end can see the effect as shown in the figure, a multi-language switch menu appeared at the upper right corner:Ignore some labels

We try to switch to English, and we can see that the page has automatically translated:

Note, when switching language for the first time, due to no cache, a translation API request is needed, so the page takes a few seconds to open, which is a normal phenomenon.After the first time it is opened, the subsequent opening speed is faster, and subsequent openings only need to read page content from the cache.

Note, after switching to English, we can see that some parts have not been translated yet, which are set to:ignore-translate="true"attributes and<div class="languages">....</div>The part of the label content.

Ignore some labels

The multi-language feature is configured up to this point. Welcome to use and test it extensively. If any problems are found, please feedback promptly, and we will solve them as soon as possible.

Related articles

How to use the multilingual site feature tutorial one: Independent multilingual site architecture

Starting from AnQiCMS version 3.4.8, it supports more powerful multilingual site features.AnQiCMS's multilingual feature supports two implementation methods: one is to use a separate multi-site architecture (suitable for large/customization needs), and the other is a single-site translation plugin architecture (suitable for small/mid-sized/quick iteration).This will guide you through the multi-language feature of AnQiCMS: Method 1: Independent multi-site architecture (suitable for large/customized needs) This method has higher flexibility, but it also requires higher requirements for site operators, more configuration, and coding work

2025-03-29

Introduction to AnQi CMS multilingual site feature

Starting from AnQiCMS version 3.4.7, it supports more powerful multilingual site features.AnQiCMS's multilingual feature supports two implementation methods, one is to use an independent multi-site architecture (suitable for large-scale/customization needs), and the other is a single-site translation plugin architecture (suitable for small and medium-sized/rapid iteration).Two ways to implement multilingual functionality, each with its own advantages and disadvantages, please see the following description.

2025-03-29

How to use the DiDi Friend Chain automatic chaining function in AnqiCMS (AnqiCMS)

Exchanging friend links is something every website owner has to go through.Many friends have spent a lot of effort on exchanging friendship links, but the efficiency of the exchange is relatively low, resulting in wasted time.The DiDi Friend Link Platform (https://didi.seowhy.com/) has launched a feature for automatic friend link exchange, which can automatically complete the exchange of friendship links, alleviating the heavy workload of friendship link exchange.As a fully functional C

2022-11-08

Link Push Help

The use of the search engine link push function can let you notify major search engines of the documents you publish in a timely manner, so that their spiders can come and crawl the pages in time, achieving the effect of promoting page inclusion.The current system supports the following active push search engines: Baidu Search, Bing Search.The Baidu Search Active Push Interface needs to be used. You need to use the Baidu Search Resource Platform https://ziyuan.baidu.co

2022-06-21

Static Rule Help

The static rules allow you to define the URL composition form of the website according to your actual needs.For the convenience of users, to reduce the trouble of configuration, the system is built-in with 4 ready-made pseudo-static rules, which can be used directly after selection.The default static rules include: in number mode, document details, document lists, single-page details, document tags, all use {id} as the basis for URL generation, usually used more in Chinese websites.Model Naming

2022-06-21