Introduction to the Multilingual Site Function of AnQi CMS

Starting from AnQiCMS v3.4.7, it supports a more powerful multi-language site feature.

The multi-language feature of AnQiCMS supports two implementation methods: one is the independent multi-site architecture (suitable for large-scale/customization needs), and the other is the single-site translation plugin architecture (suitable for small and medium-sized/rapid iteration).

Two methods of implementing multilingual functionality, each with its own advantages and disadvantages, please see the details below.

Method 1: Independent multi-site architecture (suitable for large/customized needs)

Tutorial View:Multilingual Site Tutorial Using Independent Multisite Architecture

Technical Implementation Details

  • Master-Slave Site Synchronization Mechanism
    • The master site communicates with the slave site through API interfaces to synchronize content data.
    • Data storage uses an independent database to ensure consistency of data across sites.
    • The synchronization frequency can be configured to real-time and manually triggered.

Enhanced points of background operations:

  1. Content synchronization mechanism

    • Design a 'main-child' content synchronization system, supporting:
      • Full synchronization
      • Incremental synchronization (only synchronize new content)
      • Artificial secondary editing (translation is allowed to enter the corresponding language site for modification and optimization, such as replacing images/texts)
  2. Translation process

    • Provide translation/synchronization mode:
      graph LR
      A[New content released on the main station] --> B{Synchronize}
      B -->|Automatically translate| C[AI translation engine]
      B -->|Do not automatically translate| D[Direct synchronize]
      C & D --> E[Content on the sub-station]

  3. Routing Policy Extension

    Routing Type Implementation Plan SEO Suggestions
    Independent Domain DNS Resolution + CNAME Record (en.anqicms.com) Submit site tools for each domain separately
    Secondary Directory Nginx Path Rewrite (anqicms.com/en/) Use hreflang tags to associate versions
    URL remains unchanged Browser Cookie/Session Language Identification Need to be配合 canonical tag

SEO Optimization Enhancement Points

  • Independent Domain SEO Strategy
    • Each language site uses an independent domain (such asen.anqicms.com), and submits it to the corresponding country's search engine tools.
    • UsehreflangTags associate with different language versions of pages to avoid duplicate content penalties.

User Access Enhancement Point:

  1. Smart Language Recognition

    • Priority Strategy:
      1. URL Explicit Parameters (?lang=en)
      2. User Cookie Settings
      3. Browser Accept-Language Header
      4. Default Language (e.g., Simplified Chinese)
  2. Cross-site Consistency Issues

    • When accessing the target language site without a corresponding page:
      • This situation usually occurs when the main station adds new content, and the sub-station has not been synchronized
      • Please manually synchronize in the multi-language feature of the site administrator
      • If automatic translation is not selected, manual translation operations at the corresponding language site are still required after synchronization is complete

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

Tutorial View:Tutorial for using multi-language sites with single-site translation plugin architecture

Enhanced points of background operations:

  1. Dynamic content processing

    • Supports label text translation:)
      
      <!-- 原始内容 -->
      <div>
      欢迎新用户
      </div>
      <!-- 翻译缓存(法语) -->
      <div>
      Bienvenue aux nouveaux utilisateurs
      </div>
      

    • Supports translation of text in attributes such as title, placeholder, alt, meta, etc:
      
      <!-- 原始内容 -->
      <img src="..." alt="欢迎新用户">
      <!-- 翻译缓存(法语) -->
      <img src="..." alt="Bienvenue aux nouveaux utilisateurs">
      
    • Support automatic skipping of specified tags (do not translate code blocks)<code>{{ variable }}</code>/<script>/<style>etc.)
    • Support skipping through attribute tagsignore-translate="true"Ignore translation of tagged content:
      
      <div ignore-translate="true">不翻译的文本</div>
      
    • Automatic skippinghreflang/<div class="languages">...</div>The processing of code blocks.
  2. Cache management
    The translation results will be stored in HTML text form, by different languages,cachein the directory.
    When visiting the translation page without caching for the first time, the translation server will be requested first for translation, and then saved to the corresponding language cache file.If a translation cache already exists, it will be presented directly to accelerate page access.

Expansion of exception handling mechanism

  • Translation service degradation strategy
    • When the translation service is unavailable, the original language content should be displayed first, and a failure request log should be recorded.
    • Provide a backend management interface that allows administrators to manually trigger a retry translation operation.
    • Support offline mode: Pre-cache commonly used translation results to reduce dependency on translation services.

User Access Enhancement Point:

  1. SEO friendly

    • Translation is completed on the server side, not after the user opens the page and uses JS for translation
    • The search engine crawl results are also the translated results
  2. Exception handling mechanism

    • When the translation service fails:
      • Display in original language
      • Log failed requests and retry translation on next visit

▶ Multilingual enhancement

  1. SEO core configuration

    • <html lang="fr">Language attribute
    • hreflang multilingual association
  2. Translation processing

    • Method 1 Automatic translation using text translation, only translates documents, and requires manual handling of templates for multilingual support.
    • Method 2 Auto-translate using HTML translation, translating the entire HTML content.

▶ Suggestion for Scheme Selection

Comparison Dimensions Advantages of Method 1 Advantages of Method 2
Content Flexibility ✅ Support deep localization (such as replacing images/layout) ⚠️ Only text-level translation, the result cannot be customized
SEO Effect ✅ A standalone site is easier for local search engines to index ⚠️ Avoid duplicate content
Maintenance costs ⚠️ Need to manage multiple sites ✅ A unified content source
Real-time ⚠️ Synchronization has delay ✅ Instant translation of new content
Applicable scenarios Large multinational corporations/lawful strong compliance scenarios Small and medium-sized enterprises/Quick Sea Out MVP

It is recommended to choose according to the business stage: use method 2 to quickly verify the market in the initial stage, and gradually migrate to method 1 as the user volume grows.