README

Documentation for Developers

🌐 Translation System Documentation

Complete AI-powered translation system using gograb-ai - $0/month cost.

📚 Documentation Index

Quick Start

  1. TRANSLATION-SYSTEM-COMPLETE.md ⭐ START HERE

    • Complete system overview
    • What's implemented
    • Quick commands reference
    • Cost savings breakdown
  2. i18n-ai-quick-start.md ⚡ 5-MINUTE GUIDE

    • Quick workflow for AI agents
    • Translation templates
    • Common commands
    • Real examples

Detailed Guides

  1. i18n-gograb-ai-integration.md 🤖

    • gograb-ai setup and integration
    • How to use your local AI for translations
    • Zero-cost alternative to Smartcat
    • Implementation details
  2. i18n-ai-agent-workflow.md 🔄

    • Complete AI agent workflow
    • Automated detection and translation
    • Quality assurance
    • Continuous monitoring
  3. i18n-automatic-sync.md âš™ī¸

    • Auto-sync system explained
    • How translations sync before builds
    • Troubleshooting guide
    • Configuration details

🚀 Quick Commands

# Main automated translation workflow
yarn translate:fix               # ⭐ MAIN COMMAND - Fully automated translation

# Diagnostic and validation
yarn translate:scan              # Intelligent monorepo scanner (deep diagnostics)
yarn translate:test              # Validate translation files

# Manual sync (usually automatic)
yarn translate:sync              # Sync JSON → TypeScript embedded format

# Development (auto-syncs)
yarn serve:gograb-space           # Serve with auto-sync
nx serve gograb-space            # Serve with auto-sync
nx build gograb-space            # Build with auto-sync

âš™ī¸ Environment Setup (Required)

Before using the translation system, configure your environment variables:

# 1. Copy the template
cp environments/backend.env.template .env.local

# 2. Add your Anthropic API key
# Get from: https://console.anthropic.com/settings/keys
# Edit .env.local and add: ANTHROPIC_API_KEY=sk-ant-your-key-here

# 3. Generate JWT secret
openssl rand -base64 32  # Copy output to JWT_SECRET in .env.local

# 4. Verify .env.local has these 3 required variables:
#    - ANTHROPIC_API_KEY=sk-ant-your-key-here
#    - SYSTEM_TOKEN=<YOUR_SYSTEM_TOKEN>
#    - JWT_SECRET=your-random-secret-here

📚 Complete Setup Guide: See environments/README.md

🔒 Security: .env.local is git-ignored and safe to use locally. Never commit API keys!

💰 Cost Savings

Service Cost Our Solution
Smartcat $99+/month $0 (gograb-ai)
Google Translate API $20/1M chars $0 (gograb-ai)
DeepL API â‚Ŧ4.99+/month $0 (gograb-ai)

Annual Savings: $1,188+

đŸŽ¯ System Features

✅ Zero Cost - Uses existing gograb-ai infrastructure
✅ Auto-Sync - Translations sync before every build
✅ AI-Powered - Context-aware translations via gograb-ai
✅ Intelligent Scanner - Finds hardcoded strings automatically
✅ Flash Persistence - Language preference synced across devices
✅ 100% Private - All data stays on your servers
✅ Production Ready - Currently powering gograb-space

📊 Current Status

🔧 For Developers

Adding Translations

  1. Edit JSON files:

    // libs/libs-foundational/i18n/src/assets/i18n/en.json
    {
      "myFeature": {
        "title": "My New Feature"
      }
    }
    
  2. Use in templates:

    <h1>{{ 'myFeature.title' | transloco }}</h1>
    
  3. Serve (auto-syncs):

    nx serve gograb-space
    

That's it! The system handles everything else.

🤖 For AI Agents

Translation Workflow (100% Automated!)

  1. Add transloco key to your HTML:

    <p>{{ 'dashboard.myNewKey' | transloco }}</p>
    
  2. Run ONE command:

    yarn translate:fix
    
  3. That's it! The system automatically:

    • ✅ Detects undefined keys
    • ✅ Adds them to en.json
    • ✅ Calls backend-api AI to translate to Spanish
    • ✅ Updates es.json
    • ✅ Syncs to production embedded format
    • ✅ Ready to test!
  4. Optional diagnostics:

    yarn translate:scan    # Deep scan (finds 1,815+ hardcoded strings)
    yarn translate:test    # Validate JSON files
    

📁 File Locations

Core Library

libs/libs-foundational/i18n/
├── src/
│   ├── lib/
│   │   ├── services/           (Translation services)
│   │   ├── models/             (TypeScript interfaces)
│   │   ├── config/             (Transloco configuration)
│   │   └── translations/       (Embedded translations - auto-generated)
│   └── assets/
│       └── i18n/
│           ├── en.json         (English - source)
│           └── es.json         (Spanish - AI translated)
└── project.json                (Auto-sync configuration)

Scripts

tools/scripts/translation/
├── fully-automated-translator.js  (Main automation - yarn translate:fix)
├── intelligent-scanner.js         (Deep diagnostics - yarn translate:scan)
├── sync-embedded-translations.js  (Auto-sync JSON → TS)
├── test-translations.js           (Validation)
└── ai-agent-prompt.md             (AI context and glossary)

Documentation

docs/english/Developers/translation/  (YOU ARE HERE)
├── README.md                   (This file)
├── TRANSLATION-SYSTEM-COMPLETE.md (Complete guide)
├── i18n-ai-quick-start.md     (5-minute guide)
├── i18n-gograb-ai-integration.md (gograb-ai setup)
├── i18n-ai-agent-workflow.md  (AI workflow)
└── i18n-automatic-sync.md     (Auto-sync guide)

🎓 Learning Path

New to the system?

  1. Read: TRANSLATION-SYSTEM-COMPLETE.md (10 min)
  2. Follow: i18n-ai-quick-start.md (5 min)
  3. Try: yarn translate:scan to see it in action

Setting up AI translation?

  1. Read: i18n-gograb-ai-integration.md (15 min)
  2. Follow: i18n-ai-agent-workflow.md (20 min)
  3. Run: yarn translate:gograb to generate prompts

Understanding auto-sync?

  1. Read: i18n-automatic-sync.md (10 min)
  2. Test: Edit JSON file, run nx serve gograb-space
  3. Verify: Language switching works automatically

🆘 Troubleshooting

Translations not showing?

yarn translate:fix               # Auto-fix everything
nx reset                         # Clear NX cache
nx serve gograb-space            # Restart dev server

Missing translation keys?

yarn translate:fix               # Auto-detects and adds missing keys!

Want to find hardcoded strings?

yarn translate:scan              # Deep diagnostics - shows all 1,815+ hardcoded strings!

🌟 Highlights

Intelligent Scanner

Our new scanner finds:

Run: yarn translate:scan

Automatic Sync

Every build/serve automatically:

  1. Syncs translations from JSON
  2. Flattens for AOT performance
  3. Embeds in TypeScript
  4. Ready for production

No manual steps needed!

gograb-ai Integration

Your existing AI infrastructure handles:

All at $0 cost!

📞 Support

🎉 Success Metrics


System Status: ✅ Production Ready
Version: 1.0.0
Cost: $0/month (using gograb-ai)
Last Updated: November 20, 2025
Location: docs/english/Developers/translation/