Instruction file imported from radzionc/increaser (
.cursor/rules/i18n-workflow.mdc). Copyright stays with the author.
description: USE useTranslation FOR all user-facing text IN .tsx and .ts files TO ensure internationalization globs: .ts,.tsx alwaysApply: false
Internationalization (i18n) Workflow
Context
- All user-facing text must be internationalized using the react-i18next system
- Never hardcode text strings directly in components
- During development, add translations only to the English file (en.ts)
- Other language files are automatically updated via script before PR submission
Development Workflow
1. Always Use useTranslation Hook
❌ NEVER hardcode text:
<Text>Lock Time</Text>
<Button>Save Changes</Button>
✅ ALWAYS use useTranslation:
import { useTranslation } from 'react-i18next'
export const MyComponent = () => {
const { t } = useTranslation()
return (
<>
<Text>{t('lock_time')}</Text>
<Button>{t('save_changes')}</Button>
</>
)
}
2. Add Translations to en.ts Only
During development, add new translation keys only to en.ts:
export const en = {
// ... existing translations ...
new_feature_title: 'New Feature Title',
new_feature_description: 'Description of the new feature',
}
Note: Other language files (de.ts, es.ts, it.ts, pt.ts, hr.ts, zh.ts) are updated automatically via script before PR submission. You do not need to update them manually during development.
3. Translation Key Naming
- Use snake_case for translation keys
- Use descriptive, hierarchical names
- Group related translations together
- Example:
vault_settings_backup_title,error_network_connection_failed
4. Pluralization
Use i18next's built-in pluralization:
❌ NEVER do manual pluralization:
{
count === 1 ? t('minute') : t('minutes')
}
✅ ALWAYS use i18next pluralization:
{
t('minute', { count })
}
With translation keys in en.ts:
minute_one: '{{count}} minute',
minute_other: '{{count}} minutes',
Requirements
- Every user-facing string must use
useTranslationhook - Add translations to en.ts only during development
- No exceptions for "temporary" text or placeholders
- Use proper pluralization for count-dependent text