Sourced from i18next-cli's changelog.
1.74.4
- fix(extract): a conditional namespace argument resolves to the namespaces in its branches.
useTranslation(confirmEmail ? ['reset-email-page', 'reset-page'] : 'reset-page')filedt('form.title')underdefaultNS, sostatusreported it as absent andextractremoved the existing translations fromreset-pageandreset-email-page. The key is now extracted into the primary namespace of every branch (herereset-email-pageandreset-page), also for<Trans t={t}>. Fixes #299.1.74.3
fix(extract): dynamic keys typed by a declaration in a file without any translation call resolve again when that declaration builds on one from a file that sorts after it. In 1.74.2,
type Kind = Base | 'extra'inapi/types.tswithBasedeclared inshared/base.tsexpandedt(`kind.${kind}`)tokind.extraonly, and the same happened to interface members, function return types and functions returning an enum member declared further down the list. Such declarations are now resolved again once every file has been scanned, which also removes the file-order dependence this had before 1.74.2.feat(extract): more implicitly typed values expand to their finite set of keys. Fixes #298:
- members of an object returned by a function with an object return type:
const animal = getAnimal(); t(`animal.${animal.type}`), also throughconst { type } = getAnimal(),const kind = animal.typeorgetAnimal().type.- unions and intersections of object types (
type Animal = Duck | Doggivesanimal.typethe values of both) and generic object types (type AnimalBase<T extends AnimalType> = { type: T }used asAnimalBase<'DUCK'>, or bare, which falls back to the parameter's default or constraint).(typeof COLOR)[keyof typeof COLOR]for anas constobject or an enum.- elements of an array,
colors[i], without an annotation on the variable they are assigned to.Narrowing is not followed: after
if (color !== 'BLUE'),color.BLUEis still extracted.fix(extract): shorthand options resolve like their long form.
t('k', { ns })filed the key under the default namespace,{ defaultValue }was ignored anduseTranslation('ns', { keyPrefix })lost its prefix. Thanks to@​aaronshaffor reporting it in #291.
12ea0d4
1.74.4b8cf705
fix(extract): resolve a conditional useTranslation namespace to its
branches ...1236571
1.74.3ce6e8c2
fix(extract): resolve implicit object types, cross-file declarations and
shor...