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 use of a standalone multisite architecture (suitable for large/highly customized needs), and the other is a single-site translation plugin architecture (suitable for small/medium-sized/Agile iteration).
Two ways to implement multilingual functionality, each with its own advantages and disadvantages, please see the following description.
Method 1: Independent multi-site architecture (suitable for large-scale or highly customized needs)
Tutorial View:Multilingual Site Usage Tutorial with Independent Multi-Site 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.
- 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 for background operations:
Content synchronization mechanism
- Design a 'master-child' content synchronization system, supporting:
- Full synchronization
- Incremental synchronization (synchronizes only new content)
- Manual Secondary Editing (Translation is allowed to enter the corresponding language site for modification and optimization, such as replacing images/texts)
- Design a 'master-child' content synchronization system, supporting:
Translation Process
- Provide Translation/Synchronization Mode:
graph LR A[Site releases new content] --> B{Sync} B -->|Auto Translate| C[AI Translation Engine] B -->|Do not Auto Translate| D[Direct Sync] C & D --> E[Subsite Content]
- Provide Translation/Synchronization Mode:
Route Policy Expansion
Route Type Implementation Plan SEO Suggestions Independent Domain DNS resolution + CNAME record (en.anqicms.com) Submit the site master tool for each domain separately Secondary directory Nginx path rewrite (anqicms.com/en/) Associate versions using the hreflang tag URL does not change Browser Cookie/Session identifies language Need to be accompanied by canonical tag
SEO optimization enhancement points
- Independent domain SEO strategy
- Each language site uses an independent domain (such as
en.anqicms.com
),and submit to the corresponding country's search engine tool.
- use
hreflang
Tag related pages in different language versions to avoid duplicate content penalties.
- Each language site uses an independent domain (such as
User access enhancement point:
Intelligent 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 issue
- When there is no corresponding page on the target language site:
- This situation usually occurs when new content is added to the main site and the sub-site has not been synchronized yet
- Please the site administrator manually in the multilingual feature to actively synchronize
- If automatic translation is not selected, manual translation operations need to be performed on the corresponding language site after synchronization is complete
- This situation usually occurs when new content is added to the main site and the sub-site has not been synchronized yet
- When there is no corresponding page on the target language site:
▶ Method 2: Single Station Translation Plugin Architecture (suitable for medium and small-sized / agile iteration)
Tutorial View:Single Station Translation Plugin Architecture Multilingual Site Usage Tutorial
Enhanced points for background operations:
Dynamic Content Processing
- Supports Tag Text Translation:
<!-- 原始内容 --> <div> 欢迎新用户 </div> <!-- 翻译缓存(法语) --> <div> Bienvenue aux nouveaux utilisateurs </div>
- Translation for text attributes such as title, placeholder, alt, meta, etc.:
<!-- 原始内容 --> <img src="..." alt="欢迎新用户"> <!-- 翻译缓存(法语) --> <img src="..." alt="Bienvenue aux nouveaux utilisateurs">
- Supports auto-skipping specified tags (do not translate code blocks)
<code>{{ variable }}</code>
/<script>
/<style>
etc.)
- Support translation through attribute tags
ignore-translate="true"
Ignore the translation tags content:<div ignore-translate="true">不翻译的文本</div>
- Skip automatically
hreflang
/<div class="languages">...</div>
Processing code blocks.
- Supports Tag Text Translation:
Cache management
The translation results will be stored in HTML text format, categorized by different languages,cache
in the directories.
The first-time visit to an uncached translation page will first request translation from the translation server, and then save it to the corresponding language cache file.If there is already a translation cache, it will be presented directly to accelerate page access.
and extends the exception handling mechanism.
- Translation Service Degradation Strategy
- When the translation service is unavailable, the original language content is displayed first, and a failure request log is recorded.
- Provide a backend management interface, allowing administrators to manually trigger a retry translation operation.
- Support offline mode: pre-cache commonly used translation results to reduce dependence on translation services.
- When the translation service is unavailable, the original language content is displayed first, and a failure request log is recorded.
User access enhancement point:
SEO-friendly
- Translation is performed on the server, not after the user opens the page using JS
- The search engine's crawling results are also translated
Exception handling mechanism
- When the translation service fails:
- Show in original language downgrade
- Record failed requests and retry translation on next visit
- Show in original language downgrade
- 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 template multilingualism.
- Method 2 Automatic translation using HTML translation, translating the entire HTML content.
▶ Selection suggestion for scheme
Comparison dimensions | Advantages of Method 1 | Advantages of Method 2 |
---|---|---|
Content flexibility | ✅ Supports deep localization (such as replacing images/layout) | ⚠️ Only text-level translation, the result cannot be customized |
SEO effect | ✅ Independent sites are more easily indexed by local search engines | ⚠️ Avoid duplicate content |
Maintenance cost | ⚠️ Need to manage multiple sites | ✅ Unified content source |
Real-time | ⚠️ Delay in synchronization | ✅ Immediate translation of new content |
Applicable scenarios | Large multinational corporations/law 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 validate the market in the initial stage, and gradually migrate to method 1 as the user base grows.