translation guide - nself-org/nchat GitHub Wiki

Translation Contribution Guide

Welcome to the nself-chat translation community! This guide will help you contribute translations in your language.

๐ŸŒ Why Contribute?

  • Make nself-chat accessible to speakers of your language
  • Join a global community of contributors
  • Get recognition for your contributions
  • Help democratize team communication tools

๐Ÿš€ Quick Start (5 minutes)

1. Check if Your Language Exists

Look in src/locales/ to see if your language folder exists:

2. Translation Files Structure

Each language has 4 main files:

src/locales/[lang-code]/
โ”œโ”€โ”€ common.json      # Common UI strings (buttons, labels, errors)
โ”œโ”€โ”€ chat.json        # Chat-specific strings (messages, channels)
โ”œโ”€โ”€ settings.json    # Settings UI strings
โ””โ”€โ”€ admin.json       # Admin dashboard strings

3. Set Up Your Environment

# Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/nself-chat.git
cd nself-chat

# Install dependencies
pnpm install

# Start development server
pnpm dev

โž• Adding a New Language

Step 1: Create Language Folder

# Replace 'it' with your language code (ISO 639-1)
mkdir -p src/locales/it

Common language codes:

  • it - Italian
  • ko - Korean
  • nl - Dutch
  • tr - Turkish
  • hi - Hindi
  • he - Hebrew
  • pl - Polish
  • sv - Swedish

Step 2: Copy English Templates

cp src/locales/en/* src/locales/it/

Step 3: Register Your Language

Edit src/lib/i18n/locales.ts and add your language:

export const SUPPORTED_LOCALES: Record<string, LocaleConfig> = {
  // ... existing languages
  it: {
    code: 'it',
    name: 'Italiano', // Native name
    englishName: 'Italian', // English name
    script: 'Latn', // Script: Latn (Latin), Arab, Hans, Cyrl, etc.
    direction: 'ltr', // Direction: 'ltr' or 'rtl'
    bcp47: 'it-IT', // BCP 47 language tag
    flag: '๐Ÿ‡ฎ๐Ÿ‡น', // Flag emoji
    dateFnsLocale: 'it', // date-fns locale identifier
    numberLocale: 'it-IT', // Intl.NumberFormat locale
    pluralRule: 'other', // Plural rule category (see below)
    isComplete: false, // Set to true when 100% translated
    completionPercent: 0, // Update as you translate
  },
}

Plural Rules by Language

Different languages have different plural rules:

  • other - English, Spanish, German, Italian, Portuguese (2 forms)
  • few - Russian, Polish, Czech (3-4 forms)
  • many - Arabic (6 forms)
  • one - Chinese, Japanese, Korean (1 form)

Full CLDR Plural Rules

Step 4: Translate the Files

Start with common.json (most important):

{
  "app": {
    "name": "nChat",
    "tagline": "Piattaforma di Comunicazione del Team", // Translate
    "loading": "Caricamento...", // Translate
    "error": "Si รจ verificato un errore" // Translate
  }
}

Rules:

  • โœ… Translate the values (right side)
  • โŒ Don't change the keys (left side)
  • โœ… Keep variables like {{name}} unchanged
  • โœ… Maintain proper JSON syntax

Step 5: Test Your Translations

# Run the dev server
pnpm dev

# Open http://localhost:3000
# Go to Settings โ†’ Language
# Select your language
# Navigate through the app to see your translations

Step 6: Submit Your Contribution

# Create a new branch
git checkout -b add-italian-translation

# Add your files
git add src/locales/it/
git add src/lib/i18n/locales.ts

# Commit your changes
git commit -m "feat(i18n): Add Italian translation"

# Push to your fork
git push origin add-italian-translation

# Create a Pull Request on GitHub

๐Ÿ”„ Improving Existing Translations

Find What Needs Translation

# Check translation completion
node scripts/check-translations.js it

# Find missing keys
node scripts/find-missing-keys.js it

Update Translations

  1. Edit the JSON files in src/locales/[your-lang]/
  2. Translate missing or incorrect strings
  3. Test in the UI
  4. Submit a pull request

๐Ÿ“‹ Translation Guidelines

โœ… DO

  1. Translate for context

    • Understand where the text appears in the UI
    • Use natural, fluent language
    • Match the app's friendly but professional tone
  2. Preserve formatting

    {
      "welcome": "Benvenuto, {{name}}!" // โœ… Keep {{name}}
    }
  3. Handle plurals correctly

    {
      "messages_one": "{{count}} messaggio",
      "messages_other": "{{count}} messaggi"
    }
  4. Use appropriate formality

    • Match the app's tone (usually informal "you")
    • Be consistent across all translations
  5. Test in the UI

    • See how your translations look
    • Check for text overflow
    • Verify context makes sense

โŒ DON'T

  1. Don't use machine translation only

    • Machine translation is a starting point
    • Always review and refine
    • Get feedback from other native speakers
  2. Don't translate technical terms

    • Keep: URL, API, OAuth, GraphQL, JSON, etc.
    • Exception: If your language has widely accepted translation
  3. Don't change interpolation variables

    {
      "welcome": "Benvenuto, {{nome}}!"  // โŒ Wrong
      "welcome": "Benvenuto, {{name}}!"  // โœ… Correct
    }
  4. Don't break JSON syntax

    • Use proper quotes: " not " or "
    • Escape special characters: \", \\n
    • Validate JSON: Use an editor with syntax highlighting

๐ŸŽฏ Translation Examples

Example 1: Simple Translation

English:

{
  "app": {
    "save": "Save",
    "cancel": "Cancel"
  }
}

Italian:

{
  "app": {
    "save": "Salva",
    "cancel": "Annulla"
  }
}

Example 2: With Interpolation

English:

{
  "time": {
    "ago": "{{time}} ago"
  }
}

Italian:

{
  "time": {
    "ago": "{{time}} fa"
  }
}

Example 3: With Plurals

English:

{
  "members": {
    "count_one": "{{count}} member",
    "count_other": "{{count}} members"
  }
}

Italian:

{
  "members": {
    "count_one": "{{count}} membro",
    "count_other": "{{count}} membri"
  }
}

Example 4: Complex Plural (Arabic)

Arabic needs more plural forms:

{
  "messages": {
    "count_zero": "ู„ุง ุชูˆุฌุฏ ุฑุณุงุฆู„",
    "count_one": "ุฑุณุงู„ุฉ ูˆุงุญุฏุฉ",
    "count_two": "ุฑุณุงู„ุชุงู†",
    "count_few": "{{count}} ุฑุณุงุฆู„",
    "count_many": "{{count}} ุฑุณุงู„ุฉ",
    "count_other": "{{count}} ุฑุณุงู„ุฉ"
  }
}

๐ŸŒ RTL (Right-to-Left) Languages

If you're adding an RTL language (Arabic, Hebrew, Persian, Urdu):

Special Considerations

  1. Set direction in locale config

    direction: 'rtl',
  2. Test RTL layout

    • Sidebar should be on the right
    • Text should be right-aligned
    • Icons should be mirrored
  3. Report layout issues

    • If something doesn't look right in RTL
    • Open an issue with screenshots
    • We'll fix the CSS

RTL-Specific Strings

Some strings need RTL-specific handling:

{
  "formatting": {
    "bold": "**ุบุงู…ู‚**", // Arabic text between English markers
    "example": "ู…ุซุงู„: {{text}}" // RTL text with LTR variable
  }
}

๐Ÿ” Quality Checklist

Before submitting your translation, verify:

  • All JSON files are valid (no syntax errors)
  • All keys from English version are present
  • Variables like {{name}} are unchanged
  • Plural forms follow your language's rules
  • Reviewed by at least one other native speaker
  • Tested in the UI (if possible)
  • Consistent terminology across all files
  • Natural, fluent language (not literal translation)
  • Appropriate formality level
  • Technical terms handled correctly

๐ŸŽ–๏ธ Recognition

Contributors

All contributors are recognized in:

  • CONTRIBUTORS.md file
  • GitHub Contributors page
  • App's "About" section (optional)
  • Release notes for language additions

Translation Credits

Each translation file can include translator credits:

{
  "_meta": {
    "translators": [
      {
        "name": "Your Name",
        "github": "yourusername",
        "email": "[email protected]" // optional
      }
    ],
    "lastUpdated": "2026-01-31",
    "completionPercent": 100
  },
  "app": {
    // ... translations
  }
}

๐Ÿ“Š Translation Status

Current status of all languages:

Language Common Chat Settings Admin Total
English (en) 100% 100% 100% 100% 100%
Spanish (es) 100% 100% 100% 95% 98%
French (fr) 100% 100% 100% 95% 98%
German (de) 100% 100% 95% 90% 96%
Chinese (zh) 100% 100% 90% 85% 93%
Arabic (ar) 100% 95% 85% 80% 90%
Japanese (ja) 100% 95% 80% 75% 87%
Portuguese (pt) 100% 95% 80% 75% 87%
Russian (ru) 100% 95% 80% 75% 87%

Check latest status

๐Ÿ†˜ Getting Help

Need Help Translating?

  1. Context Questions

    • Don't understand a string?
    • Need to see it in the UI?
    • Ask in the Pull Request comments
  2. Technical Issues

    • JSON syntax problems?
    • Setup issues?
    • Testing problems?
    • Open an issue or ask in Discussions
  3. Translation Discussions

    • Join GitHub Discussions
    • Connect with other translators
    • Discuss terminology
    • Share best practices

Contact

๐Ÿ“š Resources

Translation Tools

Style Guides

Similar Apps for Reference

Check terminology in similar apps:

  • Slack
  • Discord
  • Microsoft Teams
  • Telegram

๐ŸŽ‰ Thank You!

Thank you for contributing to make nself-chat accessible to more people worldwide!

Every translation helps democratize team communication and brings the power of self-hosted, open-source collaboration to more communities.

Your contribution makes a real difference! ๐ŸŒ๐Ÿ’™


Ready to start? Create your first Pull Request!

Questions? Join the discussion!

โš ๏ธ **GitHub.com Fallback** โš ๏ธ