@koine/i18n 2.0.0-beta.115 → 2.0.0-beta.116
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/api.cjs.js +50 -50
- package/api.esm.js +50 -50
- package/package.json +3 -3
- /package/adapter-react/code/{T.d.ts → Trans.d.ts} +0 -0
package/api.cjs.js
CHANGED
|
@@ -943,10 +943,10 @@ let c$3 = (e, a)=>!utils.isArray(a) && utils.isObject(a) && hasPlurals(a) ? hasO
|
|
|
943
943
|
o += "{";
|
|
944
944
|
let t = transformKeysForPlurals(Object.keys(e));
|
|
945
945
|
for(let a = 0; a < t.length; a++){
|
|
946
|
-
let
|
|
946
|
+
let n = t[a], // fallback to a string otherwise plurals without root definition would
|
|
947
947
|
// not get a type otherwise, e.g. ` pluralNoDefault_...` in __mocks__
|
|
948
|
-
|
|
949
|
-
o += c$3(
|
|
948
|
+
s = e[n] || "";
|
|
949
|
+
o += c$3(n, s);
|
|
950
950
|
}
|
|
951
951
|
o += "};";
|
|
952
952
|
}
|
|
@@ -954,10 +954,10 @@ let c$3 = (e, a)=>!utils.isArray(a) && utils.isObject(a) && hasPlurals(a) ? hasO
|
|
|
954
954
|
return(// adjust syntax
|
|
955
955
|
(o = o.replace(/;\[\];/g, "[];")).replace(/;+/g, ";"));
|
|
956
956
|
}, u$2 = (e, t)=>{
|
|
957
|
-
let { translationFiles: a } = t, { defaultLocale:
|
|
958
|
-
for(let e = 0; e <
|
|
959
|
-
let { path: t, data: a } =
|
|
960
|
-
o.push(`"${
|
|
957
|
+
let { translationFiles: a } = t, { defaultLocale: n } = e, s = a.filter((e)=>e.locale === n), o = [];
|
|
958
|
+
for(let e = 0; e < s.length; e++){
|
|
959
|
+
let { path: t, data: a } = s[e], n = t.replace(".json", "");
|
|
960
|
+
o.push(`"${n}": ${d$4(a)}`);
|
|
961
961
|
}
|
|
962
962
|
return o.sort();
|
|
963
963
|
}, h$2 = (t)=>{
|
|
@@ -966,37 +966,37 @@ let c$3 = (e, a)=>!utils.isArray(a) && utils.isObject(a) && hasPlurals(a) ? hasO
|
|
|
966
966
|
t && a.push(`"${e}": { ${dataParamsToTsInterfaceBody(t)} };`);
|
|
967
967
|
}), a;
|
|
968
968
|
}, y$1 = (e)=>e.sort().map((e)=>`"${e}"`).join(" | "), T$1 = (e, t)=>y$1(Object.keys(e.byId).filter((a)=>t(a, e.byId[a]))), m$5 = (e)=>Object.keys(e.byId).reduce((t, a)=>{
|
|
969
|
-
if (e.byId[a].inWildcard) for(let
|
|
970
|
-
let
|
|
971
|
-
a.startsWith(
|
|
969
|
+
if (e.byId[a].inWildcard) for(let n = 0; n < e.wildcardIds.length; n++){
|
|
970
|
+
let s = e.wildcardIds[n];
|
|
971
|
+
a.startsWith(s) && (t[s] = t[s] || [], t[s].push(a));
|
|
972
972
|
}
|
|
973
973
|
return t;
|
|
974
974
|
}, {}), f$3 = (e, t, a)=>{
|
|
975
|
-
let
|
|
976
|
-
for(let o in
|
|
977
|
-
let r =
|
|
975
|
+
let n = m$5(t), s = [];
|
|
976
|
+
for(let o in n){
|
|
977
|
+
let r = n[o].map(// remove the root id portion and the first character which is always
|
|
978
978
|
// the route `idDelimiter`
|
|
979
979
|
(e)=>e.split(o)[1].slice(1)), i = t.byId[o].pathnames[e.defaultLocale], l = [];
|
|
980
|
-
for(let
|
|
981
|
-
let
|
|
982
|
-
l.push(`"${
|
|
980
|
+
for(let n = 0; n < r.length; n++){
|
|
981
|
+
let s = r[n], p = `${o}${a.routes.tokens.idDelimiter}${s}`, c = t.byId[p].pathnames[e.defaultLocale].split(i)[1];
|
|
982
|
+
l.push(`"${s}": "${c}";`);
|
|
983
983
|
}
|
|
984
|
-
|
|
984
|
+
s.push(`"${o}": { ${l.join(" ")} }`);
|
|
985
985
|
}
|
|
986
|
-
return
|
|
986
|
+
return s;
|
|
987
987
|
}, g$2 = (e, t)=>{
|
|
988
988
|
let a = [];
|
|
989
|
-
for(let
|
|
990
|
-
let
|
|
991
|
-
a.push(`"${
|
|
989
|
+
for(let n in t.byId){
|
|
990
|
+
let s = t.byId[n];
|
|
991
|
+
a.push(`"${s.id}": "${s.pathnames[e.defaultLocale]}";`);
|
|
992
992
|
}
|
|
993
993
|
return a;
|
|
994
994
|
};
|
|
995
995
|
// TODO: maybe move the Translate types into the various adapters unless we
|
|
996
996
|
// will use the same api for all of them
|
|
997
|
-
var h$3 = (({ config: e, input: t, routes: a, options:
|
|
998
|
-
let
|
|
999
|
-
{ idDelimiter: r } =
|
|
997
|
+
var h$3 = (({ config: e, input: t, routes: a, options: n })=>{
|
|
998
|
+
let s = T$1(a, (e, { params: t })=>!t), o = T$1(a, (e, { params: t })=>!!t), // const routeIdSpa = buildRoutesUnion(routes, (_, { inWildcard }) => inWildcard);
|
|
999
|
+
{ idDelimiter: r } = n.routes.tokens;
|
|
1000
1000
|
return `
|
|
1001
1001
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
1002
1002
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -1026,7 +1026,7 @@ export namespace I18n {
|
|
|
1026
1026
|
/**
|
|
1027
1027
|
* The static routes available ids
|
|
1028
1028
|
*/
|
|
1029
|
-
export type RouteIdStatic = ${
|
|
1029
|
+
export type RouteIdStatic = ${s};
|
|
1030
1030
|
|
|
1031
1031
|
/**
|
|
1032
1032
|
* The dynamic routes available ids
|
|
@@ -1037,7 +1037,7 @@ export namespace I18n {
|
|
|
1037
1037
|
* Map every SPA path divided by their roots to their actual pathname value for the default locale
|
|
1038
1038
|
*/
|
|
1039
1039
|
export type RouteSpa = {
|
|
1040
|
-
${f$3(e, a,
|
|
1040
|
+
${f$3(e, a, n).join("\n ")}
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
1043
|
/**
|
|
@@ -1295,14 +1295,14 @@ export namespace I18n {
|
|
|
1295
1295
|
* such as \`/[lang]/my-route/page.tsx\`.
|
|
1296
1296
|
*/
|
|
1297
1297
|
export type Params = {
|
|
1298
|
-
${
|
|
1298
|
+
${n.routes.localeParamName}: Locale;
|
|
1299
1299
|
};
|
|
1300
1300
|
|
|
1301
1301
|
/**
|
|
1302
1302
|
* Props available to each page/layout when a root \`localeParam\` is in place (e.g.
|
|
1303
1303
|
* in the typical _next.js_ folder structure \`/[lang]/my-route/page.tsx\`).
|
|
1304
1304
|
*/
|
|
1305
|
-
export type Props<
|
|
1305
|
+
export type Props<P = {}> = P & {
|
|
1306
1306
|
params: Params;
|
|
1307
1307
|
};
|
|
1308
1308
|
|
|
@@ -1514,33 +1514,33 @@ export default I18nProvider;
|
|
|
1514
1514
|
var m$4 = (({})=>`
|
|
1515
1515
|
"use client";
|
|
1516
1516
|
|
|
1517
|
-
import type { TransProps } from "next-translate";
|
|
1518
|
-
import
|
|
1517
|
+
import type { TransProps as NextTranslateTransProps } from "next-translate";
|
|
1518
|
+
import NextTranslateTrans from "next-translate/Trans";
|
|
1519
1519
|
import type { I18n } from "./types";
|
|
1520
1520
|
|
|
1521
|
-
export type
|
|
1521
|
+
export type TransProps<
|
|
1522
1522
|
TNamespace extends I18n.TranslateNamespace | undefined = undefined,
|
|
1523
1523
|
> =
|
|
1524
|
-
| (Omit<
|
|
1524
|
+
| (Omit<NextTranslateTransProps, "i18nKey" | "ns"> & {
|
|
1525
1525
|
i18nKey: I18n.TranslationsAllPaths;
|
|
1526
1526
|
})
|
|
1527
|
-
| (Omit<
|
|
1527
|
+
| (Omit<NextTranslateTransProps, "i18nKey" | "ns"> & {
|
|
1528
1528
|
ns: TNamespace;
|
|
1529
1529
|
i18nKey: I18n.TranslationsPaths<TNamespace>;
|
|
1530
1530
|
});
|
|
1531
1531
|
|
|
1532
|
-
const
|
|
1532
|
+
const TypedTrans = <
|
|
1533
1533
|
TNamespace extends I18n.TranslateNamespace | undefined = undefined,
|
|
1534
1534
|
>(
|
|
1535
|
-
props:
|
|
1535
|
+
props: TransProps<TNamespace>,
|
|
1536
1536
|
) =>
|
|
1537
|
-
(<
|
|
1538
|
-
|
|
1537
|
+
(<NextTranslateTrans {...(props as NextTranslateTransProps)} />) as React.ReactElement<
|
|
1538
|
+
TransProps<TNamespace>
|
|
1539
1539
|
>;
|
|
1540
1540
|
|
|
1541
|
-
export const
|
|
1541
|
+
export const Trans = NextTranslateTrans as typeof TypedTrans;
|
|
1542
1542
|
|
|
1543
|
-
export default
|
|
1543
|
+
export default Trans;
|
|
1544
1544
|
`);
|
|
1545
1545
|
|
|
1546
1546
|
var o$7 = (({})=>`
|
|
@@ -2967,7 +2967,7 @@ export const I18nRouteContext = createContext<I18nRouteContextValue>([
|
|
|
2967
2967
|
// export default I18nRouteContext;
|
|
2968
2968
|
`);
|
|
2969
2969
|
|
|
2970
|
-
var
|
|
2970
|
+
var s$3 = (({})=>`
|
|
2971
2971
|
"use client";
|
|
2972
2972
|
|
|
2973
2973
|
import { useMemo, useState } from "react";
|
|
@@ -3001,7 +3001,7 @@ export function I18nRouteProvider(props: I18nRouteProviderProps) {
|
|
|
3001
3001
|
// export default I18nRouteProvider;
|
|
3002
3002
|
`);
|
|
3003
3003
|
|
|
3004
|
-
var
|
|
3004
|
+
var i$3 = (({})=>`
|
|
3005
3005
|
"use client";
|
|
3006
3006
|
|
|
3007
3007
|
import { useContext, useEffect } from "react";
|
|
@@ -3109,7 +3109,7 @@ import { formatElements } from "./formatElements";
|
|
|
3109
3109
|
import type { I18n } from "./types";
|
|
3110
3110
|
import { useT } from "./useT";
|
|
3111
3111
|
|
|
3112
|
-
export type
|
|
3112
|
+
export type TransProps = {
|
|
3113
3113
|
i18nKey: I18n.TranslationsAllPaths;
|
|
3114
3114
|
components?: React.ReactElement[] | Record<string, React.ReactElement>;
|
|
3115
3115
|
values?: I18n.TranslationQuery;
|
|
@@ -3121,12 +3121,12 @@ export type TProps = {
|
|
|
3121
3121
|
* <0>This is an <1>example</1><0>
|
|
3122
3122
|
* to -> <h1>This is an <b>example</b><h1>
|
|
3123
3123
|
*/
|
|
3124
|
-
export const
|
|
3124
|
+
export const Trans = ({
|
|
3125
3125
|
i18nKey,
|
|
3126
3126
|
values,
|
|
3127
3127
|
components,
|
|
3128
3128
|
returnObjects,
|
|
3129
|
-
}:
|
|
3129
|
+
}: TransProps) => {
|
|
3130
3130
|
const [namespace, path] = (i18nKey as string).split(":");
|
|
3131
3131
|
const t = useT(namespace as I18n.TranslateNamespace) as I18n.TranslateLoose;
|
|
3132
3132
|
const result = useMemo(() => {
|
|
@@ -3148,17 +3148,17 @@ export const T = ({
|
|
|
3148
3148
|
return result;
|
|
3149
3149
|
};
|
|
3150
3150
|
|
|
3151
|
-
export default
|
|
3151
|
+
export default Trans;
|
|
3152
3152
|
`);
|
|
3153
3153
|
|
|
3154
3154
|
var T = (({})=>`
|
|
3155
3155
|
"use client";
|
|
3156
3156
|
|
|
3157
3157
|
import { useMemo } from "react";
|
|
3158
|
-
import type {
|
|
3158
|
+
import type { TransProps } from "./Trans";
|
|
3159
3159
|
import { formatElements } from "./formatElements";
|
|
3160
3160
|
|
|
3161
|
-
export type TransTextProps = Pick<
|
|
3161
|
+
export type TransTextProps = Pick<TransProps, "components"> & {
|
|
3162
3162
|
text: string;
|
|
3163
3163
|
};
|
|
3164
3164
|
|
|
@@ -3464,12 +3464,12 @@ var r$1 = createAdapter(adapterReactOptions, ({})=>({
|
|
|
3464
3464
|
},
|
|
3465
3465
|
{
|
|
3466
3466
|
name: "I18nRouteProvider",
|
|
3467
|
-
fn:
|
|
3467
|
+
fn: s$3,
|
|
3468
3468
|
ext: "tsx"
|
|
3469
3469
|
},
|
|
3470
3470
|
{
|
|
3471
3471
|
name: "I18nRouteSetter",
|
|
3472
|
-
fn:
|
|
3472
|
+
fn: i$3,
|
|
3473
3473
|
ext: "tsx"
|
|
3474
3474
|
},
|
|
3475
3475
|
{
|
|
@@ -3484,7 +3484,7 @@ var r$1 = createAdapter(adapterReactOptions, ({})=>({
|
|
|
3484
3484
|
index: !0
|
|
3485
3485
|
},
|
|
3486
3486
|
{
|
|
3487
|
-
name: "
|
|
3487
|
+
name: "Trans",
|
|
3488
3488
|
fn: I$1,
|
|
3489
3489
|
ext: "tsx",
|
|
3490
3490
|
index: !0
|
package/api.esm.js
CHANGED
|
@@ -922,10 +922,10 @@ let c$3 = (e, a)=>!isArray(a) && isObject(a) && hasPlurals(a) ? hasOnlyPluralKey
|
|
|
922
922
|
o += "{";
|
|
923
923
|
let t = transformKeysForPlurals(Object.keys(e));
|
|
924
924
|
for(let a = 0; a < t.length; a++){
|
|
925
|
-
let
|
|
925
|
+
let n = t[a], // fallback to a string otherwise plurals without root definition would
|
|
926
926
|
// not get a type otherwise, e.g. ` pluralNoDefault_...` in __mocks__
|
|
927
|
-
|
|
928
|
-
o += c$3(
|
|
927
|
+
s = e[n] || "";
|
|
928
|
+
o += c$3(n, s);
|
|
929
929
|
}
|
|
930
930
|
o += "};";
|
|
931
931
|
}
|
|
@@ -933,10 +933,10 @@ let c$3 = (e, a)=>!isArray(a) && isObject(a) && hasPlurals(a) ? hasOnlyPluralKey
|
|
|
933
933
|
return(// adjust syntax
|
|
934
934
|
(o = o.replace(/;\[\];/g, "[];")).replace(/;+/g, ";"));
|
|
935
935
|
}, u$2 = (e, t)=>{
|
|
936
|
-
let { translationFiles: a } = t, { defaultLocale:
|
|
937
|
-
for(let e = 0; e <
|
|
938
|
-
let { path: t, data: a } =
|
|
939
|
-
o.push(`"${
|
|
936
|
+
let { translationFiles: a } = t, { defaultLocale: n } = e, s = a.filter((e)=>e.locale === n), o = [];
|
|
937
|
+
for(let e = 0; e < s.length; e++){
|
|
938
|
+
let { path: t, data: a } = s[e], n = t.replace(".json", "");
|
|
939
|
+
o.push(`"${n}": ${d$4(a)}`);
|
|
940
940
|
}
|
|
941
941
|
return o.sort();
|
|
942
942
|
}, h$2 = (t)=>{
|
|
@@ -945,37 +945,37 @@ let c$3 = (e, a)=>!isArray(a) && isObject(a) && hasPlurals(a) ? hasOnlyPluralKey
|
|
|
945
945
|
t && a.push(`"${e}": { ${dataParamsToTsInterfaceBody(t)} };`);
|
|
946
946
|
}), a;
|
|
947
947
|
}, y$1 = (e)=>e.sort().map((e)=>`"${e}"`).join(" | "), T$1 = (e, t)=>y$1(Object.keys(e.byId).filter((a)=>t(a, e.byId[a]))), m$5 = (e)=>Object.keys(e.byId).reduce((t, a)=>{
|
|
948
|
-
if (e.byId[a].inWildcard) for(let
|
|
949
|
-
let
|
|
950
|
-
a.startsWith(
|
|
948
|
+
if (e.byId[a].inWildcard) for(let n = 0; n < e.wildcardIds.length; n++){
|
|
949
|
+
let s = e.wildcardIds[n];
|
|
950
|
+
a.startsWith(s) && (t[s] = t[s] || [], t[s].push(a));
|
|
951
951
|
}
|
|
952
952
|
return t;
|
|
953
953
|
}, {}), f$3 = (e, t, a)=>{
|
|
954
|
-
let
|
|
955
|
-
for(let o in
|
|
956
|
-
let r =
|
|
954
|
+
let n = m$5(t), s = [];
|
|
955
|
+
for(let o in n){
|
|
956
|
+
let r = n[o].map(// remove the root id portion and the first character which is always
|
|
957
957
|
// the route `idDelimiter`
|
|
958
958
|
(e)=>e.split(o)[1].slice(1)), i = t.byId[o].pathnames[e.defaultLocale], l = [];
|
|
959
|
-
for(let
|
|
960
|
-
let
|
|
961
|
-
l.push(`"${
|
|
959
|
+
for(let n = 0; n < r.length; n++){
|
|
960
|
+
let s = r[n], p = `${o}${a.routes.tokens.idDelimiter}${s}`, c = t.byId[p].pathnames[e.defaultLocale].split(i)[1];
|
|
961
|
+
l.push(`"${s}": "${c}";`);
|
|
962
962
|
}
|
|
963
|
-
|
|
963
|
+
s.push(`"${o}": { ${l.join(" ")} }`);
|
|
964
964
|
}
|
|
965
|
-
return
|
|
965
|
+
return s;
|
|
966
966
|
}, g$2 = (e, t)=>{
|
|
967
967
|
let a = [];
|
|
968
|
-
for(let
|
|
969
|
-
let
|
|
970
|
-
a.push(`"${
|
|
968
|
+
for(let n in t.byId){
|
|
969
|
+
let s = t.byId[n];
|
|
970
|
+
a.push(`"${s.id}": "${s.pathnames[e.defaultLocale]}";`);
|
|
971
971
|
}
|
|
972
972
|
return a;
|
|
973
973
|
};
|
|
974
974
|
// TODO: maybe move the Translate types into the various adapters unless we
|
|
975
975
|
// will use the same api for all of them
|
|
976
|
-
var h$3 = (({ config: e, input: t, routes: a, options:
|
|
977
|
-
let
|
|
978
|
-
{ idDelimiter: r } =
|
|
976
|
+
var h$3 = (({ config: e, input: t, routes: a, options: n })=>{
|
|
977
|
+
let s = T$1(a, (e, { params: t })=>!t), o = T$1(a, (e, { params: t })=>!!t), // const routeIdSpa = buildRoutesUnion(routes, (_, { inWildcard }) => inWildcard);
|
|
978
|
+
{ idDelimiter: r } = n.routes.tokens;
|
|
979
979
|
return `
|
|
980
980
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
981
981
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
@@ -1005,7 +1005,7 @@ export namespace I18n {
|
|
|
1005
1005
|
/**
|
|
1006
1006
|
* The static routes available ids
|
|
1007
1007
|
*/
|
|
1008
|
-
export type RouteIdStatic = ${
|
|
1008
|
+
export type RouteIdStatic = ${s};
|
|
1009
1009
|
|
|
1010
1010
|
/**
|
|
1011
1011
|
* The dynamic routes available ids
|
|
@@ -1016,7 +1016,7 @@ export namespace I18n {
|
|
|
1016
1016
|
* Map every SPA path divided by their roots to their actual pathname value for the default locale
|
|
1017
1017
|
*/
|
|
1018
1018
|
export type RouteSpa = {
|
|
1019
|
-
${f$3(e, a,
|
|
1019
|
+
${f$3(e, a, n).join("\n ")}
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
1022
|
/**
|
|
@@ -1274,14 +1274,14 @@ export namespace I18n {
|
|
|
1274
1274
|
* such as \`/[lang]/my-route/page.tsx\`.
|
|
1275
1275
|
*/
|
|
1276
1276
|
export type Params = {
|
|
1277
|
-
${
|
|
1277
|
+
${n.routes.localeParamName}: Locale;
|
|
1278
1278
|
};
|
|
1279
1279
|
|
|
1280
1280
|
/**
|
|
1281
1281
|
* Props available to each page/layout when a root \`localeParam\` is in place (e.g.
|
|
1282
1282
|
* in the typical _next.js_ folder structure \`/[lang]/my-route/page.tsx\`).
|
|
1283
1283
|
*/
|
|
1284
|
-
export type Props<
|
|
1284
|
+
export type Props<P = {}> = P & {
|
|
1285
1285
|
params: Params;
|
|
1286
1286
|
};
|
|
1287
1287
|
|
|
@@ -1493,33 +1493,33 @@ export default I18nProvider;
|
|
|
1493
1493
|
var m$4 = (({})=>`
|
|
1494
1494
|
"use client";
|
|
1495
1495
|
|
|
1496
|
-
import type { TransProps } from "next-translate";
|
|
1497
|
-
import
|
|
1496
|
+
import type { TransProps as NextTranslateTransProps } from "next-translate";
|
|
1497
|
+
import NextTranslateTrans from "next-translate/Trans";
|
|
1498
1498
|
import type { I18n } from "./types";
|
|
1499
1499
|
|
|
1500
|
-
export type
|
|
1500
|
+
export type TransProps<
|
|
1501
1501
|
TNamespace extends I18n.TranslateNamespace | undefined = undefined,
|
|
1502
1502
|
> =
|
|
1503
|
-
| (Omit<
|
|
1503
|
+
| (Omit<NextTranslateTransProps, "i18nKey" | "ns"> & {
|
|
1504
1504
|
i18nKey: I18n.TranslationsAllPaths;
|
|
1505
1505
|
})
|
|
1506
|
-
| (Omit<
|
|
1506
|
+
| (Omit<NextTranslateTransProps, "i18nKey" | "ns"> & {
|
|
1507
1507
|
ns: TNamespace;
|
|
1508
1508
|
i18nKey: I18n.TranslationsPaths<TNamespace>;
|
|
1509
1509
|
});
|
|
1510
1510
|
|
|
1511
|
-
const
|
|
1511
|
+
const TypedTrans = <
|
|
1512
1512
|
TNamespace extends I18n.TranslateNamespace | undefined = undefined,
|
|
1513
1513
|
>(
|
|
1514
|
-
props:
|
|
1514
|
+
props: TransProps<TNamespace>,
|
|
1515
1515
|
) =>
|
|
1516
|
-
(<
|
|
1517
|
-
|
|
1516
|
+
(<NextTranslateTrans {...(props as NextTranslateTransProps)} />) as React.ReactElement<
|
|
1517
|
+
TransProps<TNamespace>
|
|
1518
1518
|
>;
|
|
1519
1519
|
|
|
1520
|
-
export const
|
|
1520
|
+
export const Trans = NextTranslateTrans as typeof TypedTrans;
|
|
1521
1521
|
|
|
1522
|
-
export default
|
|
1522
|
+
export default Trans;
|
|
1523
1523
|
`);
|
|
1524
1524
|
|
|
1525
1525
|
var o$7 = (({})=>`
|
|
@@ -2946,7 +2946,7 @@ export const I18nRouteContext = createContext<I18nRouteContextValue>([
|
|
|
2946
2946
|
// export default I18nRouteContext;
|
|
2947
2947
|
`);
|
|
2948
2948
|
|
|
2949
|
-
var
|
|
2949
|
+
var s$3 = (({})=>`
|
|
2950
2950
|
"use client";
|
|
2951
2951
|
|
|
2952
2952
|
import { useMemo, useState } from "react";
|
|
@@ -2980,7 +2980,7 @@ export function I18nRouteProvider(props: I18nRouteProviderProps) {
|
|
|
2980
2980
|
// export default I18nRouteProvider;
|
|
2981
2981
|
`);
|
|
2982
2982
|
|
|
2983
|
-
var
|
|
2983
|
+
var i$3 = (({})=>`
|
|
2984
2984
|
"use client";
|
|
2985
2985
|
|
|
2986
2986
|
import { useContext, useEffect } from "react";
|
|
@@ -3088,7 +3088,7 @@ import { formatElements } from "./formatElements";
|
|
|
3088
3088
|
import type { I18n } from "./types";
|
|
3089
3089
|
import { useT } from "./useT";
|
|
3090
3090
|
|
|
3091
|
-
export type
|
|
3091
|
+
export type TransProps = {
|
|
3092
3092
|
i18nKey: I18n.TranslationsAllPaths;
|
|
3093
3093
|
components?: React.ReactElement[] | Record<string, React.ReactElement>;
|
|
3094
3094
|
values?: I18n.TranslationQuery;
|
|
@@ -3100,12 +3100,12 @@ export type TProps = {
|
|
|
3100
3100
|
* <0>This is an <1>example</1><0>
|
|
3101
3101
|
* to -> <h1>This is an <b>example</b><h1>
|
|
3102
3102
|
*/
|
|
3103
|
-
export const
|
|
3103
|
+
export const Trans = ({
|
|
3104
3104
|
i18nKey,
|
|
3105
3105
|
values,
|
|
3106
3106
|
components,
|
|
3107
3107
|
returnObjects,
|
|
3108
|
-
}:
|
|
3108
|
+
}: TransProps) => {
|
|
3109
3109
|
const [namespace, path] = (i18nKey as string).split(":");
|
|
3110
3110
|
const t = useT(namespace as I18n.TranslateNamespace) as I18n.TranslateLoose;
|
|
3111
3111
|
const result = useMemo(() => {
|
|
@@ -3127,17 +3127,17 @@ export const T = ({
|
|
|
3127
3127
|
return result;
|
|
3128
3128
|
};
|
|
3129
3129
|
|
|
3130
|
-
export default
|
|
3130
|
+
export default Trans;
|
|
3131
3131
|
`);
|
|
3132
3132
|
|
|
3133
3133
|
var T = (({})=>`
|
|
3134
3134
|
"use client";
|
|
3135
3135
|
|
|
3136
3136
|
import { useMemo } from "react";
|
|
3137
|
-
import type {
|
|
3137
|
+
import type { TransProps } from "./Trans";
|
|
3138
3138
|
import { formatElements } from "./formatElements";
|
|
3139
3139
|
|
|
3140
|
-
export type TransTextProps = Pick<
|
|
3140
|
+
export type TransTextProps = Pick<TransProps, "components"> & {
|
|
3141
3141
|
text: string;
|
|
3142
3142
|
};
|
|
3143
3143
|
|
|
@@ -3443,12 +3443,12 @@ var r$1 = createAdapter(adapterReactOptions, ({})=>({
|
|
|
3443
3443
|
},
|
|
3444
3444
|
{
|
|
3445
3445
|
name: "I18nRouteProvider",
|
|
3446
|
-
fn:
|
|
3446
|
+
fn: s$3,
|
|
3447
3447
|
ext: "tsx"
|
|
3448
3448
|
},
|
|
3449
3449
|
{
|
|
3450
3450
|
name: "I18nRouteSetter",
|
|
3451
|
-
fn:
|
|
3451
|
+
fn: i$3,
|
|
3452
3452
|
ext: "tsx"
|
|
3453
3453
|
},
|
|
3454
3454
|
{
|
|
@@ -3463,7 +3463,7 @@ var r$1 = createAdapter(adapterReactOptions, ({})=>({
|
|
|
3463
3463
|
index: !0
|
|
3464
3464
|
},
|
|
3465
3465
|
{
|
|
3466
|
-
name: "
|
|
3466
|
+
name: "Trans",
|
|
3467
3467
|
fn: I$1,
|
|
3468
3468
|
ext: "tsx",
|
|
3469
3469
|
index: !0
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@koine/i18n",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@koine/node": "2.0.0-beta.
|
|
6
|
-
"@koine/utils": "2.0.0-beta.
|
|
5
|
+
"@koine/node": "2.0.0-beta.116",
|
|
6
|
+
"@koine/utils": "2.0.0-beta.116",
|
|
7
7
|
"glob": "^10.3.10",
|
|
8
8
|
"webpack": "^5.90.1",
|
|
9
9
|
"minimatch": "^9.0.3",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
},
|
|
59
59
|
"module": "./index.esm.js",
|
|
60
60
|
"main": "./index.cjs.js",
|
|
61
|
-
"version": "2.0.0-beta.
|
|
61
|
+
"version": "2.0.0-beta.116"
|
|
62
62
|
}
|
|
File without changes
|