Starting from AnQiCMS version 3.4.7, it supports a more powerful multilingual site feature.
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).
Two ways to implement multilingual functionality, each with its own advantages and disadvantages, please see the following description for details.
Method 1: Independent multi-site architecture (suitable for large/customized needs)
Tutorial View:Tutorial for using a multi-site architecture with multilingual sites
Technical Implementation Details
- Master-Slave Site Synchronization Mechanism
- The master site communicates with the slave site through an API interface to synchronize content data.
- Data storage uses an independent database to ensure data consistency across sites.
- Synchronization frequency can be configured for real-time and manual triggering.
- The master site communicates with the slave site through an API interface to synchronize content data.
Enhanced points for background operations:
Content synchronization mechanism
- Design a 'main-child' content synchronization system, supporting:
- Full synchronization
- Incremental synchronization (only synchronize new content)
- Manual secondary editing (After translation, it 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[The main site releases new content] --> B{Synchronize} B --> |Automatic translation| C[AI translation engine] B --> |Do not automatically translate| D[Direct synchronization] C & D --> E[Sub-site content]
- Provide translation/synchronization mode:
Route strategy expansion
Route type Implementation plan SEO suggestions Independent domain DNS resolution + CNAME record (en.anqicms.com) Submit each domain name separately to the site manager tool Secondary directory Nginx path rewrite (anqicms.com/en/) Use hreflang tags to associate versions URL does not change Browser Cookie/Session Language Identification Needs to be used with canonical tag
SEO Optimization Enhancement Points
- SEO Strategy for Independent Domain
- Each language site uses a separate domain name (such as
en.anqicms.com), and submit it to the search engine tool of the corresponding country.
- Use
hreflangTags associate with different language versions of pages to avoid duplicate content penalties.
- Each language site uses a separate domain name (such as
User Access Enhancement:
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 issues
- When accessing the target language site without a corresponding page:
- This situation usually occurs when new content is added to the main site and the sub-site has not been synchronized
- Please the site administrator manually synchronize in the multilingual feature in the site settings
- If automatic translation is not selected, after synchronization is complete, you still need to go to the corresponding language site for manual translation operation
- This situation usually occurs when new content is added to the main site and the sub-site 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 / agile iteration)
Tutorial View:Single-site translation plugin architecture multi-language site usage tutorial
Enhanced points for background operations:
Dynamic content processing
- Supports tag text translation:
<!-- 原始内容 --> <div> 欢迎新用户 </div> <!-- 翻译缓存(法语) --> <div> Bienvenue aux nouveaux utilisateurs </div>
- Support translation of attribute text 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 by attribute label
ignore-translate="true"Ignore translation label content:<div ignore-translate="true">不翻译的文本</div> - Automatically skip
hreflang/<div class="languages">...</div>Processing of code block.
- Supports tag text translation:
Cache management
Translation results will be stored in html text format, according to different languages,cachedirectory.
First time visiting the translation page without caching, it will first request the translation server to translate and then save it to the corresponding language cache file.If the translation cache already exists, it will be displayed directly to accelerate page access.The backend provides translation records and translation cache list for convenient operation management
Extended 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 the background management interface, allowing administrators to manually trigger the 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 is displayed first, and a failure request log is recorded.
User Access Enhancement:
SEO friendly
- Translation operation is completed on the server, not after the user opens the page and uses JS translation
- The search engine crawling results are also the translated results
Exception handling mechanism
- When the translation service fails:
- Fallback to display the original language
- Record failed requests and retry translation on next visit
- Fallback to display the original language
- When the translation service fails:
▶ Multilingual enhancement
SEO core configuration
<html lang="fr">Language properties
- hreflang multilingual association
translation processing
- Method 1 Automatic translation uses text translation, only translates documents, and requires manual handling of template multilingualism.
- Method 2: Automatically 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 | ✅ Supports deep localization (such as replacing images/layouts) | ⚠️ Only text-level translation, results 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 | ⚠️ There is a delay in synchronization | ✅ Instant translation of new content |
| Applicable scenarios | Large multinational corporations/lawful strong compliance scenarios | Small and medium-sized enterprises/quick to sea MVP |
It is recommended to choose according to the business stage: initially use method 2 to quickly validate the market, and gradually migrate to method 1 as the user base grows.