mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 23:54:25 +00:00
feat(webui): translate formatCount in file-browser and add plural keys
This commit is contained in:
@@ -566,9 +566,13 @@ export function FileBrowser({
|
|||||||
(c) => c.field === 'name' && c.operator === 'contains',
|
(c) => c.field === 'name' && c.operator === 'contains',
|
||||||
)
|
)
|
||||||
if (isNameFilter && count === 10001) {
|
if (isNameFilter && count === 10001) {
|
||||||
return `10000+ ${isFile ? 'Asset' : 'Folder'}s`
|
return isFile ? m.count_overflow_assets() : m.count_overflow_folders()
|
||||||
|
}
|
||||||
|
if (isFile) {
|
||||||
|
return count === 1 ? m.n_assets_singular({ count }) : m.n_assets_plural({ count })
|
||||||
|
} else {
|
||||||
|
return count === 1 ? m.n_folders_singular({ count }) : m.n_folders_plural({ count })
|
||||||
}
|
}
|
||||||
return `${count} ${isFile ? 'Asset' : 'Folder'}${count !== 1 ? 's' : ''}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleEmptyAreaClick = (e: React.MouseEvent) => {
|
const handleEmptyAreaClick = (e: React.MouseEvent) => {
|
||||||
|
|||||||
@@ -782,5 +782,10 @@
|
|||||||
"failed_create_field": "Failed to create field",
|
"failed_create_field": "Failed to create field",
|
||||||
"failed_update_field": "Failed to update field",
|
"failed_update_field": "Failed to update field",
|
||||||
"failed_delete_field": "Failed to delete field",
|
"failed_delete_field": "Failed to delete field",
|
||||||
"new_label": "New"
|
"new_label": "New",
|
||||||
|
|
||||||
|
"n_assets_singular": "{count} Asset",
|
||||||
|
"n_assets_plural": "{count} Assets",
|
||||||
|
"n_folders_singular": "{count} Folder",
|
||||||
|
"n_folders_plural": "{count} Folders"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -782,5 +782,10 @@
|
|||||||
"failed_create_field": "创建字段失败",
|
"failed_create_field": "创建字段失败",
|
||||||
"failed_update_field": "更新字段失败",
|
"failed_update_field": "更新字段失败",
|
||||||
"failed_delete_field": "删除字段失败",
|
"failed_delete_field": "删除字段失败",
|
||||||
"new_label": "新建"
|
"new_label": "新建",
|
||||||
|
|
||||||
|
"n_assets_singular": "{count} 个资源",
|
||||||
|
"n_assets_plural": "{count} 个资源",
|
||||||
|
"n_folders_singular": "{count} 个文件夹",
|
||||||
|
"n_folders_plural": "{count} 个文件夹"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -732,4 +732,8 @@ export * from "./failed_create_field.js";
|
|||||||
export * from "./failed_update_field.js";
|
export * from "./failed_update_field.js";
|
||||||
export * from "./failed_delete_field.js";
|
export * from "./failed_delete_field.js";
|
||||||
export * from "./new_label.js";
|
export * from "./new_label.js";
|
||||||
|
export * from "./n_assets_singular.js";
|
||||||
|
export * from "./n_assets_plural.js";
|
||||||
|
export * from "./n_folders_singular.js";
|
||||||
|
export * from "./n_folders_plural.js";
|
||||||
export type LocalizedString = import("../runtime.js").LocalizedString;
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
|||||||
@@ -733,4 +733,8 @@ export * from './failed_update_fields_order.js'
|
|||||||
export * from './failed_create_field.js'
|
export * from './failed_create_field.js'
|
||||||
export * from './failed_update_field.js'
|
export * from './failed_update_field.js'
|
||||||
export * from './failed_delete_field.js'
|
export * from './failed_delete_field.js'
|
||||||
export * from './new_label.js'
|
export * from './new_label.js'
|
||||||
|
export * from './n_assets_singular.js'
|
||||||
|
export * from './n_assets_plural.js'
|
||||||
|
export * from './n_folders_singular.js'
|
||||||
|
export * from './n_folders_plural.js'
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{count} Assets" |
|
||||||
|
*
|
||||||
|
* @param {N_Assets_PluralInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const n_assets_plural: ((inputs: N_Assets_PluralInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<N_Assets_PluralInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type N_Assets_PluralInputs = {
|
||||||
|
count: NonNullable<unknown>;
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{ count: NonNullable<unknown> }} N_Assets_PluralInputs */
|
||||||
|
|
||||||
|
const en_n_assets_plural = /** @type {(inputs: N_Assets_PluralInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.count} Assets`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_n_assets_plural = /** @type {(inputs: N_Assets_PluralInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.count} 个资源`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{count} Assets" |
|
||||||
|
*
|
||||||
|
* @param {N_Assets_PluralInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const n_assets_plural = /** @type {((inputs: N_Assets_PluralInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<N_Assets_PluralInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_n_assets_plural(inputs)
|
||||||
|
return zh_n_assets_plural(inputs)
|
||||||
|
});
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{count} Asset" |
|
||||||
|
*
|
||||||
|
* @param {N_Assets_SingularInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const n_assets_singular: ((inputs: N_Assets_SingularInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<N_Assets_SingularInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type N_Assets_SingularInputs = {
|
||||||
|
count: NonNullable<unknown>;
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{ count: NonNullable<unknown> }} N_Assets_SingularInputs */
|
||||||
|
|
||||||
|
const en_n_assets_singular = /** @type {(inputs: N_Assets_SingularInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.count} Asset`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_n_assets_singular = /** @type {(inputs: N_Assets_SingularInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.count} 个资源`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{count} Asset" |
|
||||||
|
*
|
||||||
|
* @param {N_Assets_SingularInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const n_assets_singular = /** @type {((inputs: N_Assets_SingularInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<N_Assets_SingularInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_n_assets_singular(inputs)
|
||||||
|
return zh_n_assets_singular(inputs)
|
||||||
|
});
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{count} Folders" |
|
||||||
|
*
|
||||||
|
* @param {N_Folders_PluralInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const n_folders_plural: ((inputs: N_Folders_PluralInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<N_Folders_PluralInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type N_Folders_PluralInputs = {
|
||||||
|
count: NonNullable<unknown>;
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{ count: NonNullable<unknown> }} N_Folders_PluralInputs */
|
||||||
|
|
||||||
|
const en_n_folders_plural = /** @type {(inputs: N_Folders_PluralInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.count} Folders`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_n_folders_plural = /** @type {(inputs: N_Folders_PluralInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.count} 个文件夹`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{count} Folders" |
|
||||||
|
*
|
||||||
|
* @param {N_Folders_PluralInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const n_folders_plural = /** @type {((inputs: N_Folders_PluralInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<N_Folders_PluralInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_n_folders_plural(inputs)
|
||||||
|
return zh_n_folders_plural(inputs)
|
||||||
|
});
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{count} Folder" |
|
||||||
|
*
|
||||||
|
* @param {N_Folders_SingularInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const n_folders_singular: ((inputs: N_Folders_SingularInputs, options?: {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}) => LocalizedString) & import("../runtime.js").MessageMetadata<N_Folders_SingularInputs, {
|
||||||
|
locale?: "en" | "zh";
|
||||||
|
}, {}>;
|
||||||
|
export type LocalizedString = import("../runtime.js").LocalizedString;
|
||||||
|
export type N_Folders_SingularInputs = {
|
||||||
|
count: NonNullable<unknown>;
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
import { getLocale, experimentalStaticLocale } from '../runtime.js';
|
||||||
|
|
||||||
|
/** @typedef {import('../runtime.js').LocalizedString} LocalizedString */
|
||||||
|
|
||||||
|
/** @typedef {{ count: NonNullable<unknown> }} N_Folders_SingularInputs */
|
||||||
|
|
||||||
|
const en_n_folders_singular = /** @type {(inputs: N_Folders_SingularInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.count} Folder`)
|
||||||
|
};
|
||||||
|
|
||||||
|
const zh_n_folders_singular = /** @type {(inputs: N_Folders_SingularInputs) => LocalizedString} */ (i) => {
|
||||||
|
return /** @type {LocalizedString} */ (`${i?.count} 个文件夹`)
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* | output |
|
||||||
|
* | --- |
|
||||||
|
* | "{count} Folder" |
|
||||||
|
*
|
||||||
|
* @param {N_Folders_SingularInputs} inputs
|
||||||
|
* @param {{ locale?: "en" | "zh" }} options
|
||||||
|
* @returns {LocalizedString}
|
||||||
|
*/
|
||||||
|
export const n_folders_singular = /** @type {((inputs: N_Folders_SingularInputs, options?: { locale?: "en" | "zh" }) => LocalizedString) & import('../runtime.js').MessageMetadata<N_Folders_SingularInputs, { locale?: "en" | "zh" }, {}>} */ ((inputs, options = {}) => {
|
||||||
|
const locale = experimentalStaticLocale ?? options.locale ?? getLocale()
|
||||||
|
if (locale === "en") return en_n_folders_singular(inputs)
|
||||||
|
return zh_n_folders_singular(inputs)
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user