Skip to content

Commit 3223c77

Browse files
author
Tom Lienard
authored
fix(use-i18n): add back custom translate function for namespaceTranslation (#1048)
* fix(use-i18n): add back custom translate function for namespaceTranslation * chore(deps): bump international-types to 0.3.6
1 parent 35d6ddb commit 3223c77

File tree

3 files changed

+2199
-6084
lines changed

3 files changed

+2199
-6084
lines changed

packages/use-i18n/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
"@formatjs/fast-memoize": "1.2.6",
3232
"date-fns": "2.29.3",
3333
"filesize": "10.0.5",
34-
"international-types": "0.3.5",
34+
"international-types": "0.3.6",
3535
"intl-messageformat": "10.2.0",
3636
"prop-types": "15.8.1"
3737
},
3838
"peerDependencies": {
3939
"date-fns": "2.x",
40-
"international-types": "0.3.5",
40+
"international-types": "0.3.6",
4141
"react": "18.x || 18",
4242
"react-dom": "18.x || 18"
4343
}

packages/use-i18n/src/usei18n.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,9 @@ const I18nContextProvider = ({
332332
)
333333

334334
const namespaceTranslation = useCallback(
335-
(scope: string) => (key: string, context?: ReactParamsObject<any>) =>
336-
translate(`${scope}.${key}`, context) || translate(key, context),
335+
(scope: string, t = translate) =>
336+
(key: string, context?: ReactParamsObject<any>) =>
337+
t(`${scope}.${key}`, context) || t(key, context),
337338
[translate],
338339
)
339340

0 commit comments

Comments
 (0)