@koine/next 2.0.0-beta.34 → 2.0.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/12/T.d.ts +1 -1
- package/12/createUseT.d.ts +6 -0
- package/12/createUseT.js +18 -0
- package/12/index.d.ts +1 -0
- package/12/index.js +1 -0
- package/package.json +8 -5
package/12/T.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export type TProps<TNamespace extends TranslateNamespace | undefined = undefined
|
|
|
7
7
|
ns: TNamespace;
|
|
8
8
|
i18nKey: TranslationsPaths<TNamespace>;
|
|
9
9
|
});
|
|
10
|
-
export declare const T: <TNamespace extends
|
|
10
|
+
export declare const T: <TNamespace extends TranslateNamespace | undefined = undefined>(props: TProps<TNamespace>) => import("react").ReactElement<TProps<TNamespace>, string | import("react").JSXElementConstructor<any>>;
|
|
11
11
|
export default T;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Translate } from "next-translate";
|
|
2
|
+
import type { TranslateNamespace, TranslationAtPathFromNamespace, TranslationOptions, TranslationQuery, TranslationsDictionary, TranslationsPaths } from "@koine/i18n";
|
|
3
|
+
export declare const createUseT: (useNextTranslateTranslation: () => {
|
|
4
|
+
t: Translate;
|
|
5
|
+
}) => <TNamespace extends TranslateNamespace>(namespace: TNamespace) => <TPath extends TranslationsPaths<TranslationsDictionary[TNamespace]>, TReturn = TranslationAtPathFromNamespace<TNamespace, TPath>>(s: TPath, q?: TranslationQuery, o?: TranslationOptions) => TReturn;
|
|
6
|
+
export default createUseT;
|
package/12/createUseT.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
export var createUseT = function (useNextTranslateTranslation) {
|
|
4
|
+
return function (namespace) {
|
|
5
|
+
var t = useNextTranslateTranslation().t;
|
|
6
|
+
var tMemoized = useMemo(function () {
|
|
7
|
+
return function (s, q, o) {
|
|
8
|
+
return t(namespace ? "".concat(namespace, ":").concat(s) : "".concat(s), q === "obj" || q === "" ? null : q, q === "obj" || o === "obj"
|
|
9
|
+
? { returnObjects: true }
|
|
10
|
+
: q === "" || o === ""
|
|
11
|
+
? { fallback: "" }
|
|
12
|
+
: o);
|
|
13
|
+
};
|
|
14
|
+
}, [t, namespace]);
|
|
15
|
+
return tMemoized;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default createUseT;
|
package/12/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AnalyticsGoogle, type AnalyticsGoogleProps } from "./AnalyticsGoogle.js";
|
|
2
2
|
export { DisableErrorOverlay } from "./DisableErrorOverlay.js";
|
|
3
3
|
export { createUseLocale } from "./createUseLocale.js";
|
|
4
|
+
export { createUseT } from "./createUseT.js";
|
|
4
5
|
export { createUseTo } from "./createUseTo.js";
|
|
5
6
|
export * from "./types.js";
|
package/12/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AnalyticsGoogle } from "./AnalyticsGoogle.js";
|
|
2
2
|
export { DisableErrorOverlay } from "./DisableErrorOverlay.js";
|
|
3
3
|
export { createUseLocale } from "./createUseLocale.js";
|
|
4
|
+
export { createUseT } from "./createUseT.js";
|
|
4
5
|
export { createUseTo } from "./createUseTo.js";
|
|
5
6
|
export * from "./types.js";
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "@koine/next",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@koine/browser": "2.0.0-beta.
|
|
6
|
-
"@koine/react": "2.0.0-beta.
|
|
7
|
-
"@koine/utils": "2.0.0-beta.
|
|
8
|
-
"@koine/i18n": "2.0.0-beta.
|
|
5
|
+
"@koine/browser": "2.0.0-beta.36",
|
|
6
|
+
"@koine/react": "2.0.0-beta.36",
|
|
7
|
+
"@koine/utils": "2.0.0-beta.36",
|
|
8
|
+
"@koine/i18n": "2.0.0-beta.36"
|
|
9
9
|
},
|
|
10
10
|
"peerDependenciesMeta": {
|
|
11
11
|
"@kuus/yup": {
|
|
@@ -81,6 +81,9 @@
|
|
|
81
81
|
"./12/createUseLocale": {
|
|
82
82
|
"import": "./12/createUseLocale.js"
|
|
83
83
|
},
|
|
84
|
+
"./12/createUseT": {
|
|
85
|
+
"import": "./12/createUseT.js"
|
|
86
|
+
},
|
|
84
87
|
"./12/createUseTo": {
|
|
85
88
|
"import": "./12/createUseTo.js"
|
|
86
89
|
},
|
|
@@ -149,5 +152,5 @@
|
|
|
149
152
|
"next-seo": "^6.4.0",
|
|
150
153
|
"date-fns": "^3.2.0"
|
|
151
154
|
},
|
|
152
|
-
"version": "2.0.0-beta.
|
|
155
|
+
"version": "2.0.0-beta.36"
|
|
153
156
|
}
|