@voltro/i18n 0.1.0
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/CHANGELOG.md +52 -0
- package/LICENSE +57 -0
- package/README.md +26 -0
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +11 -0
- package/dist/index.d.ts +89 -0
- package/dist/index.js +31 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.js +43 -0
- package/package.json +46 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `@voltro/*` packages are recorded here. The format
|
|
4
|
+
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
|
+
|
|
6
|
+
## Stability contract — read this before you pin a version
|
|
7
|
+
|
|
8
|
+
Voltro is **`0.x` — pre-1.0, and deliberately so.** Under SemVer, `0.y.z` means
|
|
9
|
+
"anything MAY change." We hold to exactly that, stated out loud:
|
|
10
|
+
|
|
11
|
+
- **Pin exact versions.** Depend on `@voltro/runtime@0.4.2`, never `^0.4.2` or
|
|
12
|
+
`~0.4.2`. There is no compatible-range promise below 1.0.
|
|
13
|
+
- **Every MINOR may break.** Breaking changes land on a minor bump (`0.4.x →
|
|
14
|
+
0.5.0`); patches (`0.4.1 → 0.4.2`) are additive or fixes only. This is the
|
|
15
|
+
standard `0.x` reading of SemVer — the minor slot carries breaking under `0.x`.
|
|
16
|
+
- **Read this changelog before upgrading.** The `⚠ BREAKING` section of each
|
|
17
|
+
release lists every incompatible change with its migration. It is the only
|
|
18
|
+
migration path we provide — there is no deprecation cycle, no compat shim.
|
|
19
|
+
- **All packages release together (lockstep).** One coordinated version across
|
|
20
|
+
the whole framework; the git tag is the source of truth.
|
|
21
|
+
|
|
22
|
+
This is not a placeholder disclaimer — it is the contract. The framework is
|
|
23
|
+
refactored aggressively while it has no external stability obligations, and that
|
|
24
|
+
velocity is the point. A stable-core tier and per-package `1.0` graduation are
|
|
25
|
+
planned, but not yet; until then, treat the whole surface as movable and pin
|
|
26
|
+
exact.
|
|
27
|
+
|
|
28
|
+
The **public API** of each package is its `publishConfig.exports` entry points,
|
|
29
|
+
minus anything marked `@internal` (those are cross-package internals and are
|
|
30
|
+
stripped from the published `.d.ts`). Importing a deep path that isn't an
|
|
31
|
+
exported entry point is unsupported.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## [Unreleased]
|
|
36
|
+
|
|
37
|
+
_Changes staged for the next release accumulate here (rolled up from
|
|
38
|
+
`.changes/*.md` at tag time — see `.changes/README.md`)._
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## [0.1.0]
|
|
43
|
+
|
|
44
|
+
Initial pre-release baseline. This is the starting point the changelog tracks
|
|
45
|
+
from; it is not an exhaustive history of prior development. The framework ships
|
|
46
|
+
as `@voltro/*` packages spanning the runtime, database/query layer, web client
|
|
47
|
+
and router, durable workflows, the CLI, and the plugin ecosystem
|
|
48
|
+
(auth, storage, mail, billing, observability, and more). Not published to a
|
|
49
|
+
public registry yet.
|
|
50
|
+
|
|
51
|
+
Subsequent releases record their deltas from here under dated headings, with
|
|
52
|
+
`⚠ BREAKING` first.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Voltro — Proprietary Software License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Voltro UG. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This software and all associated source code, documentation, and other
|
|
6
|
+
materials (the "Software") are the proprietary property of Voltro UG
|
|
7
|
+
("Voltro"). This is NOT open-source software.
|
|
8
|
+
|
|
9
|
+
Your access to and use of the Software is governed exclusively by the Voltro
|
|
10
|
+
Terms of Service at:
|
|
11
|
+
|
|
12
|
+
https://voltro.cloud/legal/terms
|
|
13
|
+
|
|
14
|
+
By downloading, installing, or using the Software you agree to those Terms.
|
|
15
|
+
Subject to and conditioned on your continued compliance with them, Voltro
|
|
16
|
+
grants you a limited, non-exclusive, non-transferable, non-sublicensable,
|
|
17
|
+
revocable license to use the Software. All rights not expressly granted in the
|
|
18
|
+
Terms are reserved by Voltro. If you do not agree to the Terms, you have no
|
|
19
|
+
license and may not use the Software.
|
|
20
|
+
|
|
21
|
+
The Terms of Service — including the scope of permitted use, plan
|
|
22
|
+
entitlements, fees, and pricing — may change from time to time. The version in
|
|
23
|
+
force is the one published at the URL above. Commercial terms and pricing are
|
|
24
|
+
NOT part of this notice and are not fixed by, or granted in perpetuity by, the
|
|
25
|
+
version of the Software in which this file appears.
|
|
26
|
+
|
|
27
|
+
Permitted use — your own software. Voltro is a development framework. You may
|
|
28
|
+
use the Software to build, run, and commercially distribute your own
|
|
29
|
+
applications and services, and to charge your own customers for them, without
|
|
30
|
+
owing Voltro any share of that revenue or any further permission beyond the
|
|
31
|
+
Terms. Applications you build with the Software are yours.
|
|
32
|
+
|
|
33
|
+
Prohibited use — reselling Voltro. You may NOT redistribute, resell,
|
|
34
|
+
sublicense, publish, or otherwise provide the Software itself — in whole or in
|
|
35
|
+
part, in source or compiled form — to third parties as a library, framework,
|
|
36
|
+
SDK, template, starter, or development tool for them to build upon, whether
|
|
37
|
+
standalone or repackaged. Shipping the Software as a non-separable, bundled
|
|
38
|
+
dependency inside an application you deliver (for example, compiled into your
|
|
39
|
+
deployed app) is permitted; extracting or re-exposing it as a reusable
|
|
40
|
+
component for others is not.
|
|
41
|
+
|
|
42
|
+
Except as expressly permitted above or by the Terms, you may not copy, modify,
|
|
43
|
+
merge, publish, sublicense, sell, distribute, or create derivative works of the
|
|
44
|
+
Software, in whole or in part.
|
|
45
|
+
|
|
46
|
+
Third-party open-source components distributed alongside the Software are the
|
|
47
|
+
property of their respective owners and are licensed under their own terms; see
|
|
48
|
+
THIRD-PARTY-NOTICES.md where provided. Nothing in this notice limits your
|
|
49
|
+
rights, or extends Voltro's, in those components.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
54
|
+
VOLTRO BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY ARISING FROM,
|
|
55
|
+
OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR ITS USE.
|
|
56
|
+
|
|
57
|
+
For licensing inquiries, contact Voltro UG.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# @voltro/i18n
|
|
4
|
+
|
|
5
|
+
**Voltro's i18n layer — thin opinionated wrap over react-intl. Provides the framework's locale-resolution conventions (voltro:lang cookie + Accept-Language fallback), a typed message-catalog helper, and a slim provider component. Power users can import directly from react-intl for advanced APIs.**
|
|
6
|
+
|
|
7
|
+
[📖 Documentation](https://docs.voltro.dev/docs/i18n/overview) · [Changelog](./CHANGELOG.md) · [voltro.dev](https://voltro.dev) · [Voltro Cloud](https://voltro.cloud)
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm install @voltro/i18n
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> ### [→ Read the documentation for @voltro/i18n](https://docs.voltro.dev/docs/i18n/overview)
|
|
18
|
+
|
|
19
|
+
Installation, guides, the full API reference, and examples all live in the
|
|
20
|
+
**[Voltro documentation](https://docs.voltro.dev/docs/intro/getting-started)** — the single source of truth. This README is
|
|
21
|
+
deliberately short so there is nothing here to drift out of date.
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
Proprietary. © 2026 Voltro UG. Your use is governed by the
|
|
26
|
+
[Terms of Service](https://voltro.cloud/legal/terms). See the bundled `LICENSE`.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
We take the security of Voltro and the applications built on it seriously. This
|
|
4
|
+
document explains how to report a vulnerability and what to expect in return.
|
|
5
|
+
|
|
6
|
+
## Reporting a vulnerability
|
|
7
|
+
|
|
8
|
+
**Please do not open public issues or discuss suspected vulnerabilities in
|
|
9
|
+
public channels.** Report them privately by email:
|
|
10
|
+
|
|
11
|
+
**security contact: [support@voltro.dev](mailto:support@voltro.dev)**
|
|
12
|
+
(subject line: `SECURITY`).
|
|
13
|
+
|
|
14
|
+
Include, where you can:
|
|
15
|
+
|
|
16
|
+
- the affected package(s) and version(s) (e.g. `@voltro/runtime@x.y.z`);
|
|
17
|
+
- a description of the issue and its impact;
|
|
18
|
+
- a minimal reproduction or proof of concept;
|
|
19
|
+
- any suggested remediation.
|
|
20
|
+
|
|
21
|
+
If you'd like to encrypt your report, ask in a first plain email and we'll
|
|
22
|
+
arrange a key.
|
|
23
|
+
|
|
24
|
+
## What to expect
|
|
25
|
+
|
|
26
|
+
- **Acknowledgement** of your report within **3 business days**.
|
|
27
|
+
- An initial assessment (severity, affected surface) and a remediation plan as
|
|
28
|
+
soon as we've reproduced the issue.
|
|
29
|
+
- **Coordinated disclosure:** we'll agree a disclosure timeline with you and
|
|
30
|
+
credit you in the release notes if you wish. Please give us reasonable time to
|
|
31
|
+
ship a fix before any public disclosure.
|
|
32
|
+
|
|
33
|
+
We do not currently run a paid bug-bounty program, but we genuinely appreciate
|
|
34
|
+
responsible disclosure and will credit reporters.
|
|
35
|
+
|
|
36
|
+
## Software Bill of Materials (SBOM)
|
|
37
|
+
|
|
38
|
+
A CycloneDX SBOM of the third-party runtime dependency graph is generated for the
|
|
39
|
+
published packages (`pnpm gen:sbom` → `sbom.cdx.json`). If your procurement or
|
|
40
|
+
security team needs it, request it at
|
|
41
|
+
[support@voltro.dev](mailto:support@voltro.dev).
|
|
42
|
+
|
|
43
|
+
## Supported versions
|
|
44
|
+
|
|
45
|
+
Voltro is pre-1.0 and ships in lockstep: **only the latest published minor of
|
|
46
|
+
each `@voltro/*` package receives security fixes.** Please upgrade to the latest
|
|
47
|
+
release before reporting, and pin exact versions in production.
|
|
48
|
+
|
|
49
|
+
## Scope
|
|
50
|
+
|
|
51
|
+
In scope: the published `@voltro/*` packages and the framework's own code.
|
|
52
|
+
|
|
53
|
+
Out of scope: vulnerabilities in third-party dependencies that are already
|
|
54
|
+
tracked upstream (we monitor these via a production-dependency audit gate in
|
|
55
|
+
CI), and issues that require a non-default, explicitly-unsafe configuration. If
|
|
56
|
+
you're unsure, report it anyway — we'd rather hear about it.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Third-Party Notices — @voltro/i18n
|
|
2
|
+
|
|
3
|
+
This package depends on the open-source software listed below. Each is the
|
|
4
|
+
property of its respective copyright holders and is used under the terms of
|
|
5
|
+
its license. This file is provided for attribution; it grants no rights in
|
|
6
|
+
@voltro/i18n itself, which is proprietary (see LICENSE).
|
|
7
|
+
|
|
8
|
+
Generated from the resolved runtime dependency closure (0 packages).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { IntlConfig } from 'react-intl';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Identity function with type narrowing. Wrap your BASE catalog in
|
|
8
|
+
* this so other locales can `extends` its key set.
|
|
9
|
+
*/
|
|
10
|
+
export declare const defineCatalog: <T extends MessageCatalog>(catalog: T) => T;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Curried helper: pin the base catalog's key set, then accept a
|
|
14
|
+
* locale catalog that MUST mirror it exactly. Use for non-base
|
|
15
|
+
* locale files.
|
|
16
|
+
*
|
|
17
|
+
* The parameter is the FIXED mapped type `{ [K in keyof TBase]: string }`
|
|
18
|
+
* (not a type parameter inferred from the argument) so a directly-passed
|
|
19
|
+
* object literal is excess-property-checked: a MISSING key fails the
|
|
20
|
+
* required-property check, an EXTRA key fails the excess-property check —
|
|
21
|
+
* parity is enforced in both directions at compile time.
|
|
22
|
+
*/
|
|
23
|
+
export declare const defineLocale: <TBase extends MessageCatalog>() => (catalog: { readonly [K in keyof TBase]: string; }) => { readonly [K in keyof TBase]: string; };
|
|
24
|
+
|
|
25
|
+
export declare const I18nProvider: ({ locale, messages, defaultLocale, silenceMissingTranslations, intlConfig, children, }: I18nProviderProps) => ReactNode;
|
|
26
|
+
|
|
27
|
+
declare interface I18nProviderProps {
|
|
28
|
+
readonly locale: string;
|
|
29
|
+
readonly messages: MessageCatalog;
|
|
30
|
+
/** Base locale that owns the source-of-truth catalog. react-intl
|
|
31
|
+
* uses this for fallback formatting + as the "this is the
|
|
32
|
+
* reference shape" marker. */
|
|
33
|
+
readonly defaultLocale: string;
|
|
34
|
+
/** Suppress react-intl's missing-translation console error for
|
|
35
|
+
* non-base locales. Defaults to true — during translation
|
|
36
|
+
* rollout missing strings will fall back to the source-of-truth
|
|
37
|
+
* locale, no need to flood the console. */
|
|
38
|
+
readonly silenceMissingTranslations?: boolean;
|
|
39
|
+
/** Forward any other IntlProvider prop unmodified (timeZone,
|
|
40
|
+
* formats, textComponent, …). */
|
|
41
|
+
readonly intlConfig?: Partial<Omit<IntlConfig, 'locale' | 'messages' | 'defaultLocale' | 'onError'>>;
|
|
42
|
+
readonly children: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Build a children-to-tree wrapper that mounts `<I18nProvider>` with
|
|
47
|
+
* the supplied locale + catalog. The framework's SSG pipeline calls
|
|
48
|
+
* this once per build and passes the returned function as
|
|
49
|
+
* `renderPageToHtml({ outerWrap })`.
|
|
50
|
+
*
|
|
51
|
+
* For a multi-locale build the SSG emits per-locale HTML variants:
|
|
52
|
+
* `voltro build` calls this once per locale and, for each rendered
|
|
53
|
+
* page, picks `localeWraps.get(renderLocale)` — a `[locale]/…` route
|
|
54
|
+
* renders under its own `locale` param, a bare-path route under the
|
|
55
|
+
* `defaultLocale`. The client still swaps to the user's locale on
|
|
56
|
+
* hydration via the runtime's provider in `.framework/app.tsx`, but the
|
|
57
|
+
* emitted HTML is already locale-correct (right catalog + `meta({ locale })`).
|
|
58
|
+
*/
|
|
59
|
+
export declare const makeSsgWrap: (locale: string, messages: MessageCatalog, defaultLocale: string) => ((children: ReactNode) => ReactNode);
|
|
60
|
+
|
|
61
|
+
export declare type MessageCatalog = Readonly<Record<string, string>>;
|
|
62
|
+
|
|
63
|
+
export declare const T: ({ id, ...rest }: TProps) => ReactNode;
|
|
64
|
+
|
|
65
|
+
declare type TProps = Omit<ComponentProps<typeof FormattedMessage>, 'id'> & {
|
|
66
|
+
readonly id: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export declare const useLocale: () => string;
|
|
70
|
+
|
|
71
|
+
export declare const useT: (id: string, values?: Record<string, string | number | boolean | Date | null | undefined>) => string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Function-form translator. Unlike `useT(id, values)` which returns
|
|
75
|
+
* a string immediately, this returns a callable `(id, values) =>
|
|
76
|
+
* string` so a component can capture it once and reuse it inside
|
|
77
|
+
* conditional branches, list maps, helper components, etc. Avoids
|
|
78
|
+
* the boilerplate of N `useIntl()` calls per render — react-intl
|
|
79
|
+
* runs once, the closure replays.
|
|
80
|
+
*
|
|
81
|
+
* const t = useTFn()
|
|
82
|
+
* // ... inside JSX or helpers:
|
|
83
|
+
* t('webhooks.title')
|
|
84
|
+
* t('webhooks.subscribe.field.event')
|
|
85
|
+
* t('webhooks.target.action.repin', { v: 2 })
|
|
86
|
+
*/
|
|
87
|
+
export declare const useTFn: () => (id: string, values?: Record<string, string | number | boolean | Date | null | undefined>) => string;
|
|
88
|
+
|
|
89
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FormattedMessage as e, IntlProvider as t, useIntl as n } from "react-intl";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { createElement as i, useCallback as a } from "react";
|
|
4
|
+
//#region src/provider.tsx
|
|
5
|
+
var o = ({ locale: e, messages: n, defaultLocale: i, silenceMissingTranslations: a = !0, intlConfig: o, children: s }) => {
|
|
6
|
+
let c = a ? (e) => {
|
|
7
|
+
e.code !== "MISSING_TRANSLATION" && console.error(e);
|
|
8
|
+
} : void 0;
|
|
9
|
+
return /* @__PURE__ */ r(t, {
|
|
10
|
+
locale: e,
|
|
11
|
+
defaultLocale: i,
|
|
12
|
+
messages: n,
|
|
13
|
+
...c ? { onError: c } : {},
|
|
14
|
+
...o,
|
|
15
|
+
children: s
|
|
16
|
+
});
|
|
17
|
+
}, s = ({ id: t, ...n }) => /* @__PURE__ */ r(e, {
|
|
18
|
+
id: t,
|
|
19
|
+
...n
|
|
20
|
+
}), c = (e, t) => n().formatMessage({ id: e }, t), l = () => n().locale, u = () => {
|
|
21
|
+
let e = n();
|
|
22
|
+
return a((t, n) => e.formatMessage({ id: t }, n), [e]);
|
|
23
|
+
}, d = (e) => e, f = () => (e) => e, p = (e, t, n) => (r) => i(o, {
|
|
24
|
+
locale: e,
|
|
25
|
+
messages: t,
|
|
26
|
+
defaultLocale: n,
|
|
27
|
+
silenceMissingTranslations: !0,
|
|
28
|
+
children: r
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { o as I18nProvider, s as T, d as defineCatalog, f as defineLocale, p as makeSsgWrap, l as useLocale, c as useT, u as useTFn };
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const resolveLocale: (args: ResolveLocaleArgs) => string;
|
|
2
|
+
|
|
3
|
+
export declare interface ResolveLocaleArgs {
|
|
4
|
+
/** Raw `Cookie:` request header, or null/undefined when absent. */
|
|
5
|
+
readonly cookieHeader?: string | null;
|
|
6
|
+
/** Raw `Accept-Language:` request header, or null/undefined when
|
|
7
|
+
* absent. Parsed per RFC 4647: each entry `tag;q=weight`, sorted
|
|
8
|
+
* by descending weight, default weight 1.0. */
|
|
9
|
+
readonly acceptLanguageHeader?: string | null;
|
|
10
|
+
/** Locale codes the app actually ships catalogs for. The returned
|
|
11
|
+
* locale is guaranteed to be one of these. */
|
|
12
|
+
readonly supported: ReadonlyArray<string>;
|
|
13
|
+
/** Last-resort fallback when no signal matches a supported locale.
|
|
14
|
+
* MUST be in `supported`. */
|
|
15
|
+
readonly defaultLocale: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { }
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/server.ts
|
|
2
|
+
var e = (e) => RegExp(`(?:^|;\\s*)${e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}=([^;]*)`), t = (t, n) => {
|
|
3
|
+
if (!t) return;
|
|
4
|
+
let r = t.match(e(n));
|
|
5
|
+
return r ? decodeURIComponent(r[1]) : void 0;
|
|
6
|
+
}, n = (e, t) => {
|
|
7
|
+
let n = e.toLowerCase();
|
|
8
|
+
for (; n.length > 0;) {
|
|
9
|
+
let e = t.find((e) => e.toLowerCase() === n);
|
|
10
|
+
if (e) return e;
|
|
11
|
+
let r = n.lastIndexOf("-");
|
|
12
|
+
if (r < 0) return;
|
|
13
|
+
n = n.slice(0, r);
|
|
14
|
+
}
|
|
15
|
+
}, r = (e) => e ? e.split(",").map((e) => {
|
|
16
|
+
let [t, ...n] = e.split(";").map((e) => e.trim());
|
|
17
|
+
if (!t || t === "*") return null;
|
|
18
|
+
let r = 1;
|
|
19
|
+
for (let e of n) {
|
|
20
|
+
let t = e.match(/^q=([0-9.]+)$/i);
|
|
21
|
+
if (t) {
|
|
22
|
+
let e = Number(t[1]);
|
|
23
|
+
Number.isFinite(e) && (r = e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
tag: t,
|
|
28
|
+
q: r
|
|
29
|
+
};
|
|
30
|
+
}).filter((e) => e !== null).sort((e, t) => t.q - e.q) : [], i = (e) => {
|
|
31
|
+
let { cookieHeader: i, acceptLanguageHeader: a, supported: o, defaultLocale: s } = e, c = t(i, "voltro:lang");
|
|
32
|
+
if (c) {
|
|
33
|
+
let e = n(c, o);
|
|
34
|
+
if (e) return e;
|
|
35
|
+
}
|
|
36
|
+
for (let e of r(a)) {
|
|
37
|
+
let t = n(e.tag, o);
|
|
38
|
+
if (t) return t;
|
|
39
|
+
}
|
|
40
|
+
return s;
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { i as resolveLocale };
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@voltro/i18n",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Voltro's i18n layer — thin opinionated wrap over react-intl. Provides the framework's locale-resolution conventions (voltro:lang cookie + Accept-Language fallback), a typed message-catalog helper, and a slim provider component. Power users can import directly from react-intl for advanced APIs.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"voltro",
|
|
7
|
+
"typescript",
|
|
8
|
+
"framework"
|
|
9
|
+
],
|
|
10
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
11
|
+
"homepage": "https://voltro.dev",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"email": "support@voltro.dev"
|
|
14
|
+
},
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Voltro UG",
|
|
17
|
+
"url": "https://voltro.dev"
|
|
18
|
+
},
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./server": {
|
|
27
|
+
"types": "./dist/server.d.ts",
|
|
28
|
+
"import": "./dist/server.js",
|
|
29
|
+
"default": "./dist/server.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"module": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=24.0.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": "^19.0.0",
|
|
41
|
+
"react-intl": "^10"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|