Sourced from i18next-cli's changelog.
1.95.1
- fix(extract): a type read through a renaming import (
import { components as api },import type,import * as, re-exports) resolves the names inside it (Omit<components['schemas']['Foo'], 'type'>) in the file that declares it; they were looked up in the importing file, which took another file'scomponentsand extracted its keys (#330)1.95.0
From a second run of
instrumenton the dashboard of the first one, this time all seven of its packages (about 1,200 files), its texts in the code; every rewrite read:
- fix(instrument): a variable that holds JSX (
const link = <Link …>) andchildrenare never interpolated into at()value, where they showed as[object Object]; the text stops at them.- fix(instrument): the init file is generated when
i18nextshows up only in a string (a setup guide's snippet), not in an import or re-export statement; none is written at the root of a workspace withoutsrc, which no app imports from (apnpm-workspace.yamlwith settings only is no workspace).- fix(instrument): a string in a TypeScript type is never wrapped (
useState<{ title: 'Hello there' }>()), and no placeholder is named after an option oft()(count,context, …).- fix(instrument): selectors of an optional call (
el?.querySelector('h1, h2')) and everything under aclassName,classNames,classesorstyleproperty (classNames: { container: () => 'btn btn-secondary' }) stay as they are; so do strings pushed into anignorelist and a region code with acronyms (EU VAT,CA GST/HST).- feat(instrument): a component's prop is text when its name is or ends in
label,titleormessage(saveLabel), names a button's label (labelConfirm) or is thetextof a component named for text (<FieldLabel text=…>), or when its value reads as a sentence; an icon'saria-labelanddata-tipare text; so are either branch of a choice in a text attribute (data-tip={open ? 'Collapse' : 'Expand'}), a single word under a text property ({ label: 'has' }) and what a title setter gets (useDocumentTitle('Projects')).- feat(instrument): module-scope texts are translated when they are used instead of being skipped: JSX text there becomes a
<Trans>(it translates when it renders; not in a Suspensefallback), and an object property's plain text value is read by a getter (label: 'Projects'becomesget label () { return i18next.t('projects', 'Projects') }). Left, and named with their lines: constants, entries of an array of strings, values computed on every read, properties of an object passed to a module-level call or kept to a type withsatisfies, objects the file changes, and what code running at import reads, in any instrumented file (also through a function or class called at module scope). Review the getters (--dry-runmarks them): a map of data that is sent or stored must stay as it was.- fix(instrument): a property named for a format, a style or an event (
format: 'MMM D, YYYY',transition,event,font,shortcut) and a literal kept as its type ('on' as const) are no text; a one-line function component (function App () { return <h1>…</h1> }) gets itsuseTranslation()on a line of its own instead of a syntax error.- fix(instrument):
writeExtractedKeysalso writes the keys of a split text and of the words in a placeholder's value.- fix(instrument): the callback of a
.map()(or another array method) at module scope, and an IIFE, run at import: their texts no longer get ani18next.t()that returned an empty string before i18next was initialized.- feat(instrument): the words in a placeholder's value are texts of their own (
name || t('items', 'items')), and a template literal with one optional part becomes two texts (left ? t(…, 'uses AI tokens, {{left}} left') : t(…, 'uses AI tokens')) instead of English words in a placeholder.- feat(instrument): texts that only build data stay: a
mailto:body or another URL part (encodeURIComponent), a file's content (new Blob(),new File(),saveAs(),fs.writeFile(), a zip's.file(name, data)), also through variables, as forconsolecalls before.- feat(instrument): in an object of strings, the sibling phrases of a text are texts too (
{ ht: 'by human', tm: 'by translation memory' }).- feat(instrument): the run names what to look at by hand, with lines: the module-scope texts left, and the parts of a sentence (
' (via CLI)',', which needs {{name}}');--dry-runmarks getters and two-text rewrites.
... (truncated)
32a3c32
1.95.174dd9c8
changelog for 1.95.17c48c1e
changelog: #330
follow-up under Unreleased6d0961e
fix: a type read through a renaming import resolves the names inside it
in th...489d846
1.95.027bd4fd
changelog for 1.95.0dcf8414
instrument: translate module-scope texts when used, keep data texts,
fixes fr...020e3b2
1.94.33d41e4c
changelog for 1.94.34b7954f
fix: keys from a t() call with context and no count, or with count under
disa...