Localization (i18n)
Relevant source files
The following files were used as context for generating this wiki page:
The Localization (i18n) system in this project is designed to provide comprehensive multi-language support, specifically targeting a bilingual environment for English and Thai users. This system ensures that all user-facing documentation, system prompts, and interface elements can be delivered in the user's preferred language, maintaining parity across the platform.
The scope of localization extends from static documentation files to dynamic AI responses. The project follows an "English-first" authoring approach followed by Thai translation with cultural adaptation. This ensures that the platform remains accessible to a global audience while providing specialized support for the Thai development community.
Sources: Comprehensive.md:14, Comprehensive.md:204-211, specs/main/plan.md:13-17
Architecture and Bilingual Strategy
The localization architecture relies on a mirrored directory structure and configuration-driven content generation. The system ensures that every English resource has a direct Thai counterpart, facilitating easy maintenance and parity checks.
Directory Organization
Documentation is organized into separate directories for each language, using a numbered category system to maintain logical order.
The diagram shows the mirrored folder structure used to maintain bilingual parity between English and Thai documentation.
Sources: Comprehensive.md:105-138, specs/main/plan.md:143-181
Data Flow for Documentation Generation
A dedicated script, scripts/generate-docs.js, manages the automated creation of bilingual documentation from predefined templates. This ensures that core files like project goals and system overviews start with consistent content in both languages.
This flowchart illustrates the logic of the document generation script which creates parallel EN/TH files.
Sources: scripts/generate-docs.js:124-148
Localization Components
The project implements localization through several key components, ranging from automated scripts to AI behavioral constraints.
| Component | Description | Relevant File |
|---|---|---|
| generate-docs.js | Node.js script that populates docs/ with mirrored EN/TH Markdown files. | scripts/generate-docs.js |
| Bilingual Parity Rule | Validation rule ensuring every file in docs/en/ has a counterpart in docs/th/. | specs/main/plan.md:364-367 |
| AI Language Directive | System prompt instruction forcing the AI to reply in the user's language. | apps/client/src/prompts/system_prompt.ts:133 |
| i18n-config.json | Configuration file defining the document structure for both languages. | scripts/generate-docs.js:7 |
Sources: scripts/generate-docs.js:1-10, specs/main/plan.md:364-367, apps/client/src/prompts/system_prompt.ts:133
AI Prompt Localization
The system includes specific logic to handle localization within the AI's "Build" and "Ask" modes. The system prompt contains a primary directive requiring the AI to detect and respond in the same language used by the user.
Language Parity Logic
// apps/client/src/prompts/system_prompt.ts:133
Always reply to the user in the same language they are using.
This directive is repeated in both the BUILD_SYSTEM_PREFIX and the ASK_MODE_SYSTEM_PROMPT to ensure consistent bilingual behavior regardless of the active toolset.
Sources: apps/client/src/prompts/system_prompt.ts:133, apps/client/src/prompts/system_prompt.ts:257
Mirrored Template Content
The generate-docs.js script contains hardcoded templates for various documentation files. Each template provides the English text and its corresponding Thai translation.
// Example of mirrored templates in scripts/generate-docs.js:10-23
'project-goals.md': {
en: `# Project Goals\n\n## Vision\nCreate the best AI development IDE...`,
th: `# เป้าหมายโปรเจกต์\n\n## วิสัยทัศน์\nสร้าง IDE ที่ดีที่สุดสำหรับพัฒนา...`
}
Sources: scripts/generate-docs.js:10-23
Validation and Quality Control
To maintain the integrity of the localization system, the project uses checklists and validation scripts to ensure structure parity.
- Parity Check: A validation rule (
validate:docs) checks that the folder structure and filenames in the Thai directory mirror the English directory exactly. - Structure Consistency: Checks are performed to ensure that naming conventions for English and Thai files are consistently applied.
- Cultural Adaptation: Guidelines exist to ensure Thai translations are not just literal but include domain expertise and cultural context.
Sources: specs/main/plan.md:364-370, specs/main/checklists/implementation.md:61-66
Summary
Localization in the bl1nk platform is a foundational requirement that ensures technical documentation and AI interactions are accessible in both English and Thai. By utilizing a mirrored directory structure, automated generation scripts, and strict AI language directives, the project maintains high standards of bilingual parity. This systematic approach allows developers to contribute in their native language while keeping the platform's core knowledge base synchronized across both supported locales.