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.
- The master site communicates with the slave site through API interfaces to synchronize content data.
Enhanced points of background operations:
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)
- Design a 'main-child' content synchronization system, supporting:
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]
- Provide translation/synchronization mode:
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 as
en.anqicms.com
), and submits it to the corresponding country's search engine tools.
- Use
hreflang
Tags associate with different language versions of pages to avoid duplicate content penalties.
- Each language site uses an independent domain (such as
User Access Enhancement Point:
Smart Language Recognition
- Priority Strategy:
- URL Explicit Parameters (?lang=en)
- User Cookie Settings
- Browser Accept-Language Header
- Default Language (e.g., Simplified Chinese)
- URL Explicit Parameters (?lang=en)
- Priority Strategy:
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
- This situation usually occurs when the main station adds new content, and the sub-station has not been synchronized
- When accessing the target language site without a corresponding page:
▶ 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:
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 tags
ignore-translate="true"
Ignore translation of tagged content:<div ignore-translate="true">不翻译的文本</div>
- Automatic skipping
hreflang
/<div class="languages">...</div>
The processing of code blocks.
- Supports label text translation:)
Cache management
The translation results will be stored in HTML text form, by different languages,cache
in 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.
- When the translation service is unavailable, the original language content should be displayed first, and a failure request log should be recorded.
User Access Enhancement Point:
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
Exception handling mechanism
- When the translation service fails:
- Display in original language
- Log failed requests and retry translation on next visit
- Display in original language
- When the translation service fails:
▶ Multilingual enhancement
SEO core configuration
<html lang="fr">
Language attribute
- hreflang multilingual association
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.