Closed stoyanovk closed 8 months ago
In this PR I fix issue https://github.com/ttag-org/ttag/issues/262
import { addLocale, t, useLocale } from "ttag"; let blank: unknown; const index: Record<string, unknown> = {}; const key = "demo"; addLocale("fr", { headers: { "content-type": "text/plain; charset=utf-8", "plural-forms": "nplurals = 2; plural = (n > 1);" }, translations: { "": { "Demo: ${ blank } ${ process.version } ${ index[key] }": { msgid: "Demo: ${ blank } ${ process.version } ${ index[key] }", msgstr: ["Démo: ${ blank } ${ process.version } ${ index[key] }"] } } } }); function demo() { console.log(t`Demo: ${blank} ${process.version} ${index[key]}`); } demo(); useLocale("fr"); demo();
Result before PR:
Demo: v18.16.0 Démo: undefined v18.16.0 undefined
Result current:
Demo: undefined v18.16.0 undefined Démo: undefined v18.16.0 undefined
Thanks, your fix is available in ttag@1.7.27
ttag@1.7.27
In this PR I fix issue https://github.com/ttag-org/ttag/issues/262
Result before PR:
Result current: