Skip to content

Commit 6672c35

Browse files
delucisHiDeootrueberryless
authored
Update i18next (#3858)
Co-authored-by: HiDeoo <494699+HiDeoo@users.noreply.github.com> Co-authored-by: Felix Schneider <99918022+trueberryless@users.noreply.github.com>
1 parent 6b18976 commit 6672c35

4 files changed

Lines changed: 25 additions & 9 deletions

File tree

.changeset/proud-schools-peel.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astrojs/starlight': minor
3+
---
4+
5+
Updates `i18next`, used for Starlight’s localization APIs, from v23 to v26
6+
7+
There should not be any user-facing changes from this update

packages/starlight/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"hast-util-select": "^6.0.4",
7474
"hast-util-to-string": "^3.0.1",
7575
"hastscript": "^9.0.1",
76-
"i18next": "^23.11.5",
76+
"i18next": "^26.0.7",
7777
"js-yaml": "^4.1.1",
7878
"klona": "^2.0.6",
7979
"magic-string": "^0.30.21",

packages/starlight/utils/createTranslationSystem.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ export async function createTranslationSystem<T extends i18nSchemaOutput>(
7272

7373
const t = i18n.getFixedT(lang, I18nextNamespace) as I18nT;
7474
t.all = () => i18n.getResourceBundle(lang, I18nextNamespace) as ReturnType<I18nT['all']>;
75-
t.exists = (key, options) => i18n.exists(key, { lng: lang, ns: I18nextNamespace, ...options });
75+
// Since i18next 25.10.4 the `ExistsFunction` type has a signature including a predicate that
76+
// TS cannot preserve when composing a new function to add default options.
77+
// See: https://github.com/i18next/i18next/issues/2425
78+
t.exists = ((key, options) =>
79+
i18n.exists(key, { lng: lang, ns: I18nextNamespace, ...options })) as ExistsFunction;
7680
t.dir = (dirLang = lang) => i18n.dir(dirLang);
7781

7882
return t;

pnpm-lock.yaml

Lines changed: 12 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)