@lark-apaas/client-toolkit 1.2.86 → 1.2.87-alpha.20261201140650

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.
Files changed (61) hide show
  1. package/README.en-US.md +105 -0
  2. package/README.md +30 -1
  3. package/lib/apis/components/UniversalLink.js +2 -1
  4. package/lib/apis/constants/img-resources/avatar.d.ts +11 -11
  5. package/lib/apis/constants/img-resources/avatar.js +12 -11
  6. package/lib/apis/constants/img-resources/banner.d.ts +24 -24
  7. package/lib/apis/constants/img-resources/banner.js +25 -24
  8. package/lib/apis/constants/img-resources/cover.d.ts +36 -36
  9. package/lib/apis/constants/img-resources/cover.js +37 -36
  10. package/lib/apis/dataloom.d.ts +0 -2
  11. package/lib/apis/dataloom.js +1 -2
  12. package/lib/apis/utils/createI18nForRuntime.d.ts +6 -0
  13. package/lib/apis/utils/createI18nForRuntime.js +2 -0
  14. package/lib/apis/utils/getLarkJssdkConfig.d.ts +2 -0
  15. package/lib/apis/utils/getLarkJssdkConfig.js +2 -0
  16. package/lib/apis/utils/getLocale.d.ts +3 -0
  17. package/lib/apis/utils/getLocale.js +2 -0
  18. package/lib/components/AppContainer/Watermark.js +44 -42
  19. package/lib/components/AppContainer/__test__/Watermark.test.js +36 -7
  20. package/lib/components/AppContainer/doubao-watermark-asset.d.ts +3 -3
  21. package/lib/components/AppContainer/doubao-watermark-asset.js +6 -5
  22. package/lib/components/AppContainer/index.js +16 -2
  23. package/lib/components/AppContainer/utils/tea.js +5 -2
  24. package/lib/components/ErrorRender/index.js +2 -1
  25. package/lib/components/NotFoundRender/index.js +4 -3
  26. package/lib/components/PagePlaceholder/index.js +2 -1
  27. package/lib/components/User/UserProfile/UserProfileUI.js +5 -3
  28. package/lib/components/User/UserProfile/utils.d.ts +2 -1
  29. package/lib/components/User/UserProfile/utils.js +12 -8
  30. package/lib/components/User/UserSelectUI/Dropdown.js +3 -2
  31. package/lib/components/User/UserSelectUI/MultipleSelectionTags.js +4 -1
  32. package/lib/components/User/UserWithAvatar.js +2 -1
  33. package/lib/components/theme/constants.js +19 -11
  34. package/lib/hooks/useCurrentUserProfile.js +8 -2
  35. package/lib/hooks/useLogout.js +3 -2
  36. package/lib/index.d.ts +0 -2
  37. package/lib/index.js +1 -2
  38. package/lib/integrations/services/UserProfileService.d.ts +1 -1
  39. package/lib/integrations/services/UserProfileService.js +2 -2
  40. package/lib/locales/__test__/messages.test.js +9 -7
  41. package/lib/locales/index.d.ts +12 -5
  42. package/lib/locales/index.js +11 -7
  43. package/lib/locales/messages.json +262 -0
  44. package/lib/utils/axiosConfig.js +22 -19
  45. package/lib/utils/copyToClipboard.js +2 -1
  46. package/lib/utils/getAxiosForBackend.js +2 -1
  47. package/lib/utils/getParentOrigin.d.ts +1 -0
  48. package/lib/utils/getParentOrigin.js +7 -14
  49. package/lib/utils/i18nText.d.ts +5 -0
  50. package/lib/utils/i18nText.js +8 -0
  51. package/lib/utils/larkJssdk.d.ts +13 -0
  52. package/lib/utils/larkJssdk.js +11 -0
  53. package/lib/utils/locale.d.ts +2 -3
  54. package/lib/utils/locale.js +2 -38
  55. package/lib/utils/postMessage.d.ts +5 -1
  56. package/lib/utils/postMessage.js +2 -20
  57. package/package.json +8 -5
  58. package/lib/integrations/__test__/base-storage.test.d.ts +0 -1
  59. package/lib/integrations/__test__/base-storage.test.js +0 -74
  60. package/lib/locales/messages.d.ts +0 -12
  61. package/lib/locales/messages.js +0 -104
@@ -1,6 +1,10 @@
1
+ import { getStaticUrl } from "@lark-apaas/miaoda-common-settings";
2
+ import { t } from "../../locales/index.js";
1
3
  const themeMetaOptions = {
2
4
  themeColors: {
3
- title: '主题色',
5
+ get title () {
6
+ return t('theme.themeColors.title');
7
+ },
4
8
  options: [
5
9
  {
6
10
  value: '--blue-700',
@@ -33,14 +37,16 @@ const themeMetaOptions = {
33
37
  ]
34
38
  },
35
39
  themeRadius: {
36
- title: '圆角',
40
+ get title () {
41
+ return t('theme.themeRadius.title');
42
+ },
37
43
  options: [
38
44
  {
39
45
  value: {
40
46
  pixel: '0',
41
47
  rem: '0'
42
48
  },
43
- iconUrl: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/border-radius_ssm.svg',
49
+ iconUrl: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/icon/border-radius_ssm.svg'),
44
50
  size: 'ssm'
45
51
  },
46
52
  {
@@ -48,7 +54,7 @@ const themeMetaOptions = {
48
54
  pixel: '8',
49
55
  rem: '0.625'
50
56
  },
51
- iconUrl: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/border-radius_m.svg',
57
+ iconUrl: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/icon/border-radius_m.svg'),
52
58
  size: 'm'
53
59
  },
54
60
  {
@@ -56,7 +62,7 @@ const themeMetaOptions = {
56
62
  pixel: '12',
57
63
  rem: '0.875'
58
64
  },
59
- iconUrl: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/border-radius_l.svg',
65
+ iconUrl: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/icon/border-radius_l.svg'),
60
66
  size: 'l'
61
67
  },
62
68
  {
@@ -64,13 +70,15 @@ const themeMetaOptions = {
64
70
  pixel: '24',
65
71
  rem: '1.625'
66
72
  },
67
- iconUrl: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/border-radius_xl.svg',
73
+ iconUrl: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/icon/border-radius_xl.svg'),
68
74
  size: 'xl'
69
75
  }
70
76
  ]
71
77
  },
72
78
  themeSpaces: {
73
- title: '间距',
79
+ get title () {
80
+ return t('theme.themeSpaces.title');
81
+ },
74
82
  options: [
75
83
  {
76
84
  value: {
@@ -81,7 +89,7 @@ const themeMetaOptions = {
81
89
  sizeStep: '4'
82
90
  }
83
91
  },
84
- iconUrl: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/spacing-ssm.svg',
92
+ iconUrl: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/icon/spacing-ssm.svg'),
85
93
  size: 'ssm'
86
94
  },
87
95
  {
@@ -93,7 +101,7 @@ const themeMetaOptions = {
93
101
  sizeStep: '4'
94
102
  }
95
103
  },
96
- iconUrl: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/spacing-m.svg',
104
+ iconUrl: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/icon/spacing-m.svg'),
97
105
  size: 'm'
98
106
  },
99
107
  {
@@ -105,7 +113,7 @@ const themeMetaOptions = {
105
113
  sizeStep: '4'
106
114
  }
107
115
  },
108
- iconUrl: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/spacing-l.svg',
116
+ iconUrl: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/icon/spacing-l.svg'),
109
117
  size: 'l'
110
118
  },
111
119
  {
@@ -117,7 +125,7 @@ const themeMetaOptions = {
117
125
  sizeStep: '4'
118
126
  }
119
127
  },
120
- iconUrl: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/icon/spacing-xl.svg',
128
+ iconUrl: getStaticUrl('LMfspH/ljhwZthlaukjlkulzlp/icon/spacing-xl.svg'),
121
129
  size: 'xl'
122
130
  }
123
131
  ]
@@ -4,10 +4,16 @@ import { logger } from "../logger/index.js";
4
4
  import { getCurrentUserProfile } from "../integrations/getCurrentUserProfile.js";
5
5
  import { isSparkRuntime } from "../utils/utils.js";
6
6
  import { getAxiosForBackend } from "../utils/getAxiosForBackend.js";
7
+ import { readSettings } from "@lark-apaas/miaoda-common-settings";
7
8
  function getNameFromArray(nameArray) {
8
9
  if (!nameArray || 0 === nameArray.length) return;
9
- const chineseName = nameArray.find((item)=>2052 === item.language_code);
10
- return chineseName?.text ?? nameArray[0]?.text;
10
+ const languageCode = {
11
+ 'zh-CN': 2052,
12
+ 'en-US': 1033,
13
+ 'ja-JP': 1041
14
+ }[readSettings('locale')];
15
+ const name = nameArray.find((item)=>item.language_code === languageCode);
16
+ return name?.text ?? nameArray[0]?.text;
11
17
  }
12
18
  let _larkUserIdCache = null;
13
19
  let _larkUserIdPromise = null;
@@ -1,14 +1,15 @@
1
1
  import { useState } from "react";
2
2
  import { authClient } from "@lark-apaas/auth-sdk";
3
+ import { t } from "../locales/index.js";
3
4
  function useLogout() {
4
5
  const [isLoading, setIsLoading] = useState(false);
5
6
  async function handlerLogout() {
6
- if ('production' !== process.env.NODE_ENV) return void console.log('只有生产环境才执行登出');
7
+ if ('production' !== process.env.NODE_ENV) return void console.log(t('logout.log.productionOnly'));
7
8
  setIsLoading(true);
8
9
  try {
9
10
  await authClient.session.signOut();
10
11
  } catch (error) {
11
- console.error('登出失败', error);
12
+ console.error(t('logout.log.failed'), error);
12
13
  } finally{
13
14
  setIsLoading(false);
14
15
  }
package/lib/index.d.ts CHANGED
@@ -29,8 +29,6 @@ export { getAppId };
29
29
  export { getAppInfo } from './integrations/getAppInfo';
30
30
  export { getCurrentUserProfile } from './integrations/getCurrentUserProfile';
31
31
  export { getDataloom } from './integrations/dataloom';
32
- export { BaseStorageError } from './apis/dataloom';
33
- export type { BaseAttachment, UploadedBaseAttachment, BaseStorageResult, BaseStorage, UploadParams, GetAttachmentUrlParams, BaseStorageStage, } from './apis/dataloom';
34
32
  export { logger };
35
33
  export type { LogLevel, LogWithMeta } from './logger/log-types';
36
34
  export { trace } from './trace';
package/lib/index.js CHANGED
@@ -31,7 +31,6 @@ import { initAxiosConfig } from "./utils/axiosConfig.js";
31
31
  import { getAppInfo } from "./integrations/getAppInfo.js";
32
32
  import { getCurrentUserProfile } from "./integrations/getCurrentUserProfile.js";
33
33
  import { getDataloom } from "./integrations/dataloom.js";
34
- import { BaseStorageError } from "./apis/dataloom.js";
35
34
  import { trace } from "./trace/index.js";
36
35
  import { initObservable } from "./runtime/observable.js";
37
36
  import { TrackKey } from "./types/tea.js";
@@ -59,4 +58,4 @@ const capabilityClient = createClient({
59
58
  const src = {
60
59
  version: version
61
60
  };
62
- export { ActiveLink, AppContainer, BaseStorageError, ErrorRender, NavLink, PagePlaceholder, QueryProvider, TrackKey, UniversalLink, PagePlaceholder as Welcome, __WEBPACK_EXTERNAL_MODULE__apis_constants_img_resources_avatar_js_2c154035__ as avatarImages, axiosForBackend, __WEBPACK_EXTERNAL_MODULE__apis_constants_img_resources_banner_js_72c990bf__ as bannerImages, capabilityClient, clsxWithTw, copyToClipboard, __WEBPACK_EXTERNAL_MODULE__apis_constants_img_resources_cover_js_90a812c2__ as coverImages, src as default, getAppId, getAppInfo, getAxiosForBackend, getCsrfToken, getCurrentUserProfile, getDataloom, getEnvPath, getWsPath, initAxiosConfig, initObservable, isIOS, isIpad, isMobile, isPreview, logger, normalizeBasePath, reportTeaEvent, resolveAppUrl, safeStringify, scopedStorage, showConfirm, trace, useAppInfo, useCurrentUserProfile, useIsMobile, useLogout };
61
+ export { ActiveLink, AppContainer, ErrorRender, NavLink, PagePlaceholder, QueryProvider, TrackKey, UniversalLink, PagePlaceholder as Welcome, __WEBPACK_EXTERNAL_MODULE__apis_constants_img_resources_avatar_js_2c154035__ as avatarImages, axiosForBackend, __WEBPACK_EXTERNAL_MODULE__apis_constants_img_resources_banner_js_72c990bf__ as bannerImages, capabilityClient, clsxWithTw, copyToClipboard, __WEBPACK_EXTERNAL_MODULE__apis_constants_img_resources_cover_js_90a812c2__ as coverImages, src as default, getAppId, getAppInfo, getAxiosForBackend, getCsrfToken, getCurrentUserProfile, getDataloom, getEnvPath, getWsPath, initAxiosConfig, initObservable, isIOS, isIpad, isMobile, isPreview, logger, normalizeBasePath, reportTeaEvent, resolveAppUrl, safeStringify, scopedStorage, showConfirm, trace, useAppInfo, useCurrentUserProfile, useIsMobile, useLogout };
@@ -1,6 +1,6 @@
1
1
  import type { AccountType, UserProfileData } from './types';
2
2
  /**
3
- * 获取 CDN 资源 URL
3
+ * 获取 CDN 资源 URL,CDN 前缀取自配置
4
4
  */
5
5
  export declare function getAssetsUrl(path: string): string;
6
6
  export type UserProfileServiceConfig = {
@@ -1,8 +1,8 @@
1
1
  import { getAppId } from "../../utils/getAppId.js";
2
2
  import { isNewPathEnabled } from "../../utils/apiPath.js";
3
- const CDN_HOST = 'https://lf3-static.bytednsdoc.com';
3
+ import { getStaticUrl } from "@lark-apaas/miaoda-common-settings";
4
4
  function getAssetsUrl(path) {
5
- return `${CDN_HOST}${path}`;
5
+ return getStaticUrl(path);
6
6
  }
7
7
  const DEFAULT_CONFIG = {
8
8
  getAppId: ()=>getAppId(),
@@ -1,15 +1,17 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import messages from "../messages.js";
2
+ import messages from "../messages.json";
3
3
  import { getRateLimitMessageKey } from "../../utils/rateLimitError.js";
4
4
  describe('rate limit locale messages', ()=>{
5
5
  it('keeps quota exhaustion and frequency limiting as separate bilingual messages', ()=>{
6
- expect(messages).toHaveProperty('index.rateLimitError', {
7
- zh: '应用额度已耗尽,请联系应用开发者',
8
- en: 'Application quota exhausted, please contact the app developer'
6
+ expect(messages["index.rateLimitError"]).toMatchObject({
7
+ 'zh-CN': '应用额度已耗尽,请联系应用开发者',
8
+ 'en-US': expect.stringMatching(/quota/i),
9
+ 'ja-JP': expect.any(String)
9
10
  });
10
- expect(messages).toHaveProperty('index.frequencyLimitError', {
11
- zh: '操作过于频繁,请稍后重试',
12
- en: 'Too many requests. Please try again later'
11
+ expect(messages["index.frequencyLimitError"]).toMatchObject({
12
+ 'zh-CN': '操作过于频繁,请稍后重试',
13
+ 'en-US': expect.stringMatching(/frequen|too many|too often/i),
14
+ 'ja-JP': expect.any(String)
13
15
  });
14
16
  });
15
17
  it('selects the correct message and supports older client-capability errors', ()=>{
@@ -1,15 +1,22 @@
1
+ import messages from './messages.json';
2
+ type DevMessageKey = Extract<keyof typeof messages, 'notFound.logger.repairMessage'>;
1
3
  /**
2
- * 获取当前语言环境下的翻译文案。
4
+ * 获取当前语言环境下的翻译文案,语言规则见 getLocale。
3
5
  *
4
6
  * 支持 `{key}` 形式的变量替换:
5
7
  * ```ts
6
- * t('safety.tenant.operated', { name: '字节' })
7
- * // zh → "字节运营"
8
- * // en → "Operated by 字节"
8
+ * t('userSelect.tag.remove', { name: 'Alex' })
9
+ * // zh → "移除 Alex"
10
+ * // en → "Remove Alex"
9
11
  * ```
10
12
  *
11
13
  * 如果 key 不存在,fallback 到中文;中文也没有则返回 key 本身。
12
14
  */
13
- export declare function t(key: string, params?: Record<string, string>): string;
15
+ export declare function t(key: Exclude<keyof typeof messages, DevMessageKey>, params?: Record<string, string | number>): string;
16
+ /**
17
+ * 给 Agent 看的文案(如一键修复提示),语言使用配置 locale。
18
+ * 默认语言取配置 locale。
19
+ */
20
+ export declare function tDev(key: DevMessageKey, params?: Record<string, string | number>): string;
14
21
  export { getLocale } from '../utils/locale';
15
22
  export type { Locale } from '../utils/locale';
@@ -1,10 +1,14 @@
1
- import messages from "./messages.js";
1
+ import { createI18nForDev, createI18nForRuntime } from "@lark-apaas/miaoda-common-settings/i18n";
2
+ import messages from "./messages.json" with {
3
+ type: "json"
4
+ };
2
5
  import { getLocale } from "../utils/locale.js";
6
+ const i18n = createI18nForRuntime(messages);
7
+ const devI18n = createI18nForDev(messages);
3
8
  function t(key, params) {
4
- const locale = getLocale();
5
- const entry = messages[key];
6
- let text = entry?.[locale] ?? entry?.zh ?? key;
7
- if (params) for (const [k, v] of Object.entries(params))text = text.replace(`{${k}}`, v);
8
- return text;
9
+ return i18n.t(key, params);
9
10
  }
10
- export { getLocale, t };
11
+ function tDev(key, params) {
12
+ return devI18n.t(key, params);
13
+ }
14
+ export { getLocale, t, tDev };
@@ -0,0 +1,262 @@
1
+ {
2
+ "axios.log.field.errorCode": {
3
+ "zh-CN": "错误代码",
4
+ "en-US": "Error code",
5
+ "ja-JP": "エラーコード"
6
+ },
7
+ "axios.log.field.errorMessage": {
8
+ "zh-CN": "错误信息",
9
+ "en-US": "Error message",
10
+ "ja-JP": "エラーメッセージ"
11
+ },
12
+ "axios.log.field.errorType": {
13
+ "zh-CN": "错误类型",
14
+ "en-US": "Error type",
15
+ "ja-JP": "エラーの種類"
16
+ },
17
+ "axios.log.field.method": {
18
+ "zh-CN": "方法",
19
+ "en-US": "HTTP method",
20
+ "ja-JP": "HTTP メソッド"
21
+ },
22
+ "axios.log.field.queryParams": {
23
+ "zh-CN": "查询参数",
24
+ "en-US": "Query parameters",
25
+ "ja-JP": "クエリパラメータ"
26
+ },
27
+ "axios.log.field.requestParams": {
28
+ "zh-CN": "请求参数",
29
+ "en-US": "Request parameters",
30
+ "ja-JP": "リクエストパラメーター"
31
+ },
32
+ "axios.log.field.responseData": {
33
+ "zh-CN": "返回数据",
34
+ "en-US": "Response data",
35
+ "ja-JP": "レスポンスデータ"
36
+ },
37
+ "axios.log.field.status": {
38
+ "zh-CN": "状态",
39
+ "en-US": "Status",
40
+ "ja-JP": "ステータス"
41
+ },
42
+ "axios.log.field.statusCode": {
43
+ "zh-CN": "状态码",
44
+ "en-US": "Status code",
45
+ "ja-JP": "ステータスコード"
46
+ },
47
+ "axios.log.field.statusWithCode": {
48
+ "zh-CN": "{statusText}[状态码{status}]",
49
+ "en-US": "{statusText} [status code {status}]",
50
+ "ja-JP": "{statusText}[ステータスコード: {status}]"
51
+ },
52
+ "axios.log.field.summary": {
53
+ "zh-CN": "请求摘要",
54
+ "en-US": "Request summary",
55
+ "ja-JP": "リクエストの概要"
56
+ },
57
+ "axios.log.field.time": {
58
+ "zh-CN": "时间",
59
+ "en-US": "Time",
60
+ "ja-JP": "時刻"
61
+ },
62
+ "axios.log.field.timeout": {
63
+ "zh-CN": "超时设置",
64
+ "en-US": "Timeout setting",
65
+ "ja-JP": "タイムアウトの設定"
66
+ },
67
+ "axios.log.forbidden": {
68
+ "zh-CN": "请求被拒绝(403):{method} {url}",
69
+ "en-US": "Request rejected (403): {method} {url}",
70
+ "ja-JP": "リクエストが拒否されました(403): {method} {url}"
71
+ },
72
+ "axios.log.networkFailed": {
73
+ "zh-CN": "网络请求失败:",
74
+ "en-US": "Network request failed: ",
75
+ "ja-JP": "ネットワークリクエストに失敗しました:"
76
+ },
77
+ "axios.log.noResponseOrConfig": {
78
+ "zh-CN": "请求失败:无响应对象或配置信息",
79
+ "en-US": "Request failed: no response object or configuration information",
80
+ "ja-JP": "リクエストに失敗しました。レスポンスまたは設定情報がありません。"
81
+ },
82
+ "axios.log.requestFailed": {
83
+ "zh-CN": "请求失败:",
84
+ "en-US": "Request failed: ",
85
+ "ja-JP": "リクエストに失敗しました:"
86
+ },
87
+ "axios.log.requestSuccess": {
88
+ "zh-CN": "请求成功:",
89
+ "en-US": "Request succeeded: ",
90
+ "ja-JP": "リクエストが成功しました:"
91
+ },
92
+ "axios.log.unknownError": {
93
+ "zh-CN": "未知错误",
94
+ "en-US": "Unknown error",
95
+ "ja-JP": "不明なエラー"
96
+ },
97
+ "axios.toast.loginRequired": {
98
+ "zh-CN": "需要登录后才能执行操作,将自动跳转登录页",
99
+ "en-US": "Sign in to continue. Redirecting to the sign-in page...",
100
+ "ja-JP": "この操作にはログインが必要です。ログインページに移動します。"
101
+ },
102
+ "clipboard.log.fallbackFailed": {
103
+ "zh-CN": "降级复制方案失败:",
104
+ "en-US": "Fallback copy failed:",
105
+ "ja-JP": "コピーの代替処理に失敗しました:"
106
+ },
107
+ "confirm.cancelText": {
108
+ "zh-CN": "取消",
109
+ "en-US": "Cancel",
110
+ "ja-JP": "キャンセル"
111
+ },
112
+ "confirm.confirmText": {
113
+ "zh-CN": "确认",
114
+ "en-US": "Confirm",
115
+ "ja-JP": "確認"
116
+ },
117
+ "confirm.title": {
118
+ "zh-CN": "提示",
119
+ "en-US": "Notice",
120
+ "ja-JP": "お知らせ"
121
+ },
122
+ "errorRender.title": {
123
+ "zh-CN": "页面出错了",
124
+ "en-US": "Something went wrong",
125
+ "ja-JP": "ページでエラーが発生しました"
126
+ },
127
+ "index.frequencyLimitError": {
128
+ "zh-CN": "操作过于频繁,请稍后重试",
129
+ "en-US": "You’re doing that too often. Please try again later.",
130
+ "ja-JP": "操作の間隔が短すぎます。しばらくしてからもう一度お試しください。"
131
+ },
132
+ "index.rateLimitError": {
133
+ "zh-CN": "应用额度已耗尽,请联系应用开发者",
134
+ "en-US": "This app has reached its quota. Contact the app developer.",
135
+ "ja-JP": "このアプリの利用上限に達しました。アプリの開発者にお問い合わせください。"
136
+ },
137
+ "logout.log.failed": {
138
+ "zh-CN": "登出失败",
139
+ "en-US": "Logout failed",
140
+ "ja-JP": "ログアウトに失敗しました"
141
+ },
142
+ "logout.log.productionOnly": {
143
+ "zh-CN": "只有生产环境才执行登出",
144
+ "en-US": "Only the production environment performs logout",
145
+ "ja-JP": "ログアウトは本番環境でのみ実行されます"
146
+ },
147
+ "notFound.logger.pageNotExist": {
148
+ "zh-CN": "页面 {path} 不存在",
149
+ "en-US": "Page {path} does not exist",
150
+ "ja-JP": "ページ {path} が見つかりません。"
151
+ },
152
+ "notFound.logger.repairMessage": {
153
+ "zh-CN": "页面 {path} 不存在,帮我创建对应页面,并配置到\"client/src/app.tsx\"路由表中",
154
+ "en-US": "Create a page for {path} and add it to the route table in client/src/app.tsx. The page does not exist yet.",
155
+ "ja-JP": "ページ {path} が見つかりません。対応するページを作成し、client/src/app.tsx のルーティングに追加してください。"
156
+ },
157
+ "notFound.pageNotExist": {
158
+ "zh-CN": "页面不存在",
159
+ "en-US": "Page not found",
160
+ "ja-JP": "ページが見つかりません"
161
+ },
162
+ "pagePlaceholder.description": {
163
+ "zh-CN": "页面暂未开发,请耐心等待...",
164
+ "en-US": "This page is still under development. Please check back later.",
165
+ "ja-JP": "このページは準備中です。しばらくしてからもう一度お試しください。"
166
+ },
167
+ "pagePlaceholder.title": {
168
+ "zh-CN": "页面待开发",
169
+ "en-US": "Page coming soon",
170
+ "ja-JP": "ページ準備中"
171
+ },
172
+ "theme.themeColors.title": {
173
+ "zh-CN": "主题色",
174
+ "en-US": "Theme color",
175
+ "ja-JP": "テーマカラー"
176
+ },
177
+ "theme.themeRadius.title": {
178
+ "zh-CN": "圆角",
179
+ "en-US": "Corner radius",
180
+ "ja-JP": "角丸"
181
+ },
182
+ "theme.themeSpaces.title": {
183
+ "zh-CN": "间距",
184
+ "en-US": "Spacing",
185
+ "ja-JP": "余白"
186
+ },
187
+ "user.invalidUser": {
188
+ "zh-CN": "无效人员",
189
+ "en-US": "Invalid user",
190
+ "ja-JP": "無効なユーザー"
191
+ },
192
+ "userProfile.button.message": {
193
+ "zh-CN": "消息",
194
+ "en-US": "Message",
195
+ "ja-JP": "メッセージ"
196
+ },
197
+ "userProfile.label.department": {
198
+ "zh-CN": "部门",
199
+ "en-US": "Department",
200
+ "ja-JP": "部署"
201
+ },
202
+ "userProfile.label.email": {
203
+ "zh-CN": "邮箱",
204
+ "en-US": "Email",
205
+ "ja-JP": "メールアドレス"
206
+ },
207
+ "userProfile.status.inactive": {
208
+ "zh-CN": "暂停使用",
209
+ "en-US": "Inactive",
210
+ "ja-JP": "利用停止中"
211
+ },
212
+ "userSelect.dropdown.noResults": {
213
+ "zh-CN": "无结果,建议更换搜索词",
214
+ "en-US": "No results. Try a different search term.",
215
+ "ja-JP": "該当するユーザーが見つかりません。別のキーワードで検索してください。"
216
+ },
217
+ "userSelect.placeholder": {
218
+ "zh-CN": "请选择用户",
219
+ "en-US": "Please select a user",
220
+ "ja-JP": "ユーザーを選択してください"
221
+ },
222
+ "userSelect.tag.remove": {
223
+ "zh-CN": "移除 {name}",
224
+ "en-US": "Remove {name}",
225
+ "ja-JP": "{name} を削除"
226
+ },
227
+ "watermark.brand.doubao": {
228
+ "zh-CN": "{name} AI 生成",
229
+ "en-US": "Generated by {name} AI",
230
+ "ja-JP": "{name} の AI により生成"
231
+ },
232
+ "watermark.brand.spark": {
233
+ "zh-CN": "妙搭生成",
234
+ "en-US": "Made with Spark",
235
+ "ja-JP": "Spark で作成"
236
+ },
237
+ "watermark.button.close": {
238
+ "zh-CN": "关闭",
239
+ "en-US": "Close",
240
+ "ja-JP": "閉じる"
241
+ },
242
+ "watermark.menu.dontShowAgain": {
243
+ "zh-CN": "不再展示",
244
+ "en-US": "Don't show again",
245
+ "ja-JP": "今後は表示しない"
246
+ },
247
+ "watermark.menu.downloadDoubao": {
248
+ "zh-CN": "下载{name}",
249
+ "en-US": "Download {name}",
250
+ "ja-JP": "{name} をダウンロード"
251
+ },
252
+ "watermark.menu.learnSpark": {
253
+ "zh-CN": "了解妙搭",
254
+ "en-US": "Learn about Spark",
255
+ "ja-JP": "Spark について"
256
+ },
257
+ "watermark.menu.report": {
258
+ "zh-CN": "投诉与举报",
259
+ "en-US": "Report a problem",
260
+ "ja-JP": "問題を報告"
261
+ }
262
+ }
@@ -123,16 +123,19 @@ async function logResponse(ok, responseOrError) {
123
123
  if (response.config.params) Object.assign(queryParams, response.config.params);
124
124
  const args = [
125
125
  {
126
- 请求参数: response.config.data,
126
+ [t('axios.log.field.requestParams')]: response.config.data,
127
127
  ...Object.keys(queryParams).length > 0 && {
128
- 查询参数: queryParams
128
+ [t('axios.log.field.queryParams')]: queryParams
129
129
  },
130
- 返回数据: response.data,
131
- 请求摘要: {
132
- 方法: method,
130
+ [t('axios.log.field.responseData')]: response.data,
131
+ [t('axios.log.field.summary')]: {
132
+ [t('axios.log.field.method')]: method,
133
133
  TraceID: logTraceID,
134
- 状态: `${response.statusText}[状态码${response.status}]`,
135
- 时间: `${new Date().toLocaleString()}`
134
+ [t('axios.log.field.status')]: t('axios.log.field.statusWithCode', {
135
+ statusText: response.statusText,
136
+ status: response.status
137
+ }),
138
+ [t('axios.log.field.time')]: `${new Date().toLocaleString()}`
136
139
  }
137
140
  }
138
141
  ];
@@ -180,17 +183,17 @@ async function logResponse(ok, responseOrError) {
180
183
  if (error.config.params) Object.assign(queryParams, error.config.params);
181
184
  const args = [
182
185
  {
183
- 请求参数: error.config.data,
186
+ [t('axios.log.field.requestParams')]: error.config.data,
184
187
  ...Object.keys(queryParams).length > 0 && {
185
- 查询参数: queryParams
188
+ [t('axios.log.field.queryParams')]: queryParams
186
189
  },
187
- 错误信息: errorMessage,
188
- 请求摘要: {
189
- 方法: method,
190
- 错误类型: errorType,
191
- 错误代码: error.code,
192
- 超时设置: error.config.timeout,
193
- 时间: `${new Date().toLocaleString()}`
190
+ [t('axios.log.field.errorMessage')]: errorMessage,
191
+ [t('axios.log.field.summary')]: {
192
+ [t('axios.log.field.method')]: method,
193
+ [t('axios.log.field.errorType')]: errorType,
194
+ [t('axios.log.field.errorCode')]: error.code,
195
+ [t('axios.log.field.timeout')]: error.config.timeout,
196
+ [t('axios.log.field.time')]: `${new Date().toLocaleString()}`
194
197
  }
195
198
  }
196
199
  ];
@@ -223,7 +226,7 @@ function handleSpanEnd(cfg, response, error) {
223
226
  if (!currentSpan) return;
224
227
  const startTime = cfg._startTime;
225
228
  const errorResponse = error?.response || {};
226
- const errorMessage = error?.message || '未知错误';
229
+ const errorMessage = error?.message || t('axios.log.unknownError');
227
230
  const url = response?.request?.responseURL || errorResponse?.request?.responseURL || cfg.url || "";
228
231
  const method = (cfg.method || 'GET').toUpperCase();
229
232
  const rawPath = url.split('?')[0].replace(/^https?:\/\/[^/]+/, '') || '/';
@@ -366,8 +369,8 @@ function initAxiosConfig(axiosInstance) {
366
369
  url
367
370
  }),
368
371
  {
369
- 状态码: 403,
370
- 返回数据: error.response.data
372
+ [t('axios.log.field.statusCode')]: 403,
373
+ [t('axios.log.field.responseData')]: error.response.data
371
374
  }
372
375
  ],
373
376
  meta: {}
@@ -1,3 +1,4 @@
1
+ import { t } from "../locales/index.js";
1
2
  async function copyToClipboard(text) {
2
3
  try {
3
4
  if (navigator.clipboard && window.isSecureContext) {
@@ -24,7 +25,7 @@ function fallbackCopyToClipboard(text) {
24
25
  document.body.removeChild(textArea);
25
26
  return successful;
26
27
  } catch (error) {
27
- console.error('降级复制方案失败:', error);
28
+ console.error(t('clipboard.log.fallbackFailed'), error);
28
29
  return false;
29
30
  }
30
31
  }
@@ -1,5 +1,6 @@
1
1
  import axios from "axios";
2
2
  import { initAxiosConfig } from "./axiosConfig.js";
3
+ import { t } from "../locales/index.js";
3
4
  let axiosInstance;
4
5
  function showToast(message, duration = 3000) {
5
6
  return new Promise((resolve)=>{
@@ -61,7 +62,7 @@ function getAxiosForBackend() {
61
62
  axiosInstance.interceptors.response.use(null, (err)=>{
62
63
  if (err.config.meta?.autoJumpToLogin !== false) {
63
64
  const loginUrl = err.response?.headers?.['x-login-url'];
64
- if (loginUrl) showToast('需要登录后才能执行操作,将自动跳转登录页', 3000).then(()=>{
65
+ if (loginUrl) showToast(t('axios.toast.loginRequired'), 3000).then(()=>{
65
66
  window.location.href = loginUrl;
66
67
  });
67
68
  }
@@ -1 +1,2 @@
1
+ /** 保留公开接口的大写环境名,环境由基础包确定。 */
1
2
  export declare function getEnv(): 'BOE' | 'PRE' | 'ONLINE';