Bilingual Documentation System
Overview
The Hexagonal Maker Bundle documentation is available in two languages:
- 🇬🇧 English (default)
- 🇫🇷 French
Language Switcher
A language switcher is available in the top-right corner of every documentation page, allowing users to seamlessly switch between languages.
Structure
docs/
├── index.md # English home page
├── fr/
│ └── index.md # French home page
├── advanced/ # English advanced guides
│ ├── domain-vs-application.md
│ ├── request-response-flow.md
│ ├── port-design-principles.md
│ ├── primary-secondary-adapters.md
│ ├── cqrs-cost-benefit.md
│ ├── dependency-injection-guide.md
│ ├── factory-pattern-guide.md
│ ├── error-handling-strategy.md
│ └── anti-patterns-pitfalls.md
├── ARCHITECTURE.md # Available in French
├── WHY-HEXAGONAL.md # English
├── SOLID.md # English
└── _includes/
└── language-switcher.html # Language switcher component
How It Works
1. Layout Template
The default_with_lang layout includes the language switcher:
---
layout: default
title: Your Page Title
lang: en # or 'fr'
lang_ref: fr/page.md # Optional: reference to translated version
---
2. Language Attributes
Each page with bilingual support should include:
lang: Current language (enorfr)lang_ref: Relative path to the translated version (optional)
Example (English page):
---
layout: default
title: Home
lang: en
lang_ref: fr/index.md
---
Example (French page):
---
layout: default
title: Accueil
lang: fr
lang_ref: index.md
---
3. Language Switcher Component
The _includes/language-switcher.html component:
- Shows current language as text
- Shows link to alternate language
- Uses flags (🇬🇧/🇫🇷) for visual identification
- Fixed position in top-right corner
- Responsive (moves to static position on mobile)
Adding a New Bilingual Page
Step 1: Create English Version
---
layout: default
title: My New Page
parent: Advanced Topics
nav_order: 20
lang: en
lang_ref: fr/advanced/my-new-page.md
---
# My New Page
Content in English...
Step 2: Create French Version
---
layout: default
title: Ma Nouvelle Page
parent: Sujets Avancés
nav_order: 20
lang: fr
lang_ref: advanced/my-new-page.md
---
# Ma Nouvelle Page
Contenu en français...
Step 3: Update Navigation (if needed)
For French-only navigation sections, create fr/advanced/index.md:
---
layout: default
title: Sujets Avancés
nav_order: 3
has_children: true
lang: fr
---
Current Translation Status
âś… Fully Translated
- Home page (
index.md↔fr/index.md)
🔄 Partially Translated
- Architecture Guide (
ARCHITECTURE.md- has French version)
❌ Not Yet Translated
- Advanced Topics (9 guides) - currently English only
- Getting Started guides
- Maker Commands reference
- Examples
- WHY-HEXAGONAL.md
- SOLID.md
Translation Workflow
Priority Order
- High Priority (User-facing):
- Home page âś…
- Quick Start guide
- Architecture Guide (partial âś…)
- Medium Priority (Conceptual):
- Why Hexagonal
- SOLID Principles
- Advanced Topics (9 guides)
- Low Priority (Reference):
- Maker Commands
- Examples
- Contributing guides
Translation Guidelines
- Consistency: Use consistent terminology
- “Port” → “Port” (keep in French too)
- “Adapter” → “Adaptateur”
- “Domain” → “Domaine”
- “Handler” → “Handler” (keep English term)
-
Code Examples: Keep code in English (variable names, comments in English)
- Technical Terms: Keep well-established English terms when appropriate
- CQRS (don’t translate)
- Factory Pattern → “Pattern Factory”
- Dependency Injection → “Injection de Dépendances”
- File Names:
- French content goes in
fr/subdirectories - Keep original English file names for consistency
- French content goes in
Maintenance
When Adding New Content
- Create English version first (default)
- Add
layout: defaultandlang: en - Add
lang_refif French version exists or planned - Create French version in
fr/subdirectory - Update both index pages to reference new content
When Updating Content
- Update English version
- Update French version (if exists)
- If major changes, add note about translation status
Styling
The language switcher uses:
- Fixed positioning (top-right)
- White background with border
- Hover effects on links
- Emoji flags for visual recognition
- Responsive design for mobile
Custom CSS in language-switcher.html ensures:
- Proper z-index (1000) to stay on top
- No interference with main navigation
- Accessibility considerations
Future Enhancements
Potential improvements:
- Add more languages (ES, DE, etc.)
- Automatic language detection based on browser
- Translation progress indicator
- Crowdin integration for community translations
- Search within specific language
- Language-specific navigation sidebar
Contributing Translations
To contribute a translation:
- Fork the repository
- Create translations in
docs/fr/(or other language folder) - Add
langandlang_refmetadata - Test locally with Jekyll
- Submit pull request
Testing
Local Testing
cd docs
bundle install
bundle exec jekyll serve
# Visit http://localhost:4000
# Test language switcher functionality
# Verify both EN and FR versions
Checklist
- Language switcher appears on all pages
- Clicking switcher navigates to correct language
- Navigation works in both languages
- Search works in both languages
- Mobile responsive design works
- No broken links between language versions
Documentation Structure by: Ahmed EBEN HASSINE Last Updated: 2024-01-15