- Add multi-language support with i18next and react-i18next - Implement user-selectable date format preferences (5 formats) - Add time format preferences (12-hour/24-hour) - Implement RTL (right-to-left) support for Arabic, Hebrew, Persian, Urdu - Add first day of week preference - Create LocalizationContext for managing i18n settings - Add LocalizationSettings component to Settings page - Include sample translations: English, Spanish, Arabic - Configure 10 languages: en, es, fr, de, ar, he, zh, ja, pt, ru - Add translation management documentation and Crowdin config - Create date formatting utilities that respect user preferences - Add RTL CSS styles for proper layout mirroring - Update Settings and ThemeToggle components to use translations - Add comprehensive documentation (implementation guide, quick reference, translation guide) All user preferences are persisted to localStorage and apply throughout the app.
5.9 KiB
Translation Management
This document explains how to manage translations for Donetick using free translation platforms available for open-source projects.
Translation Structure
Translations are organized in the /public/locales/{language}/ directory:
public/locales/
├── en/
│ ├── common.json # Common UI elements
│ ├── settings.json # Settings page translations
│ └── chores.json # Chores-related translations
├── es/ # Spanish translations
├── fr/ # French translations
└── ...
Supported Languages
The application currently supports the following languages:
- English (en) - Default
- Spanish (es)
- French (fr)
- German (de)
- Arabic (ar) - RTL supported
- Hebrew (he) - RTL supported
- Chinese (zh)
- Japanese (ja)
- Portuguese (pt)
- Russian (ru)
Translation Platforms
Recommended Platforms (Free for Open Source)
1. Crowdin (Recommended)
Website: https://crowdin.com/
Features:
- Free for open-source projects
- Easy GitHub integration
- Automatic pull requests
- Translation memory
- Context and screenshots
- Collaborative translation
- Quality assurance checks
Setup Steps:
- Sign up at https://crowdin.com/
- Create a new project and apply for open-source plan
- Connect your GitHub repository
- Upload translation files from
public/locales/en/ - Configure the
crowdin.ymlfile (see example below) - Invite translators or open for community contributions
crowdin.yml Example:
project_id: "your-project-id"
api_token_env: CROWDIN_API_TOKEN
preserve_hierarchy: true
files:
- source: /public/locales/en/*.json
translation: /public/locales/%two_letters_code%/%original_file_name%
2. Lokalise
Website: https://lokalise.com/
Features:
- Free for open-source projects (contact for approval)
- GitHub integration
- Translation memory
- Advanced filtering
- Glossary management
- API access
Setup Steps:
- Sign up at https://lokalise.com/
- Apply for open-source plan
- Create a project
- Upload translation files
- Set up GitHub integration
- Configure auto-pull/push
3. POEditor
Website: https://poeditor.com/
Features:
- Free tier available
- Open-source friendly
- Simple interface
- API access
- GitHub integration
- Translation memory
Setup Steps:
- Sign up at https://poeditor.com/
- Create a new project
- Import JSON files from
public/locales/en/ - Add languages you want to support
- Invite contributors
- Set up GitHub integration for auto-sync
4. Weblate
Website: https://weblate.org/
Features:
- Completely free for open-source
- Self-hosted or hosted option
- Git integration
- Quality checks
- Translation memory
- Glossary
Setup Steps:
- Go to https://hosted.weblate.org/
- Sign in with GitHub
- Add a new component
- Configure repository access
- Set file format to JSON
- Invite translators
Adding a New Language
- Create a new directory in
public/locales/with the language code - Copy all JSON files from
public/locales/en/to the new directory - Translate the content
- Add the language to
AVAILABLE_LANGUAGESinsrc/contexts/LocalizationContext.jsx - If the language is RTL, add it to
RTL_LANGUAGESarray
Example:
export const AVAILABLE_LANGUAGES = [
// ... existing languages
{ code: 'it', name: 'Italian', nativeName: 'Italiano' },
]
export const RTL_LANGUAGES = ['ar', 'he', 'fa', 'ur']
Translation Files
common.json
Contains general UI elements used across the application:
- Buttons (save, cancel, delete, etc.)
- Common messages
- Navigation items
settings.json
Contains all text from the Settings page:
- Section titles
- Form labels
- Help text
- Notifications
chores.json
Contains chores-related translations:
- Task management
- Status labels
- Action buttons
Contributing Translations
For Translators
-
Via Translation Platform:
- Visit our project on [Platform Name]
- Sign up and request access
- Select a language you want to contribute to
- Start translating!
-
Via GitHub (Direct):
- Fork the repository
- Create a new branch:
git checkout -b translation/language-code - Add your translations to
public/locales/{language}/ - Submit a pull request
Translation Guidelines
- Keep formatting: Preserve placeholders like
{{variable}} - Context matters: Consider the UI context when translating
- Be consistent: Use the same terminology throughout
- Character limits: Some UI elements have space constraints
- Test your translations: If possible, test in the actual application
- RTL languages: Ensure proper text direction is maintained
Testing Translations
To test translations locally:
- Add your translation files to
public/locales/{language}/ - Start the development server:
npm run dev - Change language in Settings → Localization
- Navigate through the app to verify translations
CI/CD Integration
GitHub Actions for Crowdin
Create .github/workflows/crowdin.yml:
name: Crowdin Sync
on:
push:
branches: [main]
schedule:
- cron: '0 0 * * *'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: crowdin/github-action@v1
with:
upload_sources: true
upload_translations: false
download_translations: true
create_pull_request: true
env:
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
Translation Coverage
Track translation progress:
- Use platform analytics to monitor completion
- Set up automated reports
- Create issues for missing translations
Questions?
For translation-related questions:
- Create an issue on GitHub
- Contact the maintainers
- Join our community discussions
License
All translations are subject to the same license as the main project.