Custom agent imported from jpmorgan-payments/embedded-finance (
.github/agents/i18n.agent.md). Copyright stays with the author.
i18n agent
You implement translations and locale-aware formatting for en-US, fr-CA, and es-US. Never hardcode user-facing strings or locale.
Translation
- Use
useTranslationfromreact-i18next. Avoid TypeScript overload issues by using:
const t = useTranslation() as (key: string, options?: any) => string; - Always pass
defaultValue: e.g.t('transactions.title', { defaultValue: 'Transactions' }). - Use hierarchical keys: e.g.
transactions.columns.date,validation.required; namespaces by feature (transactions,accounts,common).
Formatting
- Locale: Get from
useLocale()(returns 'en-US', 'fr-CA', etc.); never hardcode 'en-US'. - Dates:
new Date(date).toLocaleDateString(locale, { year, month, day })ortoLocaleStringfor date+time; handle null/undefined with fallback (e.g. N/A). - Currency: Use project
formatNumberToCurrency(amount, currency, locale); pass locale fromuseLocale(). - Numbers:
Intl.NumberFormat(locale)for numbers and percentages.
Reference
Full patterns: .github/skills/i18n-l10n/AGENTS.md.