@koine/i18n 2.0.0-beta.100
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/README.md +1 -0
- package/adapter-js/code/config.cjs.d.ts +3 -0
- package/adapter-js/code/config.d.ts +3 -0
- package/adapter-js/code/createT.d.ts +3 -0
- package/adapter-js/code/defaultI18nMetadata.d.ts +3 -0
- package/adapter-js/code/defaultLocale.d.ts +3 -0
- package/adapter-js/code/formatUrl.d.ts +3 -0
- package/adapter-js/code/getI18nAlternatesFromDom.d.ts +3 -0
- package/adapter-js/code/getI18nDictionaries.d.ts +3 -0
- package/adapter-js/code/getI18nMetadata.d.ts +3 -0
- package/adapter-js/code/getT.d.ts +3 -0
- package/adapter-js/code/index.d.ts +3 -0
- package/adapter-js/code/isLocale.d.ts +3 -0
- package/adapter-js/code/loadTranslations.d.ts +3 -0
- package/adapter-js/code/locales.d.ts +3 -0
- package/adapter-js/code/pathnameToRouteId.d.ts +3 -0
- package/adapter-js/code/routes.d.ts +3 -0
- package/adapter-js/code/routesError.d.ts +3 -0
- package/adapter-js/code/routesSlim.d.ts +3 -0
- package/adapter-js/code/routesSpa.d.ts +3 -0
- package/adapter-js/code/t.d.ts +3 -0
- package/adapter-js/code/tInterpolateParams.d.ts +3 -0
- package/adapter-js/code/tPluralise.d.ts +3 -0
- package/adapter-js/code/to.d.ts +3 -0
- package/adapter-js/code/toFns.d.ts +3 -0
- package/adapter-js/code/toFormat.d.ts +3 -0
- package/adapter-js/code/toSpa.d.ts +3 -0
- package/adapter-js/code/types.d.ts +3 -0
- package/adapter-js/index.d.ts +5 -0
- package/adapter-js/options.d.ts +4 -0
- package/adapter-next/code/I18nApp.d.ts +3 -0
- package/adapter-next/code/I18nHead.d.ts +3 -0
- package/adapter-next/code/I18nLayout.d.ts +3 -0
- package/adapter-next/code/I18nPage.d.ts +3 -0
- package/adapter-next/code/I18nRoot.d.ts +3 -0
- package/adapter-next/code/I18nSetter.d.ts +3 -0
- package/adapter-next/code/deprecated_useLocale.d.ts +3 -0
- package/adapter-next/code/i18nGet.d.ts +3 -0
- package/adapter-next/code/index.d.ts +3 -0
- package/adapter-next/code/next-redirects.d.ts +3 -0
- package/adapter-next/code/next-rewrites.d.ts +3 -0
- package/adapter-next/code/useRouteId.d.ts +3 -0
- package/adapter-next/code/useTo.d.ts +3 -0
- package/adapter-next/code/useToSpa.d.ts +3 -0
- package/adapter-next/index.d.ts +5 -0
- package/adapter-next/options.d.ts +4 -0
- package/adapter-next/plugin-async.d.ts +8 -0
- package/adapter-next/plugin-legacy.d.ts +18 -0
- package/adapter-next/plugin-shared.d.ts +9 -0
- package/adapter-next/plugin.d.ts +6 -0
- package/adapter-next/redirects.d.ts +5 -0
- package/adapter-next/rewrites.d.ts +5 -0
- package/adapter-next/transformPathname.d.ts +1 -0
- package/adapter-next/webpackPluginI18n.d.ts +7 -0
- package/adapter-next-translate/code/DynamicNamespaces.d.ts +3 -0
- package/adapter-next-translate/code/I18nProvider.d.ts +3 -0
- package/adapter-next-translate/code/T.d.ts +3 -0
- package/adapter-next-translate/code/TransText.d.ts +3 -0
- package/adapter-next-translate/code/getT.d.ts +3 -0
- package/adapter-next-translate/code/index.d.ts +3 -0
- package/adapter-next-translate/code/nextTranslateI18n.d.ts +3 -0
- package/adapter-next-translate/code/useLocale.d.ts +3 -0
- package/adapter-next-translate/code/useT.d.ts +3 -0
- package/adapter-next-translate/index.d.ts +5 -0
- package/adapter-next-translate/options.d.ts +3 -0
- package/adapter-react/code/I18nContext.d.ts +3 -0
- package/adapter-react/code/I18nEffects.d.ts +3 -0
- package/adapter-react/code/I18nHeadTags.d.ts +3 -0
- package/adapter-react/code/I18nMetadataContext.d.ts +3 -0
- package/adapter-react/code/I18nMetadataProvider.d.ts +3 -0
- package/adapter-react/code/I18nMetadataSetter.d.ts +3 -0
- package/adapter-react/code/I18nProvider.d.ts +3 -0
- package/adapter-react/code/I18nRouteContext.d.ts +3 -0
- package/adapter-react/code/I18nRouteProvider.d.ts +3 -0
- package/adapter-react/code/I18nRouteSetter.d.ts +3 -0
- package/adapter-react/code/T.d.ts +3 -0
- package/adapter-react/code/TransText.d.ts +3 -0
- package/adapter-react/code/formatElements.d.ts +3 -0
- package/adapter-react/code/index.d.ts +2 -0
- package/adapter-react/code/useI18nSwitch.d.ts +3 -0
- package/adapter-react/code/useLocale.d.ts +3 -0
- package/adapter-react/code/useRouteId.d.ts +3 -0
- package/adapter-react/code/useT.d.ts +3 -0
- package/adapter-react/index.d.ts +5 -0
- package/adapter-react/options.d.ts +2 -0
- package/api.cjs.js +4026 -0
- package/api.esm.js +4000 -0
- package/client/formatRoutePathname.d.ts +4 -0
- package/client/index.d.ts +3 -0
- package/client/interpolateTo.d.ts +4 -0
- package/client/routeHasDynamicPortion.d.ts +2 -0
- package/compiler/adapter.d.ts +10 -0
- package/compiler/api.d.ts +34 -0
- package/compiler/code/data-routes.d.ts +21 -0
- package/compiler/code/data-translations.d.ts +16 -0
- package/compiler/code/data.d.ts +17 -0
- package/compiler/code/generate.d.ts +10 -0
- package/compiler/code/index.d.ts +3 -0
- package/compiler/code/tsCompile.d.ts +2 -0
- package/compiler/code/write.d.ts +10 -0
- package/compiler/config.d.ts +21 -0
- package/compiler/createAdapter.d.ts +5 -0
- package/compiler/helpers.d.ts +3 -0
- package/compiler/input/data-local.d.ts +4 -0
- package/compiler/input/data-remote.d.ts +7 -0
- package/compiler/input/data.d.ts +4 -0
- package/compiler/input/index.d.ts +4 -0
- package/compiler/input/types.d.ts +14 -0
- package/compiler/input/write.d.ts +8 -0
- package/compiler/pluralisation.d.ts +37 -0
- package/compiler/summary/data.d.ts +6 -0
- package/compiler/summary/generate.d.ts +3 -0
- package/compiler/summary/index.d.ts +2 -0
- package/compiler/summary/write.d.ts +10 -0
- package/compiler/types.d.ts +94 -0
- package/compiler-sync.cjs.d.ts +1 -0
- package/compiler-sync.cjs.default.js +1 -0
- package/compiler-sync.cjs.js +11 -0
- package/compiler-sync.cjs.mjs +2 -0
- package/compiler-sync.d.ts +4 -0
- package/compiler-sync.esm.js +7 -0
- package/compiler-worker.cjs.d.ts +1 -0
- package/compiler-worker.cjs.default.js +1 -0
- package/compiler-worker.cjs.js +17 -0
- package/compiler-worker.cjs.mjs +2 -0
- package/compiler-worker.d.ts +1 -0
- package/compiler-worker.esm.js +15 -0
- package/compiler.cjs.d.ts +1 -0
- package/compiler.cjs.default.js +1 -0
- package/compiler.cjs.js +20 -0
- package/compiler.cjs.mjs +2 -0
- package/compiler.d.ts +2 -0
- package/compiler.esm.js +12 -0
- package/formatRoutePathname.cjs.js +10 -0
- package/formatRoutePathname.esm.js +8 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +49 -0
- package/index.cjs.mjs +2 -0
- package/index.d.ts +2 -0
- package/index.esm.js +44 -0
- package/next.cjs.d.ts +1 -0
- package/next.cjs.default.js +1 -0
- package/next.cjs.js +353 -0
- package/next.cjs.mjs +2 -0
- package/next.d.ts +3 -0
- package/next.esm.js +329 -0
- package/package.json +62 -0
- package/types.d.ts +48 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @koine/i18n
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { I18nCompiler } from "../../compiler/types";
|
|
2
|
+
declare const _default: (data: I18nCompiler.DataCode, adapterOptions: import("type-fest/source/partial-deep").PartialObjectDeep<import("../options").AdapterJsOptions, {}>) => I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate"> | Promise<I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate">>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { I18nCompiler } from "../../compiler/types";
|
|
2
|
+
declare const _default: (data: I18nCompiler.DataCode, adapterOptions: import("type-fest/source/partial-deep").PartialObjectDeep<import("../options").AdapterNextOptions, {}>) => I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate"> | Promise<I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate">>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
import { type I18nCompilerOptions } from "../compiler";
|
|
3
|
+
type NextConfigFn = (phase: string, context?: any) => Promise<NextConfig> | NextConfig;
|
|
4
|
+
export type WithI18nAsyncOptions = NextConfig & {
|
|
5
|
+
i18nCompiler?: I18nCompilerOptions;
|
|
6
|
+
};
|
|
7
|
+
export declare let withI18nAsync: <TAdapterName extends "js" | "react" | "next" | "next-translate">(config?: WithI18nAsyncOptions) => NextConfigFn;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
import type { CodeDataRoutesOptions } from "../compiler/code/data-routes";
|
|
3
|
+
import type { I18nCompilerConfig } from "../compiler/config";
|
|
4
|
+
type Route = string | {
|
|
5
|
+
[key: string]: Route | string;
|
|
6
|
+
};
|
|
7
|
+
type RoutesByLocale = Record<string, Route>;
|
|
8
|
+
type Locale = string;
|
|
9
|
+
type Routes = Record<Locale, RoutesByLocale>;
|
|
10
|
+
type I18nRoutesOptions = {
|
|
11
|
+
routes: Routes;
|
|
12
|
+
debug?: boolean;
|
|
13
|
+
} & Pick<I18nCompilerConfig, "locales" | "defaultLocale" | "hideDefaultLocaleInUrl" | "trailingSlash"> & Pick<CodeDataRoutesOptions, "localeParamName" | "permanentRedirects">;
|
|
14
|
+
export type WithI18nLegacyOptions = NextConfig & {
|
|
15
|
+
i18nRoutes?: I18nRoutesOptions;
|
|
16
|
+
};
|
|
17
|
+
export declare let withI18nLegacy: (config: WithI18nLegacyOptions) => NextConfig;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
import type { I18nCompilerReturn } from "../compiler";
|
|
3
|
+
export declare let tweakNextConfig: (options: I18nCompilerReturn, nextConfig: NextConfig) => NextConfig;
|
|
4
|
+
export declare let getRedirects: (prevRedirects: NextConfig["redirects"], i18nResult: I18nCompilerReturn) => Promise<import("next/dist/lib/load-custom-routes").Redirect[]>;
|
|
5
|
+
export declare let getRewrites: (prevRewrites: NextConfig["rewrites"], i18nResult: I18nCompilerReturn) => Promise<{
|
|
6
|
+
beforeFiles: import("next/dist/lib/load-custom-routes").Rewrite[];
|
|
7
|
+
afterFiles: import("next/dist/lib/load-custom-routes").Rewrite[];
|
|
8
|
+
fallback: import("next/dist/lib/load-custom-routes").Rewrite[];
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Redirect } from "next/dist/lib/load-custom-routes";
|
|
2
|
+
import type { CodeDataRoutesOptions } from "../compiler/code/data-routes";
|
|
3
|
+
import type { I18nCompiler } from "../compiler/types";
|
|
4
|
+
export declare function generateRedirectForPathname(config: Pick<I18nCompiler.Config, "defaultLocale" | "hideDefaultLocaleInUrl" | "trailingSlash"> & Pick<CodeDataRoutesOptions, "localeParamName" | "permanentRedirects">, locale: string, template: string, pathname: string, redirects: (Redirect | undefined)[]): void;
|
|
5
|
+
export declare let generateRedirects: (config: I18nCompiler.Config, { localeParamName, permanentRedirects, tokens }: CodeDataRoutesOptions, routes: I18nCompiler.DataRoutes["byId"]) => Redirect[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Rewrite } from "next/dist/lib/load-custom-routes";
|
|
2
|
+
import type { CodeDataRoutesOptions } from "../compiler/code/data-routes";
|
|
3
|
+
import type { I18nCompiler } from "../compiler/types";
|
|
4
|
+
export declare const generateRewriteForPathname: (config: Pick<I18nCompiler.Config, "defaultLocale" | "hideDefaultLocaleInUrl" | "trailingSlash"> & Pick<CodeDataRoutesOptions, "localeParamName">, locale: string, template: string, pathname: string, rewrites: (Rewrite | undefined)[]) => void;
|
|
5
|
+
export declare let generateRewrites: (config: I18nCompiler.Config, { tokens, localeParamName, permanentRedirects }: CodeDataRoutesOptions, routes: I18nCompiler.DataRoutes["byId"]) => Rewrite[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transformPathname(rawPathnameOrTemplate: string, wildcard?: boolean): string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { I18nCompiler } from "../../compiler/types";
|
|
2
|
+
declare const _default: (data: I18nCompiler.DataCode, adapterOptions: import("type-fest/source/partial-deep").PartialObjectDeep<Partial<Pick<import("next-translate").I18nConfig, "loader">>, {}>) => I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate"> | Promise<I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate">>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: (data: import("../../compiler-sync").I18nCompiler.DataCode, adapterOptions: import("type-fest/source/partial-deep").PartialObjectDeep<import("../options").AdapterReactOptions, {}>) => import("../../compiler-sync").I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate"> | Promise<import("../../compiler-sync").I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate">>;
|
|
2
|
+
export default _default;
|