Best Practices

Follow these best practices to get the most out of Terry Translation.

Project Organization

File Structure

project/
├── locales/
│   ├── en/
│   │   └── messages.json
│   ├── es/
│   ├── fr/
│   └── zh/
└── terry.config.js

Configuration Management

// Good: Use environment variables
const config = {
  apiKey: process.env.TERRY_API_KEY,
  environment: process.env.NODE_ENV,
}

// Bad: Hardcoded values
const config = {
  apiKey: 'abc123...', // Don't do this
}

Translation Process

  1. Prepare Source Content

    • Use clear, concise language
    • Provide context for translators
    • Use placeholders consistently
  2. Use Translation Memory

    • Regularly update TM
    • Review suggestions
    • Maintain consistency
  3. Quality Assurance

    • Run QA checks before finalizing
    • Review automated translations
    • Test in context

Performance Tips

Batch Processing

// Good: Batch translations
const results = await terry.translateBatch({
  texts: ['Text 1', 'Text 2', 'Text 3'],
  from: 'en',
  to: 'es',
})

// Bad: Individual calls
const r1 = await terry.translate(text1) // Don't do this
const r2 = await terry.translate(text2) // Network overhead

Caching

// Enable caching
terry.enableCache({
  duration: '24h',
  maxSize: '100mb',
})

Next Steps