Skip to content

Multi-language Support (i18n)

Docker Pilot supports multiple languages to provide a localized experience for users worldwide.

Supported Languages

Currently supported languages:

  • English (en) - Default language
  • Português (Brasil) (pt-br) - Complete Portuguese translation

Automatic Language Detection

Docker Pilot automatically detects your system language on first run:

# System language detection (Linux/macOS)
echo $LANG
# pt_BR.UTF-8 → Portuguese (Brasil)
# en_US.UTF-8 → English

# Windows detection
echo $env:LANG
# Uses system locale settings

Language Selection

First Run

When you run Docker Pilot for the first time, you'll be prompted to select your language:

🌍 Welcome to Docker Pilot!
Please choose your language / Por favor, escolha seu idioma:

1. English
2. Português (Brasil)

Select option / Selecione a opção (1-2):

This selection is saved to your configuration file and remembered for future runs.

Changing Language

You can change the language at any time using several methods:

Method 1: Interactive Menu

  1. Start Docker Pilot: docker-pilot
  2. Navigate to Advanced settings (option 15)
  3. Select Change language (option 1)
  4. Choose your preferred language
  5. The change takes effect immediately

Method 2: Configuration File

Edit your docker-pilot.config.json:

{
  "projectName": "my-project",
  "language": "pt-br",
  "services": {
    // ...
  }
}

Method 3: CLI Parameter

# Use Portuguese for this session
docker-pilot --lang pt-br

# Set language permanently
docker-pilot config --set language=pt-br

Method 4: Environment Variable

# Temporary (current session)
export DOCKER_PILOT_LANG=pt-br
docker-pilot

# Permanent (add to .bashrc/.zshrc)
echo 'export DOCKER_PILOT_LANG=pt-br' >> ~/.bashrc

Language Features

Complete Interface Translation

All user-facing text is translated:

  • Interactive Menu: All menu options and messages
  • CLI Commands: Help text, error messages, and output
  • Status Messages: Success, error, and warning messages
  • Configuration: Validation messages and prompts
  • Plugin System: Plugin messages and errors

Context-Aware Translations

Translations include context-specific information:

// English
"Service {serviceName} started successfully"
"Starting {count} services..."
"Port {port} is already in use"

// Portuguese (Brasil)
"Serviço {serviceName} iniciado com sucesso"
"Iniciando {count} serviços..."
"Porta {port} já está em uso"

Docker Commands Remain in English

Docker-specific commands and output remain in English for consistency:

# These remain in English regardless of language
docker compose up
docker compose down
docker logs container_name

Examples by Language

English Interface

============================================================
🐳 Welcome to MyApp Docker Pilot v2.0! 🐳
============================================================

📁 Directory: /path/to/project
🔧 Services: web, api, database

====================================
🚀 Basic Commands
====================================
1. Quick setup (detect services)
2. Start all services
3. Stop all services
4. Restart all services
...

Choose your option:

Portuguese (Brasil) Interface

============================================================
🐳 Bem-vindo ao MyApp Docker Pilot v2.0! 🐳
============================================================

📁 Diretório: /path/to/project
🔧 Serviços: web, api, database

====================================
🚀 Comandos Básicos
====================================
1. Configuração rápida (detectar serviços)
2. Iniciar todos os serviços
3. Parar todos os serviços
4. Reiniciar todos os serviços
...

Digite sua escolha:

CLI Command Examples

English

$ docker-pilot up
 Starting services...
 Service web started successfully
 Service api started successfully
 Service database started successfully
🎉 All services started successfully!

$ docker-pilot status
📊 Current Service Status:
 web: running (healthy)
 api: running (healthy)
 database: running (healthy)

Portuguese (Brasil)

$ docker-pilot up
 Iniciando serviços...
 Serviço web iniciado com sucesso
 Serviço api iniciado com sucesso
 Serviço database iniciado com sucesso
🎉 Todos os serviços iniciados com sucesso!

$ docker-pilot status
📊 Status Atual dos Serviços:
 web: rodando (saudável)
 api: rodando (saudável)
 database: rodando (saudável)

Error Messages

Error messages are also translated:

English

 Error: Docker is not running
💡 Please start Docker and try again

 Error: Service 'web' not found
💡 Available services: api, database

⚠️  Warning: Port 8080 is already in use
💡 Consider using a different port

Portuguese (Brasil)

 Erro: Docker não está rodando
💡 Inicie o Docker e tente novamente

 Erro: Serviço 'web' não encontrado
💡 Serviços disponíveis: api, database

⚠️  Aviso: Porta 8080  está em uso
💡 Considere usar uma porta diferente

Configuration Examples

Project Configuration

Your project's language setting is stored in docker-pilot.config.json:

{
  "projectName": "minha-aplicacao",
  "language": "pt-br",
  "dockerCompose": "docker compose",
  "services": {
    "web": {
      "port": 8080,
      "healthCheck": true
    }
  }
}

Global Configuration

You can set a global default language:

# Set global language preference
npm config set docker-pilot:language pt-br

# Or use environment variable
export DOCKER_PILOT_LANG=pt-br

Plugin Development

When developing plugins, use the i18n system:

// plugin.js
import { I18n }  from "docker-pilot";

class MyPlugin {
  constructor() {
    this.i18n = new I18n();
  }

  execute() {
    console.log(this.i18n.t('plugin.my_message'));
    console.log(this.i18n.t('plugin.service_count', { count: 3 }));
  }
}

Add translations to your plugin:

// translations.js
module.exports = {
  en: {
    'plugin.my_message': 'Plugin executed successfully',
    'plugin.service_count': 'Found {count} services'
  },
  'pt-br': {
    'plugin.my_message': 'Plugin executado com sucesso',
    'plugin.service_count': 'Encontrados {count} serviços'
  }
};

Language Detection Logic

Docker Pilot uses the following priority order for language detection:

  1. CLI Parameter: --lang pt-br
  2. Environment Variable: DOCKER_PILOT_LANG=pt-br
  3. Configuration File: language: "pt-br"
  4. System Language: $LANG, $LANGUAGE, or Windows locale
  5. Default: en (English)

Contributing Translations

Adding a New Language

To add support for a new language:

  1. Fork the repository
  2. Add language code to supported languages in src/utils/i18n.ts
  3. Create translation file with all required keys
  4. Test thoroughly with interactive menu and CLI
  5. Submit pull request with examples and documentation

Translation Guidelines

  • Keep it natural: Translations should sound natural to native speakers
  • Maintain context: Preserve the meaning and context of the original text
  • Use consistent terminology: Keep Docker and technical terms consistent
  • Test extensively: Test both interactive menu and CLI commands
  • Include examples: Provide examples of the translated interface

Required Translation Keys

All translations must include these key categories:

  • docker.* - Docker-related messages
  • menu.* - Interactive menu items
  • command.* - Command names and descriptions
  • service.* - Service management messages
  • cli.* - CLI help and error messages
  • plugin.* - Plugin system messages
  • validation.* - Configuration validation messages

Troubleshooting

Language Not Changing

# Check current language
docker-pilot config --show | grep language

# Force language change
docker-pilot config --set language=pt-br

# Verify change
docker-pilot config --show | grep language

Mixed Language Output

If you see mixed languages:

  1. Check configuration: Ensure language is set correctly
  2. Clear cache: Some messages might be cached
  3. Restart terminal: Environment variables might need refresh
  4. Update Docker Pilot: Ensure you have the latest version

Missing Translations

If you see English text in non-English mode:

  1. Check version: Ensure you have the latest version
  2. Report issue: Missing translations should be reported
  3. Contribute: Help by contributing the missing translation

Best Practices

For Users

  • Set language once: Configure your preferred language in the project
  • Use consistent language: Keep the same language across your team
  • Report issues: Help improve translations by reporting problems

For Teams

  • Document language choice: Include language preference in project README
  • Consistent environment: Use the same language across development, staging, and production
  • Training: Ensure all team members know how to change language if needed

For Plugin Developers

  • Use i18n system: Always use the translation system for user-facing messages
  • Provide translations: Include translations for all supported languages
  • Test multiple languages: Test your plugin in different languages

What's Next?


Language Support

Docker Pilot's multi-language support makes it accessible to developers worldwide. The interface adapts to your language while keeping Docker commands standard for consistency across different environments.