@maiyunnet/kebab 9.21.2 → 9.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/doc/kebab-rag.md +33 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/lang.d.ts +6 -0
- package/lib/lang.js +15 -0
- package/lib/undici/response.d.ts +1 -1
- package/package.json +1 -1
package/doc/kebab-rag.md
CHANGED
|
@@ -1717,7 +1717,7 @@ index/variables/VER.md
|
|
|
1717
1717
|
|
|
1718
1718
|
# Variable: VER
|
|
1719
1719
|
|
|
1720
|
-
> `const` **VER**: `"9.
|
|
1720
|
+
> `const` **VER**: `"9.22.0"` = `'9.22.0'`
|
|
1721
1721
|
|
|
1722
1722
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1723
1723
|
|
|
@@ -120680,6 +120680,37 @@ Defined in: [lib/lan.ts:63](https://github.com/maiyunnet/kebab/blob/master/lib/l
|
|
|
120680
120680
|
|
|
120681
120681
|
`Promise`\<`object`[]\>
|
|
120682
120682
|
|
|
120683
|
+
lib/lang/functions/getAcceptByCode.md
|
|
120684
|
+
---
|
|
120685
|
+
|
|
120686
|
+
[**Documents for @maiyunnet/kebab**](../../../index.md)
|
|
120687
|
+
|
|
120688
|
+
***
|
|
120689
|
+
|
|
120690
|
+
[Documents for @maiyunnet/kebab](../../../index.md) / [lib/lang](../index.md) / getAcceptByCode
|
|
120691
|
+
|
|
120692
|
+
# Function: getAcceptByCode()
|
|
120693
|
+
|
|
120694
|
+
> **getAcceptByCode**(`code?`): `string`
|
|
120695
|
+
|
|
120696
|
+
Defined in: [lib/lang.ts:55](https://github.com/maiyunnet/kebab/blob/master/lib/lang.ts#L55)
|
|
120697
|
+
|
|
120698
|
+
根据框架语言 code 获取浏览器标准语言标识,可用于 HTML lang 和 Intl
|
|
120699
|
+
|
|
120700
|
+
## Parameters
|
|
120701
|
+
|
|
120702
|
+
### code?
|
|
120703
|
+
|
|
120704
|
+
`string`
|
|
120705
|
+
|
|
120706
|
+
框架语言 code,不区分大小写;未传或不支持时回退 en
|
|
120707
|
+
|
|
120708
|
+
## Returns
|
|
120709
|
+
|
|
120710
|
+
`string`
|
|
120711
|
+
|
|
120712
|
+
sc 返回 zh-CN,tc 返回 zh-TW,其余支持的语言返回原 code
|
|
120713
|
+
|
|
120683
120714
|
lib/lang/functions/getCodeByAccept.md
|
|
120684
120715
|
---
|
|
120685
120716
|
|
|
@@ -120728,6 +120759,7 @@ lib/lang/index.md
|
|
|
120728
120759
|
|
|
120729
120760
|
## Functions
|
|
120730
120761
|
|
|
120762
|
+
- [getAcceptByCode](functions/getAcceptByCode.md)
|
|
120731
120763
|
- [getCodeByAccept](functions/getCodeByAccept.md)
|
|
120732
120764
|
|
|
120733
120765
|
lib/lang/variables/codes.md
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.
|
|
9
|
+
export const VER = '9.22.0';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/lang.d.ts
CHANGED
|
@@ -8,3 +8,9 @@ export declare const map: Record<string, string>;
|
|
|
8
8
|
* @param accept 常用字符串,如 zh-cn,或包含 zh-cn 的字符串
|
|
9
9
|
*/
|
|
10
10
|
export declare function getCodeByAccept(accept?: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* --- 根据框架语言 code 获取浏览器标准语言标识,可用于 HTML lang 和 Intl ---
|
|
13
|
+
* @param code 框架语言 code,不区分大小写;未传或不支持时回退 en
|
|
14
|
+
* @returns sc 返回 zh-CN,tc 返回 zh-TW,其余支持的语言返回原 code
|
|
15
|
+
*/
|
|
16
|
+
export declare function getAcceptByCode(code?: string): string;
|
package/lib/lang.js
CHANGED
|
@@ -43,3 +43,18 @@ export function getCodeByAccept(accept) {
|
|
|
43
43
|
}
|
|
44
44
|
return 'en';
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* --- 根据框架语言 code 获取浏览器标准语言标识,可用于 HTML lang 和 Intl ---
|
|
48
|
+
* @param code 框架语言 code,不区分大小写;未传或不支持时回退 en
|
|
49
|
+
* @returns sc 返回 zh-CN,tc 返回 zh-TW,其余支持的语言返回原 code
|
|
50
|
+
*/
|
|
51
|
+
export function getAcceptByCode(code) {
|
|
52
|
+
const lang = code?.toLowerCase() ?? 'en';
|
|
53
|
+
if (lang === 'sc') {
|
|
54
|
+
return 'zh-CN';
|
|
55
|
+
}
|
|
56
|
+
if (lang === 'tc') {
|
|
57
|
+
return 'zh-TW';
|
|
58
|
+
}
|
|
59
|
+
return codes.includes(lang) ? lang : 'en';
|
|
60
|
+
}
|
package/lib/undici/response.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class Response {
|
|
|
31
31
|
/**
|
|
32
32
|
* --- 获取响应读取流对象 ---
|
|
33
33
|
*/
|
|
34
|
-
getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) |
|
|
34
|
+
getStream(): zlib.BrotliDecompress | zlib.Gunzip | zlib.Inflate | (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | null;
|
|
35
35
|
/**
|
|
36
36
|
* --- 获取原生响应读取流对象 ---
|
|
37
37
|
*/
|