ci: revert Compile translations step from CI workflows

This commit is contained in:
yiling
2026-06-26 12:24:41 +08:00
parent ba5f7296a8
commit bbe36a028d
52 changed files with 2070 additions and 1784 deletions
-3
View File
@@ -34,9 +34,6 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y ripgrep bubblewrap socat sudo apt-get install -y ripgrep bubblewrap socat
- name: Compile translations
run: bun run i18n:compile
- name: Lint - name: Lint
run: bun run lint run: bun run lint
-3
View File
@@ -53,9 +53,6 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: bun install run: bun install
- name: Compile translations
run: bun run i18n:compile
- name: Lint - name: Lint
run: bun run lint run: bun run lint
+24 -21
View File
@@ -4,7 +4,6 @@
Compiled from: `/Users/yiling/Projects/shumai/packages/webui/project.inlang` Compiled from: `/Users/yiling/Projects/shumai/packages/webui/project.inlang`
## What is this folder? ## What is this folder?
This folder contains compiled [Paraglide JS](https://github.com/opral/paraglide-js) output. Paraglide JS compiles your translation messages into tree-shakeable JavaScript functions. This folder contains compiled [Paraglide JS](https://github.com/opral/paraglide-js) output. Paraglide JS compiles your translation messages into tree-shakeable JavaScript functions.
@@ -12,15 +11,18 @@ This folder contains compiled [Paraglide JS](https://github.com/opral/paraglide-
## At a glance ## At a glance
Purpose: Purpose:
- This folder stores compiled i18n message functions. - This folder stores compiled i18n message functions.
- Source translations live outside this folder in your inlang project. - Source translations live outside this folder in your inlang project.
Safe to import: Safe to import:
- `messages.js` — all message functions - `messages.js` — all message functions
- `runtime.js` — locale utilities - `runtime.js` — locale utilities
- `server.js` — server-side middleware - `server.js` — server-side middleware
Do not edit: Do not edit:
- All files in this folder are auto-generated. - All files in this folder are auto-generated.
- Changes will be overwritten on next compilation. - Changes will be overwritten on next compilation.
@@ -37,27 +39,27 @@ paraglide/
## Usage ## Usage
```js ```js
import * as m from "./paraglide/messages.js"; import * as m from './paraglide/messages.js'
// Messages are functions that return localized strings // Messages are functions that return localized strings
m.hello_world(); // "Hello, World!" (in current locale) m.hello_world() // "Hello, World!" (in current locale)
m.greeting({ name: "Sam" }); // "Hello, Sam!" m.greeting({ name: 'Sam' }) // "Hello, Sam!"
// Override locale per-call // Override locale per-call
m.hello_world({}, { locale: "de" }); // "Hallo, Welt!" m.hello_world({}, { locale: 'de' }) // "Hallo, Welt!"
m.greeting({ name: "Sam" }, { locale: "de" }); // "Hallo, Sam!" m.greeting({ name: 'Sam' }, { locale: 'de' }) // "Hallo, Sam!"
``` ```
## Runtime API ## Runtime API
```js ```js
import { getLocale, getTextDirection, setLocale, locales, baseLocale } from "./paraglide/runtime.js"; import { getLocale, getTextDirection, setLocale, locales, baseLocale } from './paraglide/runtime.js'
getLocale(); // Current locale, e.g., "en" getLocale() // Current locale, e.g., "en"
getTextDirection(); // "ltr" | "rtl" for current locale getTextDirection() // "ltr" | "rtl" for current locale
setLocale("de"); // Set locale setLocale('de') // Set locale
locales; // Available locales, e.g., ["en", "de", "fr"] locales // Available locales, e.g., ["en", "de", "fr"]
baseLocale; // Default locale, e.g., "en" baseLocale // Default locale, e.g., "en"
``` ```
## Strategy ## Strategy
@@ -73,10 +75,10 @@ Strategies can be combined. The order defines precedence:
```js ```js
await compile({ await compile({
project: "./project.inlang", project: './project.inlang',
outdir: "./src/paraglide", outdir: './src/paraglide',
strategy: ["url", "cookie", "baseLocale"], strategy: ['url', 'cookie', 'baseLocale'],
}); })
``` ```
See the [strategy documentation](https://paraglidejs.com/strategy) for details. See the [strategy documentation](https://paraglidejs.com/strategy) for details.
@@ -86,6 +88,7 @@ See the [strategy documentation](https://paraglidejs.com/strategy) for details.
Messages can contain markup tags for bold, links, and other inline elements. Translators control where tags appear; developers control how they render. Messages can contain markup tags for bold, links, and other inline elements. Translators control where tags appear; developers control how they render.
Important: Important:
- Tag names are app-defined. There is no built-in list of HTML tags. - Tag names are app-defined. There is no built-in list of HTML tags.
- `{#b}...{/b}` does not automatically render as `<b>...</b>`. - `{#b}...{/b}` does not automatically render as `<b>...</b>`.
- Renderers/snippets are looked up by the same tag name used in the message. - Renderers/snippets are looked up by the same tag name used in the message.
@@ -111,13 +114,13 @@ This is the default inlang message syntax. Paraglide's message format is plugin-
Calling the message function still returns **plain text** (markup stripped): Calling the message function still returns **plain text** (markup stripped):
```js ```js
m.cta({ relationship: "noopener" }); // "Read the docs" m.cta({ relationship: 'noopener' }) // "Read the docs"
``` ```
To render markup, use the framework adapter or the low-level `parts()` API: To render markup, use the framework adapter or the low-level `parts()` API:
```js ```js
const parts = m.cta.parts({ relationship: "noopener" }); const parts = m.cta.parts({ relationship: 'noopener' })
// [ // [
// { type: "markup-start", name: "link", options: { to: "/docs", rel: "noopener" }, attributes: { track: true } }, // { type: "markup-start", name: "link", options: { to: "/docs", rel: "noopener" }, attributes: { track: true } },
// { type: "text", value: "Read the docs" }, // { type: "text", value: "Read the docs" },
@@ -133,11 +136,11 @@ Framework adapters provide a `<ParaglideMessage>` component that accepts markup
- `@inlang/paraglide-js-solid` - `@inlang/paraglide-js-solid`
```jsx ```jsx
import { ParaglideMessage } from "@inlang/paraglide-js-react"; // or -vue, -svelte, -solid import { ParaglideMessage } from '@inlang/paraglide-js-react' // or -vue, -svelte, -solid
<ParaglideMessage ;<ParaglideMessage
message={m.welcome} message={m.welcome}
inputs={{ name: "Ada" }} inputs={{ name: 'Ada' }}
markup={{ markup={{
b: ({ children }) => <b>{children}</b>, b: ({ children }) => <b>{children}</b>,
icon: () => <span aria-hidden="true" className="icon-wave" />, icon: () => <span aria-hidden="true" className="icon-wave" />,
+2 -2
View File
@@ -1,2 +1,2 @@
export * from "./messages/_index.js"; export * from './messages/_index.js'
export * as m from "./messages/_index.js"; export * as m from './messages/_index.js'
+20 -20
View File
@@ -1,20 +1,20 @@
export * from "./dashboard.js"; export * from './dashboard.js'
export * from "./notifications.js"; export * from './notifications.js'
export * from "./uploads.js"; export * from './uploads.js'
export * from "./language.js"; export * from './language.js'
export * from "./personal_info.js"; export * from './personal_info.js'
export * from "./language_settings.js"; export * from './language_settings.js'
export * from "./select_preferred_language.js"; export * from './select_preferred_language.js'
export * from "./settings.js"; export * from './settings.js'
export * from "./welcome_back.js"; export * from './welcome_back.js'
export * from "./create_account.js"; export * from './create_account.js'
export * from "./select_a_team.js"; export * from './select_a_team.js'
export * from "./projects.js"; export * from './projects.js'
export * from "./select_asset_to_view_details.js"; export * from './select_asset_to_view_details.js'
export * from "./all_collections.js"; export * from './all_collections.js'
export * from "./file_not_found.js"; export * from './file_not_found.js'
export * from "./recently_deleted_notice.js"; export * from './recently_deleted_notice.js'
export * from "./all_share_links.js"; export * from './all_share_links.js'
export * from "./link_visibility.js"; export * from './link_visibility.js'
export * from "./password_protected.js"; export * from './password_protected.js'
export type LocalizedString = import("../runtime.js").LocalizedString; export type LocalizedString = import('../runtime.js').LocalizedString
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "All Collections" | * | "All Collections" |
* *
* @param {All_CollectionsInputs} inputs * @param {All_CollectionsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const all_collections: ((inputs?: All_CollectionsInputs, options?: { export const all_collections: ((
locale?: "en" | "zh"; inputs?: All_CollectionsInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<All_CollectionsInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type All_CollectionsInputs = {}; import('../runtime.js').MessageMetadata<
All_CollectionsInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type All_CollectionsInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} All_CollectionsInputs */ /** @typedef {{}} All_CollectionsInputs */
const en_all_collections = /** @type {(inputs: All_CollectionsInputs) => LocalizedString} */ () => { const en_all_collections = /** @type {(inputs: All_CollectionsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`All Collections`) return /** @type {LocalizedString} */ (`All Collections`)
}; }
const zh_all_collections = /** @type {(inputs: All_CollectionsInputs) => LocalizedString} */ () => { const zh_all_collections = /** @type {(inputs: All_CollectionsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`所有收藏`) return /** @type {LocalizedString} */ (`所有收藏`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "All Collections" | * | "All Collections" |
* *
* @param {All_CollectionsInputs} inputs * @param {All_CollectionsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const all_collections = /** @type {((inputs?: All_CollectionsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<All_CollectionsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const all_collections =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: All_CollectionsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<All_CollectionsInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_all_collections(inputs) (inputs = {}, options = {}) => {
return zh_all_collections(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_all_collections(inputs)
return zh_all_collections(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "All Share Links" | * | "All Share Links" |
* *
* @param {All_Share_LinksInputs} inputs * @param {All_Share_LinksInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const all_share_links: ((inputs?: All_Share_LinksInputs, options?: { export const all_share_links: ((
locale?: "en" | "zh"; inputs?: All_Share_LinksInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<All_Share_LinksInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type All_Share_LinksInputs = {}; import('../runtime.js').MessageMetadata<
All_Share_LinksInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type All_Share_LinksInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} All_Share_LinksInputs */ /** @typedef {{}} All_Share_LinksInputs */
const en_all_share_links = /** @type {(inputs: All_Share_LinksInputs) => LocalizedString} */ () => { const en_all_share_links = /** @type {(inputs: All_Share_LinksInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`All Share Links`) return /** @type {LocalizedString} */ (`All Share Links`)
}; }
const zh_all_share_links = /** @type {(inputs: All_Share_LinksInputs) => LocalizedString} */ () => { const zh_all_share_links = /** @type {(inputs: All_Share_LinksInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`所有分享链接`) return /** @type {LocalizedString} */ (`所有分享链接`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "All Share Links" | * | "All Share Links" |
* *
* @param {All_Share_LinksInputs} inputs * @param {All_Share_LinksInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const all_share_links = /** @type {((inputs?: All_Share_LinksInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<All_Share_LinksInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const all_share_links =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: All_Share_LinksInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<All_Share_LinksInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_all_share_links(inputs) (inputs = {}, options = {}) => {
return zh_all_share_links(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_all_share_links(inputs)
return zh_all_share_links(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Create Account" | * | "Create Account" |
* *
* @param {Create_AccountInputs} inputs * @param {Create_AccountInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const create_account: ((inputs?: Create_AccountInputs, options?: { export const create_account: ((
locale?: "en" | "zh"; inputs?: Create_AccountInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Create_AccountInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Create_AccountInputs = {}; import('../runtime.js').MessageMetadata<
Create_AccountInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Create_AccountInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Create_AccountInputs */ /** @typedef {{}} Create_AccountInputs */
const en_create_account = /** @type {(inputs: Create_AccountInputs) => LocalizedString} */ () => { const en_create_account = /** @type {(inputs: Create_AccountInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Create Account`) return /** @type {LocalizedString} */ (`Create Account`)
}; }
const zh_create_account = /** @type {(inputs: Create_AccountInputs) => LocalizedString} */ () => { const zh_create_account = /** @type {(inputs: Create_AccountInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`创建账户`) return /** @type {LocalizedString} */ (`创建账户`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Create Account" | * | "Create Account" |
* *
* @param {Create_AccountInputs} inputs * @param {Create_AccountInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const create_account = /** @type {((inputs?: Create_AccountInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Create_AccountInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const create_account =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Create_AccountInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Create_AccountInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_create_account(inputs) (inputs = {}, options = {}) => {
return zh_create_account(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_create_account(inputs)
return zh_create_account(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Dashboard" | * | "Dashboard" |
* *
* @param {DashboardInputs} inputs * @param {DashboardInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const dashboard: ((inputs?: DashboardInputs, options?: { export const dashboard: ((
locale?: "en" | "zh"; inputs?: DashboardInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<DashboardInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type DashboardInputs = {}; import('../runtime.js').MessageMetadata<
DashboardInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type DashboardInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} DashboardInputs */ /** @typedef {{}} DashboardInputs */
const en_dashboard = /** @type {(inputs: DashboardInputs) => LocalizedString} */ () => { const en_dashboard = /** @type {(inputs: DashboardInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Dashboard`) return /** @type {LocalizedString} */ (`Dashboard`)
}; }
const zh_dashboard = /** @type {(inputs: DashboardInputs) => LocalizedString} */ () => { const zh_dashboard = /** @type {(inputs: DashboardInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`控制台`) return /** @type {LocalizedString} */ (`控制台`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Dashboard" | * | "Dashboard" |
* *
* @param {DashboardInputs} inputs * @param {DashboardInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const dashboard = /** @type {((inputs?: DashboardInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<DashboardInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const dashboard =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: DashboardInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<DashboardInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_dashboard(inputs) (inputs = {}, options = {}) => {
return zh_dashboard(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_dashboard(inputs)
return zh_dashboard(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "File not found." | * | "File not found." |
* *
* @param {File_Not_FoundInputs} inputs * @param {File_Not_FoundInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const file_not_found: ((inputs?: File_Not_FoundInputs, options?: { export const file_not_found: ((
locale?: "en" | "zh"; inputs?: File_Not_FoundInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<File_Not_FoundInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type File_Not_FoundInputs = {}; import('../runtime.js').MessageMetadata<
File_Not_FoundInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type File_Not_FoundInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} File_Not_FoundInputs */ /** @typedef {{}} File_Not_FoundInputs */
const en_file_not_found = /** @type {(inputs: File_Not_FoundInputs) => LocalizedString} */ () => { const en_file_not_found = /** @type {(inputs: File_Not_FoundInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`File not found.`) return /** @type {LocalizedString} */ (`File not found.`)
}; }
const zh_file_not_found = /** @type {(inputs: File_Not_FoundInputs) => LocalizedString} */ () => { const zh_file_not_found = /** @type {(inputs: File_Not_FoundInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`文件未找到。`) return /** @type {LocalizedString} */ (`文件未找到。`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "File not found." | * | "File not found." |
* *
* @param {File_Not_FoundInputs} inputs * @param {File_Not_FoundInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const file_not_found = /** @type {((inputs?: File_Not_FoundInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<File_Not_FoundInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const file_not_found =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: File_Not_FoundInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<File_Not_FoundInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_file_not_found(inputs) (inputs = {}, options = {}) => {
return zh_file_not_found(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_file_not_found(inputs)
return zh_file_not_found(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Language" | * | "Language" |
* *
* @param {LanguageInputs} inputs * @param {LanguageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const language: ((inputs?: LanguageInputs, options?: { export const language: ((
locale?: "en" | "zh"; inputs?: LanguageInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<LanguageInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type LanguageInputs = {}; import('../runtime.js').MessageMetadata<
LanguageInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type LanguageInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} LanguageInputs */ /** @typedef {{}} LanguageInputs */
const en_language = /** @type {(inputs: LanguageInputs) => LocalizedString} */ () => { const en_language = /** @type {(inputs: LanguageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Language`) return /** @type {LocalizedString} */ (`Language`)
}; }
const zh_language = /** @type {(inputs: LanguageInputs) => LocalizedString} */ () => { const zh_language = /** @type {(inputs: LanguageInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`语言`) return /** @type {LocalizedString} */ (`语言`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Language" | * | "Language" |
* *
* @param {LanguageInputs} inputs * @param {LanguageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const language = /** @type {((inputs?: LanguageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<LanguageInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const language =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: LanguageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<LanguageInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_language(inputs) (inputs = {}, options = {}) => {
return zh_language(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_language(inputs)
return zh_language(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Language Settings" | * | "Language Settings" |
* *
* @param {Language_SettingsInputs} inputs * @param {Language_SettingsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const language_settings: ((inputs?: Language_SettingsInputs, options?: { export const language_settings: ((
locale?: "en" | "zh"; inputs?: Language_SettingsInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Language_SettingsInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Language_SettingsInputs = {}; import('../runtime.js').MessageMetadata<
Language_SettingsInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Language_SettingsInputs = {}
@@ -1,29 +1,34 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Language_SettingsInputs */ /** @typedef {{}} Language_SettingsInputs */
const en_language_settings = /** @type {(inputs: Language_SettingsInputs) => LocalizedString} */ () => { const en_language_settings =
return /** @type {LocalizedString} */ (`Language Settings`) /** @type {(inputs: Language_SettingsInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`Language Settings`)
}
const zh_language_settings = /** @type {(inputs: Language_SettingsInputs) => LocalizedString} */ () => { const zh_language_settings =
return /** @type {LocalizedString} */ (`语言设置`) /** @type {(inputs: Language_SettingsInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`语言设置`)
}
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Language Settings" | * | "Language Settings" |
* *
* @param {Language_SettingsInputs} inputs * @param {Language_SettingsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const language_settings = /** @type {((inputs?: Language_SettingsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Language_SettingsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const language_settings =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Language_SettingsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Language_SettingsInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_language_settings(inputs) (inputs = {}, options = {}) => {
return zh_language_settings(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_language_settings(inputs)
return zh_language_settings(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Link Visibility" | * | "Link Visibility" |
* *
* @param {Link_VisibilityInputs} inputs * @param {Link_VisibilityInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const link_visibility: ((inputs?: Link_VisibilityInputs, options?: { export const link_visibility: ((
locale?: "en" | "zh"; inputs?: Link_VisibilityInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Link_VisibilityInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Link_VisibilityInputs = {}; import('../runtime.js').MessageMetadata<
Link_VisibilityInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Link_VisibilityInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Link_VisibilityInputs */ /** @typedef {{}} Link_VisibilityInputs */
const en_link_visibility = /** @type {(inputs: Link_VisibilityInputs) => LocalizedString} */ () => { const en_link_visibility = /** @type {(inputs: Link_VisibilityInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Link Visibility`) return /** @type {LocalizedString} */ (`Link Visibility`)
}; }
const zh_link_visibility = /** @type {(inputs: Link_VisibilityInputs) => LocalizedString} */ () => { const zh_link_visibility = /** @type {(inputs: Link_VisibilityInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`链接可见性`) return /** @type {LocalizedString} */ (`链接可见性`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Link Visibility" | * | "Link Visibility" |
* *
* @param {Link_VisibilityInputs} inputs * @param {Link_VisibilityInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const link_visibility = /** @type {((inputs?: Link_VisibilityInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Link_VisibilityInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const link_visibility =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Link_VisibilityInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Link_VisibilityInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_link_visibility(inputs) (inputs = {}, options = {}) => {
return zh_link_visibility(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_link_visibility(inputs)
return zh_link_visibility(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Notifications" | * | "Notifications" |
* *
* @param {NotificationsInputs} inputs * @param {NotificationsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const notifications: ((inputs?: NotificationsInputs, options?: { export const notifications: ((
locale?: "en" | "zh"; inputs?: NotificationsInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<NotificationsInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type NotificationsInputs = {}; import('../runtime.js').MessageMetadata<
NotificationsInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type NotificationsInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} NotificationsInputs */ /** @typedef {{}} NotificationsInputs */
const en_notifications = /** @type {(inputs: NotificationsInputs) => LocalizedString} */ () => { const en_notifications = /** @type {(inputs: NotificationsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Notifications`) return /** @type {LocalizedString} */ (`Notifications`)
}; }
const zh_notifications = /** @type {(inputs: NotificationsInputs) => LocalizedString} */ () => { const zh_notifications = /** @type {(inputs: NotificationsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`通知中心`) return /** @type {LocalizedString} */ (`通知中心`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Notifications" | * | "Notifications" |
* *
* @param {NotificationsInputs} inputs * @param {NotificationsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const notifications = /** @type {((inputs?: NotificationsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<NotificationsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const notifications =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: NotificationsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<NotificationsInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_notifications(inputs) (inputs = {}, options = {}) => {
return zh_notifications(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_notifications(inputs)
return zh_notifications(inputs)
}
)
@@ -1,4 +1,4 @@
{ {
"type": "module", "type": "module",
"sideEffects": false "sideEffects": false
} }
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Password Protected" | * | "Password Protected" |
* *
* @param {Password_ProtectedInputs} inputs * @param {Password_ProtectedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const password_protected: ((inputs?: Password_ProtectedInputs, options?: { export const password_protected: ((
locale?: "en" | "zh"; inputs?: Password_ProtectedInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Password_ProtectedInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Password_ProtectedInputs = {}; import('../runtime.js').MessageMetadata<
Password_ProtectedInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Password_ProtectedInputs = {}
@@ -1,29 +1,34 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Password_ProtectedInputs */ /** @typedef {{}} Password_ProtectedInputs */
const en_password_protected = /** @type {(inputs: Password_ProtectedInputs) => LocalizedString} */ () => { const en_password_protected =
return /** @type {LocalizedString} */ (`Password Protected`) /** @type {(inputs: Password_ProtectedInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`Password Protected`)
}
const zh_password_protected = /** @type {(inputs: Password_ProtectedInputs) => LocalizedString} */ () => { const zh_password_protected =
return /** @type {LocalizedString} */ (`密码保护`) /** @type {(inputs: Password_ProtectedInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`密码保护`)
}
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Password Protected" | * | "Password Protected" |
* *
* @param {Password_ProtectedInputs} inputs * @param {Password_ProtectedInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const password_protected = /** @type {((inputs?: Password_ProtectedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Password_ProtectedInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const password_protected =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Password_ProtectedInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Password_ProtectedInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_password_protected(inputs) (inputs = {}, options = {}) => {
return zh_password_protected(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_password_protected(inputs)
return zh_password_protected(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Personal Info" | * | "Personal Info" |
* *
* @param {Personal_InfoInputs} inputs * @param {Personal_InfoInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const personal_info: ((inputs?: Personal_InfoInputs, options?: { export const personal_info: ((
locale?: "en" | "zh"; inputs?: Personal_InfoInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Personal_InfoInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Personal_InfoInputs = {}; import('../runtime.js').MessageMetadata<
Personal_InfoInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Personal_InfoInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Personal_InfoInputs */ /** @typedef {{}} Personal_InfoInputs */
const en_personal_info = /** @type {(inputs: Personal_InfoInputs) => LocalizedString} */ () => { const en_personal_info = /** @type {(inputs: Personal_InfoInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Personal Info`) return /** @type {LocalizedString} */ (`Personal Info`)
}; }
const zh_personal_info = /** @type {(inputs: Personal_InfoInputs) => LocalizedString} */ () => { const zh_personal_info = /** @type {(inputs: Personal_InfoInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`个人信息`) return /** @type {LocalizedString} */ (`个人信息`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Personal Info" | * | "Personal Info" |
* *
* @param {Personal_InfoInputs} inputs * @param {Personal_InfoInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const personal_info = /** @type {((inputs?: Personal_InfoInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Personal_InfoInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const personal_info =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Personal_InfoInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Personal_InfoInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_personal_info(inputs) (inputs = {}, options = {}) => {
return zh_personal_info(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_personal_info(inputs)
return zh_personal_info(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Projects" | * | "Projects" |
* *
* @param {ProjectsInputs} inputs * @param {ProjectsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const projects: ((inputs?: ProjectsInputs, options?: { export const projects: ((
locale?: "en" | "zh"; inputs?: ProjectsInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<ProjectsInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type ProjectsInputs = {}; import('../runtime.js').MessageMetadata<
ProjectsInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type ProjectsInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} ProjectsInputs */ /** @typedef {{}} ProjectsInputs */
const en_projects = /** @type {(inputs: ProjectsInputs) => LocalizedString} */ () => { const en_projects = /** @type {(inputs: ProjectsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Projects`) return /** @type {LocalizedString} */ (`Projects`)
}; }
const zh_projects = /** @type {(inputs: ProjectsInputs) => LocalizedString} */ () => { const zh_projects = /** @type {(inputs: ProjectsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`项目`) return /** @type {LocalizedString} */ (`项目`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Projects" | * | "Projects" |
* *
* @param {ProjectsInputs} inputs * @param {ProjectsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const projects = /** @type {((inputs?: ProjectsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<ProjectsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const projects =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: ProjectsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<ProjectsInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_projects(inputs) (inputs = {}, options = {}) => {
return zh_projects(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_projects(inputs)
return zh_projects(inputs)
}
)
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Items are automatically deleted after 30 days." | * | "Items are automatically deleted after 30 days." |
* *
* @param {Recently_Deleted_NoticeInputs} inputs * @param {Recently_Deleted_NoticeInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const recently_deleted_notice: ((inputs?: Recently_Deleted_NoticeInputs, options?: { export const recently_deleted_notice: ((
locale?: "en" | "zh"; inputs?: Recently_Deleted_NoticeInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Recently_Deleted_NoticeInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Recently_Deleted_NoticeInputs = {}; import('../runtime.js').MessageMetadata<
Recently_Deleted_NoticeInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Recently_Deleted_NoticeInputs = {}
@@ -1,29 +1,34 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Recently_Deleted_NoticeInputs */ /** @typedef {{}} Recently_Deleted_NoticeInputs */
const en_recently_deleted_notice = /** @type {(inputs: Recently_Deleted_NoticeInputs) => LocalizedString} */ () => { const en_recently_deleted_notice =
return /** @type {LocalizedString} */ (`Items are automatically deleted after 30 days.`) /** @type {(inputs: Recently_Deleted_NoticeInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`Items are automatically deleted after 30 days.`)
}
const zh_recently_deleted_notice = /** @type {(inputs: Recently_Deleted_NoticeInputs) => LocalizedString} */ () => { const zh_recently_deleted_notice =
return /** @type {LocalizedString} */ (`项目将在 30 天后自动删除。`) /** @type {(inputs: Recently_Deleted_NoticeInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`项目将在 30 天后自动删除。`)
}
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Items are automatically deleted after 30 days." | * | "Items are automatically deleted after 30 days." |
* *
* @param {Recently_Deleted_NoticeInputs} inputs * @param {Recently_Deleted_NoticeInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const recently_deleted_notice = /** @type {((inputs?: Recently_Deleted_NoticeInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Recently_Deleted_NoticeInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const recently_deleted_notice =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Recently_Deleted_NoticeInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Recently_Deleted_NoticeInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_recently_deleted_notice(inputs) (inputs = {}, options = {}) => {
return zh_recently_deleted_notice(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_recently_deleted_notice(inputs)
return zh_recently_deleted_notice(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Select a Team" | * | "Select a Team" |
* *
* @param {Select_A_TeamInputs} inputs * @param {Select_A_TeamInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const select_a_team: ((inputs?: Select_A_TeamInputs, options?: { export const select_a_team: ((
locale?: "en" | "zh"; inputs?: Select_A_TeamInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Select_A_TeamInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Select_A_TeamInputs = {}; import('../runtime.js').MessageMetadata<
Select_A_TeamInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Select_A_TeamInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Select_A_TeamInputs */ /** @typedef {{}} Select_A_TeamInputs */
const en_select_a_team = /** @type {(inputs: Select_A_TeamInputs) => LocalizedString} */ () => { const en_select_a_team = /** @type {(inputs: Select_A_TeamInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Select a Team`) return /** @type {LocalizedString} */ (`Select a Team`)
}; }
const zh_select_a_team = /** @type {(inputs: Select_A_TeamInputs) => LocalizedString} */ () => { const zh_select_a_team = /** @type {(inputs: Select_A_TeamInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`选择团队`) return /** @type {LocalizedString} */ (`选择团队`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Select a Team" | * | "Select a Team" |
* *
* @param {Select_A_TeamInputs} inputs * @param {Select_A_TeamInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const select_a_team = /** @type {((inputs?: Select_A_TeamInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_A_TeamInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const select_a_team =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Select_A_TeamInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_A_TeamInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_select_a_team(inputs) (inputs = {}, options = {}) => {
return zh_select_a_team(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_select_a_team(inputs)
return zh_select_a_team(inputs)
}
)
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Select an asset to view details" | * | "Select an asset to view details" |
* *
* @param {Select_Asset_To_View_DetailsInputs} inputs * @param {Select_Asset_To_View_DetailsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const select_asset_to_view_details: ((inputs?: Select_Asset_To_View_DetailsInputs, options?: { export const select_asset_to_view_details: ((
locale?: "en" | "zh"; inputs?: Select_Asset_To_View_DetailsInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Select_Asset_To_View_DetailsInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Select_Asset_To_View_DetailsInputs = {}; import('../runtime.js').MessageMetadata<
Select_Asset_To_View_DetailsInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Select_Asset_To_View_DetailsInputs = {}
@@ -1,29 +1,34 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Select_Asset_To_View_DetailsInputs */ /** @typedef {{}} Select_Asset_To_View_DetailsInputs */
const en_select_asset_to_view_details = /** @type {(inputs: Select_Asset_To_View_DetailsInputs) => LocalizedString} */ () => { const en_select_asset_to_view_details =
return /** @type {LocalizedString} */ (`Select an asset to view details`) /** @type {(inputs: Select_Asset_To_View_DetailsInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`Select an asset to view details`)
}
const zh_select_asset_to_view_details = /** @type {(inputs: Select_Asset_To_View_DetailsInputs) => LocalizedString} */ () => { const zh_select_asset_to_view_details =
return /** @type {LocalizedString} */ (`选择资产查看详情`) /** @type {(inputs: Select_Asset_To_View_DetailsInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`选择资产查看详情`)
}
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Select an asset to view details" | * | "Select an asset to view details" |
* *
* @param {Select_Asset_To_View_DetailsInputs} inputs * @param {Select_Asset_To_View_DetailsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const select_asset_to_view_details = /** @type {((inputs?: Select_Asset_To_View_DetailsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_Asset_To_View_DetailsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const select_asset_to_view_details =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Select_Asset_To_View_DetailsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_Asset_To_View_DetailsInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_select_asset_to_view_details(inputs) (inputs = {}, options = {}) => {
return zh_select_asset_to_view_details(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_select_asset_to_view_details(inputs)
return zh_select_asset_to_view_details(inputs)
}
)
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Select your preferred display language." | * | "Select your preferred display language." |
* *
* @param {Select_Preferred_LanguageInputs} inputs * @param {Select_Preferred_LanguageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const select_preferred_language: ((inputs?: Select_Preferred_LanguageInputs, options?: { export const select_preferred_language: ((
locale?: "en" | "zh"; inputs?: Select_Preferred_LanguageInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Select_Preferred_LanguageInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Select_Preferred_LanguageInputs = {}; import('../runtime.js').MessageMetadata<
Select_Preferred_LanguageInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Select_Preferred_LanguageInputs = {}
@@ -1,29 +1,34 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Select_Preferred_LanguageInputs */ /** @typedef {{}} Select_Preferred_LanguageInputs */
const en_select_preferred_language = /** @type {(inputs: Select_Preferred_LanguageInputs) => LocalizedString} */ () => { const en_select_preferred_language =
return /** @type {LocalizedString} */ (`Select your preferred display language.`) /** @type {(inputs: Select_Preferred_LanguageInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`Select your preferred display language.`)
}
const zh_select_preferred_language = /** @type {(inputs: Select_Preferred_LanguageInputs) => LocalizedString} */ () => { const zh_select_preferred_language =
return /** @type {LocalizedString} */ (`选择您首选的显示语言。`) /** @type {(inputs: Select_Preferred_LanguageInputs) => LocalizedString} */ () => {
}; return /** @type {LocalizedString} */ (`选择您首选的显示语言。`)
}
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Select your preferred display language." | * | "Select your preferred display language." |
* *
* @param {Select_Preferred_LanguageInputs} inputs * @param {Select_Preferred_LanguageInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const select_preferred_language = /** @type {((inputs?: Select_Preferred_LanguageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_Preferred_LanguageInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const select_preferred_language =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Select_Preferred_LanguageInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Select_Preferred_LanguageInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_select_preferred_language(inputs) (inputs = {}, options = {}) => {
return zh_select_preferred_language(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_select_preferred_language(inputs)
return zh_select_preferred_language(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Settings" | * | "Settings" |
* *
* @param {SettingsInputs} inputs * @param {SettingsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const settings: ((inputs?: SettingsInputs, options?: { export const settings: ((
locale?: "en" | "zh"; inputs?: SettingsInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<SettingsInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type SettingsInputs = {}; import('../runtime.js').MessageMetadata<
SettingsInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type SettingsInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} SettingsInputs */ /** @typedef {{}} SettingsInputs */
const en_settings = /** @type {(inputs: SettingsInputs) => LocalizedString} */ () => { const en_settings = /** @type {(inputs: SettingsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Settings`) return /** @type {LocalizedString} */ (`Settings`)
}; }
const zh_settings = /** @type {(inputs: SettingsInputs) => LocalizedString} */ () => { const zh_settings = /** @type {(inputs: SettingsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`设置`) return /** @type {LocalizedString} */ (`设置`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Settings" | * | "Settings" |
* *
* @param {SettingsInputs} inputs * @param {SettingsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const settings = /** @type {((inputs?: SettingsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<SettingsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const settings =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: SettingsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<SettingsInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_settings(inputs) (inputs = {}, options = {}) => {
return zh_settings(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_settings(inputs)
return zh_settings(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Uploads" | * | "Uploads" |
* *
* @param {UploadsInputs} inputs * @param {UploadsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const uploads: ((inputs?: UploadsInputs, options?: { export const uploads: ((
locale?: "en" | "zh"; inputs?: UploadsInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<UploadsInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type UploadsInputs = {}; import('../runtime.js').MessageMetadata<
UploadsInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type UploadsInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} UploadsInputs */ /** @typedef {{}} UploadsInputs */
const en_uploads = /** @type {(inputs: UploadsInputs) => LocalizedString} */ () => { const en_uploads = /** @type {(inputs: UploadsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Uploads`) return /** @type {LocalizedString} */ (`Uploads`)
}; }
const zh_uploads = /** @type {(inputs: UploadsInputs) => LocalizedString} */ () => { const zh_uploads = /** @type {(inputs: UploadsInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`上传管理`) return /** @type {LocalizedString} */ (`上传管理`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Uploads" | * | "Uploads" |
* *
* @param {UploadsInputs} inputs * @param {UploadsInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const uploads = /** @type {((inputs?: UploadsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<UploadsInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const uploads =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: UploadsInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<UploadsInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_uploads(inputs) (inputs = {}, options = {}) => {
return zh_uploads(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_uploads(inputs)
return zh_uploads(inputs)
}
)
+23 -15
View File
@@ -1,16 +1,24 @@
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Welcome Back" | * | "Welcome Back" |
* *
* @param {Welcome_BackInputs} inputs * @param {Welcome_BackInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const welcome_back: ((inputs?: Welcome_BackInputs, options?: { export const welcome_back: ((
locale?: "en" | "zh"; inputs?: Welcome_BackInputs,
}) => LocalizedString) & import("../runtime.js").MessageMetadata<Welcome_BackInputs, { options?: {
locale?: "en" | "zh"; locale?: 'en' | 'zh'
}, {}>; },
export type LocalizedString = import("../runtime.js").LocalizedString; ) => LocalizedString) &
export type Welcome_BackInputs = {}; import('../runtime.js').MessageMetadata<
Welcome_BackInputs,
{
locale?: 'en' | 'zh'
},
{}
>
export type LocalizedString = import('../runtime.js').LocalizedString
export type Welcome_BackInputs = {}
@@ -1,29 +1,32 @@
/* eslint-disable */ /* eslint-disable */
import { getLocale, experimentalStaticLocale } from '../runtime.js'; import { getLocale, experimentalStaticLocale } from '../runtime.js'
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */ /** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
/** @typedef {{}} Welcome_BackInputs */ /** @typedef {{}} Welcome_BackInputs */
const en_welcome_back = /** @type {(inputs: Welcome_BackInputs) => LocalizedString} */ () => { const en_welcome_back = /** @type {(inputs: Welcome_BackInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`Welcome Back`) return /** @type {LocalizedString} */ (`Welcome Back`)
}; }
const zh_welcome_back = /** @type {(inputs: Welcome_BackInputs) => LocalizedString} */ () => { const zh_welcome_back = /** @type {(inputs: Welcome_BackInputs) => LocalizedString} */ () => {
return /** @type {LocalizedString} */ (`欢迎回来`) return /** @type {LocalizedString} */ (`欢迎回来`)
}; }
/** /**
* | output | * | output |
* | --- | * | --- |
* | "Welcome Back" | * | "Welcome Back" |
* *
* @param {Welcome_BackInputs} inputs * @param {Welcome_BackInputs} inputs
* @param {{ locale?: "en" | "zh" }} options * @param {{ locale?: "en" | "zh" }} options
* @returns {LocalizedString} * @returns {LocalizedString}
*/ */
export const welcome_back = /** @type {((inputs?: Welcome_BackInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Welcome_BackInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs = {}, options = {}) => { export const welcome_back =
const locale = experimentalStaticLocale ?? options.locale ?? getLocale() /** @type {((inputs?: Welcome_BackInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Welcome_BackInputs, { locale?: "en" | "zh" }, {}>} */ (
if (locale === "en") return en_welcome_back(inputs) (inputs = {}, options = {}) => {
return zh_welcome_back(inputs) const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
}); if (locale === 'en') return en_welcome_back(inputs)
return zh_welcome_back(inputs)
}
)
+39 -7
View File
@@ -7,28 +7,60 @@
* @param {Intl.PluralRulesOptions} [options] * @param {Intl.PluralRulesOptions} [options]
* @returns {string} * @returns {string}
*/ */
export function plural(locale: import("./runtime.js").Locale, input: unknown, options?: Intl.PluralRulesOptions): string; export function plural(
locale: import('./runtime.js').Locale,
input: unknown,
options?: Intl.PluralRulesOptions,
): string
/** /**
* @param {import("./runtime.js").Locale} locale * @param {import("./runtime.js").Locale} locale
* @param {unknown} input * @param {unknown} input
* @param {Intl.NumberFormatOptions} [options] * @param {Intl.NumberFormatOptions} [options]
* @returns {string} * @returns {string}
*/ */
export function number(locale: import("./runtime.js").Locale, input: unknown, options?: Intl.NumberFormatOptions): string; export function number(
locale: import('./runtime.js').Locale,
input: unknown,
options?: Intl.NumberFormatOptions,
): string
/** /**
* @param {import("./runtime.js").Locale} locale * @param {import("./runtime.js").Locale} locale
* @param {unknown} input * @param {unknown} input
* @param {Intl.DateTimeFormatOptions} [options] * @param {Intl.DateTimeFormatOptions} [options]
* @returns {string} * @returns {string}
*/ */
export function datetime(locale: import("./runtime.js").Locale, input: unknown, options?: Intl.DateTimeFormatOptions): string; export function datetime(
locale: import('./runtime.js').Locale,
input: unknown,
options?: Intl.DateTimeFormatOptions,
): string
/** /**
* @param {import("./runtime.js").Locale} locale * @param {import("./runtime.js").Locale} locale
* @param {unknown} input * @param {unknown} input
* @param {Intl.RelativeTimeFormatOptions & { unit: RelativeTimeFormatUnit }} options * @param {Intl.RelativeTimeFormatOptions & { unit: RelativeTimeFormatUnit }} options
* @returns {string} * @returns {string}
*/ */
export function relativetime(locale: import("./runtime.js").Locale, input: unknown, options: Intl.RelativeTimeFormatOptions & { export function relativetime(
unit: RelativeTimeFormatUnit; locale: import('./runtime.js').Locale,
}): string; input: unknown,
export type RelativeTimeFormatUnit = "year" | "years" | "quarter" | "quarters" | "month" | "months" | "week" | "weeks" | "day" | "days" | "hour" | "hours" | "minute" | "minutes" | "second" | "seconds"; options: Intl.RelativeTimeFormatOptions & {
unit: RelativeTimeFormatUnit
},
): string
export type RelativeTimeFormatUnit =
| 'year'
| 'years'
| 'quarter'
| 'quarters'
| 'month'
| 'months'
| 'week'
| 'weeks'
| 'day'
| 'days'
| 'hour'
| 'hours'
| 'minute'
| 'minutes'
| 'second'
| 'seconds'
+9 -9
View File
@@ -11,8 +11,8 @@
* @returns {string} * @returns {string}
*/ */
export function plural(locale, input, options) { export function plural(locale, input, options) {
return new Intl.PluralRules(locale, options).select(Number(input)) return new Intl.PluralRules(locale, options).select(Number(input))
}; }
/** /**
* @param {import("./runtime.js").Locale} locale * @param {import("./runtime.js").Locale} locale
@@ -21,8 +21,8 @@ export function plural(locale, input, options) {
* @returns {string} * @returns {string}
*/ */
export function number(locale, input, options) { export function number(locale, input, options) {
return new Intl.NumberFormat(locale, options).format(Number(input)) return new Intl.NumberFormat(locale, options).format(Number(input))
}; }
/** /**
* @param {import("./runtime.js").Locale} locale * @param {import("./runtime.js").Locale} locale
@@ -31,8 +31,8 @@ export function number(locale, input, options) {
* @returns {string} * @returns {string}
*/ */
export function datetime(locale, input, options) { export function datetime(locale, input, options) {
return new Intl.DateTimeFormat(locale, options).format(new Date(/** @type {string} */ (input))) return new Intl.DateTimeFormat(locale, options).format(new Date(/** @type {string} */ (input)))
}; }
/** /**
* @param {import("./runtime.js").Locale} locale * @param {import("./runtime.js").Locale} locale
@@ -41,6 +41,6 @@ export function datetime(locale, input, options) {
* @returns {string} * @returns {string}
*/ */
export function relativetime(locale, input, options) { export function relativetime(locale, input, options) {
const { unit, ...intlOptions } = options; const { unit, ...intlOptions } = options
return new Intl.RelativeTimeFormat(locale, intlOptions).format(Number(input), unit); return new Intl.RelativeTimeFormat(locale, intlOptions).format(Number(input), unit)
}; }
+223 -158
View File
@@ -7,14 +7,14 @@
* @param {string | URL} url * @param {string | URL} url
* @returns {typeof strategy} * @returns {typeof strategy}
*/ */
export function getStrategyForUrl(url: string | URL): typeof strategy; export function getStrategyForUrl(url: string | URL): typeof strategy
/** /**
* Returns whether the given URL is excluded from middleware i18n processing. * Returns whether the given URL is excluded from middleware i18n processing.
* *
* @param {string | URL} url * @param {string | URL} url
* @returns {boolean} * @returns {boolean}
*/ */
export function isExcludedByRouteStrategy(url: string | URL): boolean; export function isExcludedByRouteStrategy(url: string | URL): boolean
/** /**
* Sets the server side async local storage. * Sets the server side async local storage.
* *
@@ -25,14 +25,16 @@ export function isExcludedByRouteStrategy(url: string | URL): boolean;
* *
* @param {ParaglideAsyncLocalStorage | undefined} value * @param {ParaglideAsyncLocalStorage | undefined} value
*/ */
export function overwriteServerAsyncLocalStorage(value: ParaglideAsyncLocalStorage | undefined): void; export function overwriteServerAsyncLocalStorage(
value: ParaglideAsyncLocalStorage | undefined,
): void
/** /**
* Resolve locale for a given URL using route-aware strategies. * Resolve locale for a given URL using route-aware strategies.
* *
* @param {string | URL} url * @param {string | URL} url
* @returns {Locale} * @returns {Locale}
*/ */
export function getLocaleForUrl(url: string | URL): Locale; export function getLocaleForUrl(url: string | URL): Locale
/** /**
* Get writing direction for a locale. * Get writing direction for a locale.
* *
@@ -47,14 +49,14 @@ export function getLocaleForUrl(url: string | URL): Locale;
* @param {string} [locale] - Target locale. If not provided, uses `getLocale()` * @param {string} [locale] - Target locale. If not provided, uses `getLocale()`
* @returns {"ltr" | "rtl"} * @returns {"ltr" | "rtl"}
*/ */
export function getTextDirection(locale?: string): "ltr" | "rtl"; export function getTextDirection(locale?: string): 'ltr' | 'rtl'
/** /**
* Coerces a locale-like string to the canonical locale value used by the runtime. * Coerces a locale-like string to the canonical locale value used by the runtime.
* *
* @param {unknown} value * @param {unknown} value
* @returns {Locale | undefined} * @returns {Locale | undefined}
*/ */
export function toLocale(value: unknown): Locale | undefined; export function toLocale(value: unknown): Locale | undefined
/** /**
* Check if something is an available locale with the canonical project casing. * Check if something is an available locale with the canonical project casing.
* *
@@ -70,7 +72,7 @@ export function toLocale(value: unknown): Locale | undefined;
* @param {unknown} locale * @param {unknown} locale
* @returns {locale is Locale} * @returns {locale is Locale}
*/ */
export function isLocale(locale: unknown): locale is Locale; export function isLocale(locale: unknown): locale is Locale
/** /**
* Asserts that the input can be normalized to a locale. * Asserts that the input can be normalized to a locale.
* *
@@ -78,7 +80,7 @@ export function isLocale(locale: unknown): locale is Locale;
* @returns {Locale} The input normalized to a Locale. * @returns {Locale} The input normalized to a Locale.
* @throws {Error} If the input is not a locale. * @throws {Error} If the input is not a locale.
*/ */
export function assertIsLocale(input: unknown): Locale; export function assertIsLocale(input: unknown): Locale
/** /**
* Extracts a cookie from the document. * Extracts a cookie from the document.
* *
@@ -87,7 +89,7 @@ export function assertIsLocale(input: unknown): Locale;
* *
* @returns {Locale | undefined} * @returns {Locale | undefined}
*/ */
export function extractLocaleFromCookie(): Locale | undefined; export function extractLocaleFromCookie(): Locale | undefined
/** /**
* Extracts a locale from the accept-language header. * Extracts a locale from the accept-language header.
* *
@@ -100,7 +102,7 @@ export function extractLocaleFromCookie(): Locale | undefined;
* @param {Request} request - The request object to extract the locale from. * @param {Request} request - The request object to extract the locale from.
* @returns {Locale | undefined} The negotiated preferred language. * @returns {Locale | undefined} The negotiated preferred language.
*/ */
export function extractLocaleFromHeader(request: Request): Locale | undefined; export function extractLocaleFromHeader(request: Request): Locale | undefined
/** /**
* Negotiates a preferred language from navigator.languages. * Negotiates a preferred language from navigator.languages.
* *
@@ -112,7 +114,7 @@ export function extractLocaleFromHeader(request: Request): Locale | undefined;
* *
* @returns {Locale | undefined} * @returns {Locale | undefined}
*/ */
export function extractLocaleFromNavigator(): Locale | undefined; export function extractLocaleFromNavigator(): Locale | undefined
/** /**
* Extracts the locale from a given URL using native URLPattern. * Extracts the locale from a given URL using native URLPattern.
* *
@@ -123,7 +125,7 @@ export function extractLocaleFromNavigator(): Locale | undefined;
* @param {URL|string} url - The full URL from which to extract the locale. * @param {URL|string} url - The full URL from which to extract the locale.
* @returns {Locale|undefined} The extracted locale, or undefined if no locale is found. * @returns {Locale|undefined} The extracted locale, or undefined if no locale is found.
*/ */
export function extractLocaleFromUrl(url: URL | string): Locale | undefined; export function extractLocaleFromUrl(url: URL | string): Locale | undefined
/** /**
* Lower-level URL localization function, primarily used in server contexts. * Lower-level URL localization function, primarily used in server contexts.
* *
@@ -168,9 +170,12 @@ export function extractLocaleFromUrl(url: URL | string): Locale | undefined;
* @param {Locale} [options.locale] - Target locale. If not provided, uses getLocale() * @param {Locale} [options.locale] - Target locale. If not provided, uses getLocale()
* @returns {URL} The localized URL, always absolute * @returns {URL} The localized URL, always absolute
*/ */
export function localizeUrl(url: string | URL, options?: { export function localizeUrl(
locale?: Locale; url: string | URL,
}): URL; options?: {
locale?: Locale
},
): URL
/** /**
* Low-level URL de-localization function, primarily used in server contexts. * Low-level URL de-localization function, primarily used in server contexts.
* *
@@ -210,7 +215,7 @@ export function localizeUrl(url: string | URL, options?: {
* @param {string | URL} url - The URL to de-localize. If string, must be absolute. * @param {string | URL} url - The URL to de-localize. If string, must be absolute.
* @returns {URL} The de-localized URL, always absolute * @returns {URL} The de-localized URL, always absolute
*/ */
export function deLocalizeUrl(url: string | URL): URL; export function deLocalizeUrl(url: string | URL): URL
/** /**
* Aggregates named groups from various parts of the URLPattern match result. * Aggregates named groups from various parts of the URLPattern match result.
* *
@@ -218,7 +223,7 @@ export function deLocalizeUrl(url: string | URL): URL;
* @param {any} match - The URLPattern match result object. * @param {any} match - The URLPattern match result object.
* @returns {Record<string, string | null | undefined>} An object containing all named groups from the match. * @returns {Record<string, string | null | undefined>} An object containing all named groups from the match.
*/ */
export function aggregateGroups(match: any): Record<string, string | null | undefined>; export function aggregateGroups(match: any): Record<string, string | null | undefined>
/** /**
* @typedef {object} ShouldRedirectServerInput * @typedef {object} ShouldRedirectServerInput
* @property {Request} request * @property {Request} request
@@ -290,7 +295,7 @@ export function aggregateGroups(match: any): Record<string, string | null | unde
* @param {ShouldRedirectInput} [input] * @param {ShouldRedirectInput} [input]
* @returns {Promise<ShouldRedirectResult>} * @returns {Promise<ShouldRedirectResult>}
*/ */
export function shouldRedirect(input?: ShouldRedirectInput): Promise<ShouldRedirectResult>; export function shouldRedirect(input?: ShouldRedirectInput): Promise<ShouldRedirectResult>
/** /**
* High-level URL localization function optimized for client-side UI usage. * High-level URL localization function optimized for client-side UI usage.
* *
@@ -331,9 +336,12 @@ export function shouldRedirect(input?: ShouldRedirectInput): Promise<ShouldRedir
* @param {Locale} [options.locale] - Target locale. If not provided, uses `getLocale()` * @param {Locale} [options.locale] - Target locale. If not provided, uses `getLocale()`
* @returns {string} The localized href, relative if input was relative * @returns {string} The localized href, relative if input was relative
*/ */
export function localizeHref(href: string, options?: { export function localizeHref(
locale?: Locale; href: string,
}): string; options?: {
locale?: Locale
},
): string
/** /**
* High-level URL de-localization function optimized for client-side UI usage. * High-level URL de-localization function optimized for client-side UI usage.
* *
@@ -374,12 +382,12 @@ export function localizeHref(href: string, options?: {
* @param {string} href - The href to de-localize (can be relative or absolute) * @param {string} href - The href to de-localize (can be relative or absolute)
* @returns {string} The de-localized href, relative if input was relative * @returns {string} The de-localized href, relative if input was relative
*/ */
export function deLocalizeHref(href: string): string; export function deLocalizeHref(href: string): string
/** /**
* @param {string} safeModuleId * @param {string} safeModuleId
* @param {Locale} locale * @param {Locale} locale
*/ */
export function trackMessageCall(safeModuleId: string, locale: Locale): void; export function trackMessageCall(safeModuleId: string, locale: Locale): void
/** /**
* Generates localized URL variants for all provided URLs based on your configured locales and URL patterns. * Generates localized URL variants for all provided URLs based on your configured locales and URL patterns.
* *
@@ -423,7 +431,7 @@ export function trackMessageCall(safeModuleId: string, locale: Locale): void;
* @returns {URL[]} Array of URL objects representing all localized variants. * @returns {URL[]} Array of URL objects representing all localized variants.
* The order follows each input URL with all its locale variants before moving to the next URL. * The order follows each input URL with all its locale variants before moving to the next URL.
*/ */
export function generateStaticLocalizedUrls(urls: (string | URL)[]): URL[]; export function generateStaticLocalizedUrls(urls: (string | URL)[]): URL[]
/** /**
* Checks if the given strategy is a custom strategy. * Checks if the given strategy is a custom strategy.
* *
@@ -431,7 +439,7 @@ export function generateStaticLocalizedUrls(urls: (string | URL)[]): URL[];
* Must be a string that starts with "custom-" followed by alphanumeric characters, hyphens, or underscores. * Must be a string that starts with "custom-" followed by alphanumeric characters, hyphens, or underscores.
* @returns {boolean} Returns true if it is a custom strategy, false otherwise. * @returns {boolean} Returns true if it is a custom strategy, false otherwise.
*/ */
export function isCustomStrategy(strategy: unknown): boolean; export function isCustomStrategy(strategy: unknown): boolean
/** /**
* Defines a custom strategy that is executed on the server. * Defines a custom strategy that is executed on the server.
* *
@@ -442,7 +450,10 @@ export function isCustomStrategy(strategy: unknown): boolean;
* the method getLocale. * the method getLocale.
* @returns {void} * @returns {void}
*/ */
export function defineCustomServerStrategy(strategy: string, handler: CustomServerStrategyHandler): void; export function defineCustomServerStrategy(
strategy: string,
handler: CustomServerStrategyHandler,
): void
/** /**
* Defines a custom strategy that is executed on the client. * Defines a custom strategy that is executed on the client.
* *
@@ -453,7 +464,10 @@ export function defineCustomServerStrategy(strategy: string, handler: CustomServ
* methods getLocale and setLocale. * methods getLocale and setLocale.
* @returns {void} * @returns {void}
*/ */
export function defineCustomClientStrategy(strategy: string, handler: CustomClientStrategyHandler): void; export function defineCustomClientStrategy(
strategy: string,
handler: CustomClientStrategyHandler,
): void
/** /**
* The project's base locale. * The project's base locale.
* *
@@ -462,7 +476,7 @@ export function defineCustomClientStrategy(strategy: string, handler: CustomClie
* // do something * // do something
* } * }
*/ */
export const baseLocale: "en"; export const baseLocale: 'en'
/** /**
* The project's locales that have been specified in the settings. * The project's locales that have been specified in the settings.
* *
@@ -471,19 +485,27 @@ export const baseLocale: "en";
* throw new Error('Locale is not available'); * throw new Error('Locale is not available');
* } * }
*/ */
export const locales: readonly ["en", "zh"]; export const locales: readonly ['en', 'zh']
/** @type {string} */ /** @type {string} */
export const cookieName: string; export const cookieName: string
/** @type {number} */ /** @type {number} */
export const cookieMaxAge: number; export const cookieMaxAge: number
/** @type {string} */ /** @type {string} */
export const cookieDomain: string; export const cookieDomain: string
/** @type {string} */ /** @type {string} */
export const localStorageKey: string; export const localStorageKey: string
/** /**
* @type {Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>} * @type {Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>}
*/ */
export const strategy: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>; export const strategy: Array<
| 'cookie'
| 'baseLocale'
| 'globalVariable'
| 'url'
| 'preferredLanguage'
| 'localStorage'
| `custom-${string}`
>
/** /**
* Route-level strategy overrides. * Route-level strategy overrides.
* *
@@ -496,19 +518,27 @@ export const strategy: Array<"cookie" | "baseLocale" | "globalVariable" | "url"
* }>} * }>}
*/ */
export const routeStrategies: Array<{ export const routeStrategies: Array<{
match: string; match: string
strategy?: Array<"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage" | `custom-${string}`>; strategy?: Array<
exclude?: boolean; | 'cookie'
}>; | 'baseLocale'
| 'globalVariable'
| 'url'
| 'preferredLanguage'
| 'localStorage'
| `custom-${string}`
>
exclude?: boolean
}>
/** /**
* The used URL patterns. * The used URL patterns.
* *
* @type {Array<{ pattern: string, localized: Array<[Locale, string]> }>} * @type {Array<{ pattern: string, localized: Array<[Locale, string]> }>}
*/ */
export const urlPatterns: Array<{ export const urlPatterns: Array<{
pattern: string; pattern: string
localized: Array<[Locale, string]>; localized: Array<[Locale, string]>
}>; }>
/** /**
* @typedef {{ * @typedef {{
* getStore(): { * getStore(): {
@@ -528,14 +558,14 @@ export const urlPatterns: Array<{
* *
* @type {ParaglideAsyncLocalStorage | undefined} * @type {ParaglideAsyncLocalStorage | undefined}
*/ */
export let serverAsyncLocalStorage: ParaglideAsyncLocalStorage | undefined; export let serverAsyncLocalStorage: ParaglideAsyncLocalStorage | undefined
export const disableAsyncLocalStorage: false; export const disableAsyncLocalStorage: false
export const experimentalMiddlewareLocaleSplitting: false; export const experimentalMiddlewareLocaleSplitting: false
export const isServer: boolean; export const isServer: boolean
/** @type {Locale | undefined} */ /** @type {Locale | undefined} */
export const experimentalStaticLocale: Locale | undefined; export const experimentalStaticLocale: Locale | undefined
export function getLocale(): Locale; export function getLocale(): Locale
export function overwriteGetLocale(fn: () => Locale): void; export function overwriteGetLocale(fn: () => Locale): void
/** /**
* @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn * @typedef {(newLocale: Locale, options?: { reload?: boolean }) => void | Promise<void>} SetLocaleFn
*/ */
@@ -560,8 +590,8 @@ export function overwriteGetLocale(fn: () => Locale): void;
* *
* @type {SetLocaleFn} * @type {SetLocaleFn}
*/ */
export let setLocale: SetLocaleFn; export let setLocale: SetLocaleFn
export function overwriteSetLocale(fn: SetLocaleFn): void; export function overwriteSetLocale(fn: SetLocaleFn): void
/** /**
* The origin of the current URL. * The origin of the current URL.
* *
@@ -571,13 +601,23 @@ export function overwriteSetLocale(fn: SetLocaleFn): void;
* *
* @type {() => string} * @type {() => string}
*/ */
export let getUrlOrigin: () => string; export let getUrlOrigin: () => string
export function overwriteGetUrlOrigin(fn: () => string): void; export function overwriteGetUrlOrigin(fn: () => string): void
export function extractLocaleFromRequest(request: Request, options?: ExtractLocaleFromRequestOptions): Locale; export function extractLocaleFromRequest(
export function extractLocaleFromRequestWithStrategies(request: Request, strategies: typeof strategy, url?: string | URL): Locale; request: Request,
export function extractLocaleFromRequestAsync(request: Request, options?: { options?: ExtractLocaleFromRequestOptions,
effectiveRequestUrl?: string | URL; ): Locale
}): Promise<Locale>; export function extractLocaleFromRequestWithStrategies(
request: Request,
strategies: typeof strategy,
url?: string | URL,
): Locale
export function extractLocaleFromRequestAsync(
request: Request,
options?: {
effectiveRequestUrl?: string | URL
},
): Promise<Locale>
/** /**
* @typedef {"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"} BuiltInStrategy * @typedef {"cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"} BuiltInStrategy
*/ */
@@ -597,73 +637,87 @@ export function extractLocaleFromRequestAsync(request: Request, options?: {
* @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler * @typedef {{ getLocale: () => Promise<string|undefined> | (string | undefined), setLocale: (locale: string) => Promise<void> | void }} CustomClientStrategyHandler
*/ */
/** @type {Map<string, CustomServerStrategyHandler>} */ /** @type {Map<string, CustomServerStrategyHandler>} */
export const customServerStrategies: Map<string, CustomServerStrategyHandler>; export const customServerStrategies: Map<string, CustomServerStrategyHandler>
/** @type {Map<string, CustomClientStrategyHandler>} */ /** @type {Map<string, CustomClientStrategyHandler>} */
export const customClientStrategies: Map<string, CustomClientStrategyHandler>; export const customClientStrategies: Map<string, CustomClientStrategyHandler>
export type ShouldRedirectServerInput = { export type ShouldRedirectServerInput = {
request: Request; request: Request
/** /**
* - Effective request URL to use for route matching, locale detection with the URL strategy, and redirect targets. * - Effective request URL to use for route matching, locale detection with the URL strategy, and redirect targets.
*/ */
effectiveRequestUrl?: string | URL; effectiveRequestUrl?: string | URL
locale?: Locale; locale?: Locale
}; }
export type ShouldRedirectClientInput = { export type ShouldRedirectClientInput = {
request?: undefined; request?: undefined
url?: string | URL; url?: string | URL
locale?: Locale; locale?: Locale
}; }
export type ShouldRedirectInput = ShouldRedirectServerInput | ShouldRedirectClientInput; export type ShouldRedirectInput = ShouldRedirectServerInput | ShouldRedirectClientInput
export type ShouldRedirectResult = { export type ShouldRedirectResult = {
/** /**
* - Indicates whether the consumer should perform a redirect. * - Indicates whether the consumer should perform a redirect.
*/ */
shouldRedirect: boolean; shouldRedirect: boolean
/** /**
* - Locale resolved using the configured strategies. * - Locale resolved using the configured strategies.
*/ */
locale: Locale; locale: Locale
/** /**
* - Destination URL when a redirect is required. * - Destination URL when a redirect is required.
*/ */
redirectUrl: URL | undefined; redirectUrl: URL | undefined
}; }
export type ParaglideAsyncLocalStorage = { export type ParaglideAsyncLocalStorage = {
getStore(): { getStore():
locale?: Locale; | {
origin?: string; locale?: Locale
messageCalls?: Set<string>; origin?: string
} | undefined; messageCalls?: Set<string>
run: (store: { }
locale?: Locale; | undefined
origin?: string; run: (
messageCalls?: Set<string>; store: {
}, cb: any) => any; locale?: Locale
}; origin?: string
export type SetLocaleFn = (newLocale: Locale, options?: { messageCalls?: Set<string>
reload?: boolean; },
}) => void | Promise<void>; cb: any,
) => any
}
export type SetLocaleFn = (
newLocale: Locale,
options?: {
reload?: boolean
},
) => void | Promise<void>
export type ExtractLocaleFromRequestOptions = { export type ExtractLocaleFromRequestOptions = {
/** /**
* - Effective request URL to use for route matching and locale detection with the URL strategy. * - Effective request URL to use for route matching and locale detection with the URL strategy.
*/ */
effectiveRequestUrl?: string | URL; effectiveRequestUrl?: string | URL
}; }
export type BuiltInStrategy = "cookie" | "baseLocale" | "globalVariable" | "url" | "preferredLanguage" | "localStorage"; export type BuiltInStrategy =
export type CustomStrategy = `custom_${string}`; | 'cookie'
export type Strategy = BuiltInStrategy | CustomStrategy; | 'baseLocale'
export type Strategies = Array<Strategy>; | 'globalVariable'
| 'url'
| 'preferredLanguage'
| 'localStorage'
export type CustomStrategy = `custom_${string}`
export type Strategy = BuiltInStrategy | CustomStrategy
export type Strategies = Array<Strategy>
export type CustomServerStrategyHandler = { export type CustomServerStrategyHandler = {
getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined); getLocale: (request?: Request) => Promise<string | undefined> | (string | undefined)
}; }
export type CustomClientStrategyHandler = { export type CustomClientStrategyHandler = {
getLocale: () => Promise<string | undefined> | (string | undefined); getLocale: () => Promise<string | undefined> | (string | undefined)
setLocale: (locale: string) => Promise<void> | void; setLocale: (locale: string) => Promise<void> | void
}; }
/** /**
* A locale that is available in the project. * A locale that is available in the project.
*/ */
export type Locale = (typeof locales)[number]; export type Locale = (typeof locales)[number]
/** /**
* A branded type representing a localized string. * A branded type representing a localized string.
* *
@@ -676,83 +730,94 @@ export type Locale = (typeof locales)[number];
* backward compatible—you can pass it anywhere a \`string\` is expected. * backward compatible—you can pass it anywhere a \`string\` is expected.
*/ */
export type LocalizedString = string & { export type LocalizedString = string & {
readonly __brand: "LocalizedString"; readonly __brand: 'LocalizedString'
}; }
/** /**
* A single markup option passed to a tag instance. * A single markup option passed to a tag instance.
*/ */
export type MessageMarkupOption = { export type MessageMarkupOption = {
name: string; name: string
value: unknown; value: unknown
}; }
/** /**
* A single static markup attribute attached to a tag instance. * A single static markup attribute attached to a tag instance.
*/ */
export type MessageMarkupAttribute = { export type MessageMarkupAttribute = {
name: string; name: string
value: string | true; value: string | true
}; }
/** /**
* Record of markup options for a tag instance. * Record of markup options for a tag instance.
*/ */
export type MessageMarkupOptions = Record<string, unknown>; export type MessageMarkupOptions = Record<string, unknown>
/** /**
* Record of markup attributes for a tag instance. * Record of markup attributes for a tag instance.
*/ */
export type MessageMarkupAttributes = Record<string, string | true>; export type MessageMarkupAttributes = Record<string, string | true>
/** /**
* Type-level schema for a single markup tag. * Type-level schema for a single markup tag.
*/ */
export type MessageMarkupTag = { export type MessageMarkupTag = {
options: MessageMarkupOptions; options: MessageMarkupOptions
attributes: MessageMarkupAttributes; attributes: MessageMarkupAttributes
children: boolean; children: boolean
}; }
/** /**
* Type-level schema for all markup tags in a message. * Type-level schema for all markup tags in a message.
*/ */
export type MessageMarkupSchema = Record<string, MessageMarkupTag>; export type MessageMarkupSchema = Record<string, MessageMarkupTag>
/** /**
* Type-only metadata attached to compiled message functions. * Type-only metadata attached to compiled message functions.
*/ */
export type MessageMetadata<Inputs, Options, Markup extends MessageMarkupSchema = Record<string, MessageMarkupTag>> = { export type MessageMetadata<
readonly __paraglide?: { Inputs,
inputs: Inputs; Options,
options: Options; Markup extends MessageMarkupSchema = Record<string, MessageMarkupTag>,
markup: Markup; > = {
}; readonly __paraglide?: {
}; inputs: Inputs
options: Options
markup: Markup
}
}
/** /**
* A compiled, framework-neutral message part. * A compiled, framework-neutral message part.
*/ */
export type MessagePart = { export type MessagePart =
type: "text"; | {
value: string; type: 'text'
} | { value: string
type: "markup-start"; }
name: string; | {
options: MessageMarkupOptions; type: 'markup-start'
attributes: MessageMarkupAttributes; name: string
} | { options: MessageMarkupOptions
type: "markup-end"; attributes: MessageMarkupAttributes
name: string; }
options: MessageMarkupOptions; | {
attributes: MessageMarkupAttributes; type: 'markup-end'
} | { name: string
type: "markup-standalone"; options: MessageMarkupOptions
name: string; attributes: MessageMarkupAttributes
options: MessageMarkupOptions; }
attributes: MessageMarkupAttributes; | {
}; type: 'markup-standalone'
name: string
options: MessageMarkupOptions
attributes: MessageMarkupAttributes
}
/** /**
* A message function is a message for a specific locale. * A message function is a message for a specific locale.
*/ */
export type MessageFunction = (inputs?: Record<string, never>) => LocalizedString; export type MessageFunction = (inputs?: Record<string, never>) => LocalizedString
/** /**
* A message bundle function that selects the message to be returned. * A message bundle function that selects the message to be returned.
* *
* Uses `getLocale()` under the hood to determine the locale with an option. * Uses `getLocale()` under the hood to determine the locale with an option.
*/ */
export type MessageBundleFunction<T extends string> = (params: Record<string, never>, options: { export type MessageBundleFunction<T extends string> = (
locale: T; params: Record<string, never>,
}) => LocalizedString; options: {
locale: T
},
) => LocalizedString
File diff suppressed because it is too large Load Diff
+8 -7
View File
@@ -87,10 +87,11 @@
* } * }
* ``` * ```
*/ */
export function paraglideMiddleware<T>(request: Request, resolve: (args: { export function paraglideMiddleware<T>(
request: Request; request: Request,
locale: import("./runtime.js").Locale; resolve: (args: { request: Request; locale: import('./runtime.js').Locale }) => T | Promise<T>,
}) => T | Promise<T>, options?: { options?: {
effectiveRequestUrl?: string | URL | ((request: Request) => string | URL); effectiveRequestUrl?: string | URL | ((request: Request) => string | URL)
onRedirect?: (response: Response) => void; onRedirect?: (response: Response) => void
}): Promise<Response>; },
): Promise<Response>
+141 -139
View File
@@ -1,6 +1,6 @@
/* eslint-disable */ /* eslint-disable */
import * as runtime from "./runtime.js"; import * as runtime from './runtime.js'
/** /**
* Server middleware that handles locale-based routing and request processing. * Server middleware that handles locale-based routing and request processing.
@@ -92,97 +92,104 @@ import * as runtime from "./runtime.js";
* ``` * ```
*/ */
export async function paraglideMiddleware(request, resolve, options) { export async function paraglideMiddleware(request, resolve, options) {
if (!runtime.disableAsyncLocalStorage && !runtime.serverAsyncLocalStorage) { if (!runtime.disableAsyncLocalStorage && !runtime.serverAsyncLocalStorage) {
const { AsyncLocalStorage } = await import("async_hooks"); const { AsyncLocalStorage } = await import('async_hooks')
runtime.overwriteServerAsyncLocalStorage(new AsyncLocalStorage()); runtime.overwriteServerAsyncLocalStorage(new AsyncLocalStorage())
} else if (!runtime.serverAsyncLocalStorage) { } else if (!runtime.serverAsyncLocalStorage) {
runtime.overwriteServerAsyncLocalStorage(createMockAsyncLocalStorage()); runtime.overwriteServerAsyncLocalStorage(createMockAsyncLocalStorage())
} }
const url = resolveMiddlewareUrl(request, options?.effectiveRequestUrl); const url = resolveMiddlewareUrl(request, options?.effectiveRequestUrl)
const origin = url.origin; const origin = url.origin
if (runtime.isExcludedByRouteStrategy(url.href)) { if (runtime.isExcludedByRouteStrategy(url.href)) {
const locale = runtime.baseLocale; const locale = runtime.baseLocale
const newRequest = cloneRequestWithFallback(request, url); const newRequest = cloneRequestWithFallback(request, url)
/** @type {Set<string>} */
const messageCalls = new Set();
return /** @type {Response} */ (await runtime.serverAsyncLocalStorage?.run({ locale, origin, messageCalls }, () => resolve({ locale, request: newRequest })));
}
const strategy = runtime.getStrategyForUrl(url.href);
const decision = await runtime.shouldRedirect({ request, effectiveRequestUrl: url });
const locale = decision.locale;
// if the client makes a request to a URL that doesn't match
// the localizedUrl, redirect the client to the localized URL
if (request.headers.get("Sec-Fetch-Dest") === "document" &&
decision.shouldRedirect &&
decision.redirectUrl) {
// Create headers object with Vary header if preferredLanguage strategy is used
/** @type {Record<string, string>} */
const headers = {};
if (strategy.includes("preferredLanguage")) {
headers["Vary"] = "Accept-Language";
}
const response = new Response(null, {
status: 307,
headers: {
Location: decision.redirectUrl.href,
...headers,
},
});
options?.onRedirect?.(response);
return response;
}
// If the strategy includes "url", we need to de-localize the URL
// before passing it to the server middleware.
//
// The middleware is responsible for mapping a localized URL to the
// de-localized URL e.g. `/en/about` to `/about`. Otherwise,
// the server can't render the correct page.
let newRequest;
if (strategy.includes("url")) {
newRequest = cloneRequestWithFallback(request, runtime.deLocalizeUrl(url));
}
else {
newRequest = cloneRequestWithFallback(request, url);
}
// the message functions that have been called in this request
/** @type {Set<string>} */ /** @type {Set<string>} */
const messageCalls = new Set(); const messageCalls = new Set()
const response = await runtime.serverAsyncLocalStorage?.run({ locale, origin, messageCalls }, () => resolve({ locale, request: newRequest })); return /** @type {Response} */ (
// Only modify HTML responses await runtime.serverAsyncLocalStorage?.run({ locale, origin, messageCalls }, () =>
if (runtime.experimentalMiddlewareLocaleSplitting && resolve({ locale, request: newRequest }),
response.headers.get("Content-Type")?.includes("html")) { )
const body = await response.text(); )
const messages = []; }
// using .values() to avoid polyfilling in older projects. else the following error is thrown const strategy = runtime.getStrategyForUrl(url.href)
// Type 'Set<string>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher. const decision = await runtime.shouldRedirect({ request, effectiveRequestUrl: url })
for (const messageCall of Array.from(messageCalls)) { const locale = decision.locale
const [id, locale] = // if the client makes a request to a URL that doesn't match
/** @type {[string, import("./runtime.js").Locale]} */ (messageCall.split(":")); // the localizedUrl, redirect the client to the localized URL
messages.push(`${id}: ${compiledBundles[id]?.[locale]}`); if (
} request.headers.get('Sec-Fetch-Dest') === 'document' &&
// Prevent translated content from terminating the inline script tag. decision.shouldRedirect &&
const escapedMessages = messages decision.redirectUrl
.join(",") ) {
.replace(/<\/(script)/gi, "<\\/$1"); // Create headers object with Vary header if preferredLanguage strategy is used
// Reuse the request's CSP nonce (if any) so the injected script is allowed under a strict CSP /** @type {Record<string, string>} */
const nonce = response.headers const headers = {}
.get("Content-Security-Policy") if (strategy.includes('preferredLanguage')) {
?.match(/'nonce-([\w+/=-]+)'/)?.[1]; headers['Vary'] = 'Accept-Language'
const nonceAttr = nonce ? `nonce="${nonce}"` : "";
const script = `<script ${nonceAttr}>globalThis.__paraglide = globalThis.__paraglide ?? {}; globalThis.__paraglide.ssr = { ${escapedMessages} }</script>`;
// Insert the script before the closing head tag
const newBody = body.replace("</head>", `${script}</head>`);
// Create a new response with the modified body
// Clone all headers except Content-Length which will be set automatically
const newHeaders = new Headers(response.headers);
newHeaders.delete("Content-Length"); // Let the browser calculate the correct length
return new Response(newBody, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
});
} }
return response; const response = new Response(null, {
status: 307,
headers: {
Location: decision.redirectUrl.href,
...headers,
},
})
options?.onRedirect?.(response)
return response
}
// If the strategy includes "url", we need to de-localize the URL
// before passing it to the server middleware.
//
// The middleware is responsible for mapping a localized URL to the
// de-localized URL e.g. `/en/about` to `/about`. Otherwise,
// the server can't render the correct page.
let newRequest
if (strategy.includes('url')) {
newRequest = cloneRequestWithFallback(request, runtime.deLocalizeUrl(url))
} else {
newRequest = cloneRequestWithFallback(request, url)
}
// the message functions that have been called in this request
/** @type {Set<string>} */
const messageCalls = new Set()
const response = await runtime.serverAsyncLocalStorage?.run(
{ locale, origin, messageCalls },
() => resolve({ locale, request: newRequest }),
)
// Only modify HTML responses
if (
runtime.experimentalMiddlewareLocaleSplitting &&
response.headers.get('Content-Type')?.includes('html')
) {
const body = await response.text()
const messages = []
// using .values() to avoid polyfilling in older projects. else the following error is thrown
// Type 'Set<string>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
for (const messageCall of Array.from(messageCalls)) {
const [id, locale] = /** @type {[string, import("./runtime.js").Locale]} */ (
messageCall.split(':')
)
messages.push(`${id}: ${compiledBundles[id]?.[locale]}`)
}
// Prevent translated content from terminating the inline script tag.
const escapedMessages = messages.join(',').replace(/<\/(script)/gi, '<\\/$1')
// Reuse the request's CSP nonce (if any) so the injected script is allowed under a strict CSP
const nonce = response.headers.get('Content-Security-Policy')?.match(/'nonce-([\w+/=-]+)'/)?.[1]
const nonceAttr = nonce ? `nonce="${nonce}"` : ''
const script = `<script ${nonceAttr}>globalThis.__paraglide = globalThis.__paraglide ?? {}; globalThis.__paraglide.ssr = { ${escapedMessages} }</script>`
// Insert the script before the closing head tag
const newBody = body.replace('</head>', `${script}</head>`)
// Create a new response with the modified body
// Clone all headers except Content-Length which will be set automatically
const newHeaders = new Headers(response.headers)
newHeaders.delete('Content-Length') // Let the browser calculate the correct length
return new Response(newBody, {
status: response.status,
statusText: response.statusText,
headers: newHeaders,
})
}
return response
} }
/** /**
* @param {Request} request * @param {Request} request
@@ -190,13 +197,13 @@ export async function paraglideMiddleware(request, resolve, options) {
* @returns {URL} * @returns {URL}
*/ */
function resolveMiddlewareUrl(request, effectiveRequestUrl) { function resolveMiddlewareUrl(request, effectiveRequestUrl) {
if (typeof effectiveRequestUrl === "function") { if (typeof effectiveRequestUrl === 'function') {
return new URL(effectiveRequestUrl(request), request.url); return new URL(effectiveRequestUrl(request), request.url)
} }
if (typeof effectiveRequestUrl === "string" || effectiveRequestUrl instanceof URL) { if (typeof effectiveRequestUrl === 'string' || effectiveRequestUrl instanceof URL) {
return new URL(effectiveRequestUrl, request.url); return new URL(effectiveRequestUrl, request.url)
} }
return new URL(request.url); return new URL(request.url)
} }
/** /**
* Some metaframeworks (NextJS) require a new Request object. * Some metaframeworks (NextJS) require a new Request object.
@@ -214,33 +221,29 @@ function resolveMiddlewareUrl(request, effectiveRequestUrl) {
* @returns {Request} * @returns {Request}
*/ */
function cloneRequestWithFallback(request, url = request.url) { function cloneRequestWithFallback(request, url = request.url) {
const targetUrl = typeof url === "string" ? url : url.href; const targetUrl = typeof url === 'string' ? url : url.href
if (targetUrl === request.url) { if (targetUrl === request.url) {
try {
// Clone first so building a new Request does not consume the original body stream.
return new Request(request.clone());
}
catch {
try {
return new Request(request);
}
catch {
return request;
}
}
}
try { try {
// Clone first so building a new Request does not consume the original body stream. // Clone first so building a new Request does not consume the original body stream.
return new Request(targetUrl, request.clone()); return new Request(request.clone())
} catch {
try {
return new Request(request)
} catch {
return request
}
} }
catch { }
try { try {
return new Request(targetUrl, request); // Clone first so building a new Request does not consume the original body stream.
} return new Request(targetUrl, request.clone())
catch { } catch {
return request; try {
} return new Request(targetUrl, request)
} catch {
return request
} }
}
} }
/** /**
* Creates a mock AsyncLocalStorage implementation for environments where * Creates a mock AsyncLocalStorage implementation for environments where
@@ -253,25 +256,24 @@ function cloneRequestWithFallback(request, url = request.url) {
* @returns {import("./runtime.js").ParaglideAsyncLocalStorage} * @returns {import("./runtime.js").ParaglideAsyncLocalStorage}
*/ */
function createMockAsyncLocalStorage() { function createMockAsyncLocalStorage() {
/** @type {any} */ /** @type {any} */
let currentStore = undefined; let currentStore = undefined
return { return {
getStore() { getStore() {
return currentStore; return currentStore
}, },
async run(store, callback) { async run(store, callback) {
currentStore = store; currentStore = store
try { try {
return await callback(); return await callback()
} } finally {
finally { currentStore = undefined
currentStore = undefined; }
} },
}, }
};
} }
// Used in generated server.js when async local storage is disabled. // Used in generated server.js when async local storage is disabled.
void createMockAsyncLocalStorage; void createMockAsyncLocalStorage
/** /**
* The compiled messages for the server middleware. * The compiled messages for the server middleware.
* *
@@ -279,4 +281,4 @@ void createMockAsyncLocalStorage;
* *
* @type {Record<string, Record<import("./runtime.js").Locale, string>>} * @type {Record<string, Record<import("./runtime.js").Locale, string>>}
*/ */
const compiledBundles = {}; const compiledBundles = {}