Organizing translations
このコンテンツはまだ日本語訳がありません。
A layout that scales:
lang/ setup.ts createLang(), exports t, group, createUseLang, Language translations/ index.ts export const translations = { common, pages, ... } common/ index.ts export const common = { actions, errors, ... } actions.ts export const actions = group(t(...), ...) pages/ login.ts- Import
tandgroupfrom yoursetup.ts. Never callcreateLangtwice. - Put texts used in many places (
Save,Cancel) in shared groups likecommon.actions. - Group texts by screen or feature. A component reads its scope:
useLang((all) => all.pages.login). - If two texts in one group have the same base text,
group()reports a duplicate key. Give one a custom key.