Skip to content

Commit 401339a

Browse files
committed
Weird fix
1 parent cbf4a10 commit 401339a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

packages/i18next/src/integration.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ type I18nextIntegration = {
3939

4040
const identity = ((key: string) => key) as TFunction;
4141

42+
const defaultVariables = createStore({}, { serialize: 'ignore' });
43+
4244
export function createI18nextIntegration({
4345
instance,
4446
setup,
@@ -175,13 +177,10 @@ export function createI18nextIntegration({
175177
variables?: Record<string, Store<string>>
176178
): Store<string> {
177179
return combine(
178-
{
179-
t: $t,
180-
variables: variables
181-
? combine(variables)
182-
: createStore(null, { serialize: 'ignore' }),
183-
},
184-
({ t, variables }) => t(key, variables ?? undefined) ?? key
180+
$t,
181+
variables ? combine(variables) : defaultVariables,
182+
// @ts-expect-error lng is special variable, it should not be passed to t
183+
(t, { lng, ...vars }) => t(key, vars) ?? key
185184
);
186185
}
187186

0 commit comments

Comments
 (0)