Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

refactor!: remove built-in language packs (#2291)

白熱18311d9041c2
diff --git a/common/shared/vite/auto-externalize-dependency-plugin.js b/common/shared/vite/auto-externalize-dependency-plugin.js
index 744173d424..40b81a549c 100644
--- a/common/shared/vite/auto-externalize-dependency-plugin.js
+++ b/common/shared/vite/auto-externalize-dependency-plugin.js
@@ -1,3 +1,19 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
const process = require('node:process');
const { writeFileSync } = require('node:fs');
const { convertLibNameFromPackageName } = require('./utils');
diff --git a/common/shared/vite/build-locale.js b/common/shared/vite/build-locale.js
new file mode 100644
index 0000000000..d4b8e51730
--- /dev/null
+++ b/common/shared/vite/build-locale.js
@@ -0,0 +1,66 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const process = require('node:process');
+const fs = require('node:fs');
+const path = require('node:path');
+const esbuild = require('esbuild');
+
+exports.buildLocale = function buildLocale({ entryRoot, outDir }) {
+ return {
+ name: 'build-locale',
+ enforce: 'pre',
+ generateBundle() {
+ const srcDir = path.resolve(process.cwd(), entryRoot);
+
+ if (!fs.existsSync(srcDir)) {
+ return;
+ }
+
+ const outputDir = path.resolve(process.cwd(), outDir);
+
+ fs.readdirSync(srcDir)
+ .filter((file) => file.includes('-') && fs.statSync(path.resolve(srcDir, file)).isFile())
+ .forEach((file) => {
+ const fullPath = path.join(srcDir, file);
+
+ const syncResult = esbuild.buildSync({
+ entryPoints: [fullPath],
+ bundle: true,
+ platform: 'node',
+ format: 'cjs',
+ write: false,
+ });
+
+ // eslint-disable-next-line no-new-func
+ const module = new Function('module', `${syncResult.outputFiles[0].text};return module;`)({});
+ const result = module.exports.default;
+ const data = JSON.stringify(result, null, 2);
+
+ if (!fs.existsSync(outputDir)) {
+ fs.mkdirSync(outputDir, { recursive: true });
+ }
+
+ const outputPath = path.resolve(outputDir, file.replace('.ts', '.json'));
+
+ fs.writeFileSync(outputPath, data);
+
+ // eslint-disable-next-line no-console
+ console.log(`[vite:build-locale] ${outputPath} generated`);
+ });
+ },
+ };
+};
diff --git a/common/shared/vite/index.js b/common/shared/vite/index.js
index 22dceba706..7fb052bd41 100644
--- a/common/shared/vite/index.js
+++ b/common/shared/vite/index.js
@@ -22,6 +22,7 @@ const { default: dts } = require('vite-plugin-dts');
const react = require('@vitejs/plugin-react');
const { autoExternalizeDependency } = require('./auto-externalize-dependency-plugin');
const { obfuscator } = require('./obfuscator');
+const { buildLocale } = require('./build-locale');
const { convertLibNameFromPackageName } = require('./utils');
/**
@@ -63,6 +64,10 @@ function createViteConfig(overrideConfig, /** @type {IOptions} */ options) {
outDir: 'lib/types',
}),
obfuscator(),
+ buildLocale({
+ entryRoot: 'src/locale',
+ outDir: 'lib/locale',
+ }),
],
define: {
'process.env.NODE_ENV': JSON.stringify(mode),
diff --git a/common/shared/vite/obfuscator.js b/common/shared/vite/obfuscator.js
index 8b049adf4c..681e1d5605 100644
--- a/common/shared/vite/obfuscator.js
+++ b/common/shared/vite/obfuscator.js
@@ -1,3 +1,19 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
const process = require('node:process');
const JavaScriptObfuscator = require('javascript-obfuscator');
diff --git a/common/shared/vite/utils.js b/common/shared/vite/utils.js
index 7df873b2b8..b2a06169ce 100644
--- a/common/shared/vite/utils.js
+++ b/common/shared/vite/utils.js
@@ -1,3 +1,19 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
/**
* Convert package name to library name
* @examples `@univerjs/core` -> `UniverCore`
diff --git a/examples/src/docs-uniscript/main.ts b/examples/src/docs-uniscript/main.ts
index 1842151cdb..3d86d00007 100644
--- a/examples/src/docs-uniscript/main.ts
+++ b/examples/src/docs-uniscript/main.ts
@@ -26,11 +26,17 @@ import { UniverUniscriptPlugin } from '@univerjs/uniscript';
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';
import { UniverSheetsPlugin } from '@univerjs/sheets';
import { DEFAULT_DOCUMENT_DATA_CN } from '../data';
+import { enUS, ruRU, zhCN } from '../locales';
// univer
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
+ locales: {
+ [LocaleType.ZH_CN]: zhCN,
+ [LocaleType.EN_US]: enUS,
+ [LocaleType.RU_RU]: ruRU,
+ },
logLevel: LogLevel.VERBOSE,
});
diff --git a/examples/src/docs/locales.ts b/examples/src/docs/locales.ts
deleted file mode 100644
index 50313a3b8e..0000000000
--- a/examples/src/docs/locales.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { LocaleType } from '@univerjs/core';
-import { enUS as UniverDesignEnUS } from '@univerjs/design';
-import { enUS as UniverDocsUIEnUS } from '@univerjs/docs-ui';
-import { enUS as UniverUIEnUS } from '@univerjs/ui';
-
-export const locales = {
- [LocaleType.EN_US]: {
- ...UniverDocsUIEnUS,
- ...UniverUIEnUS,
- ...UniverDesignEnUS,
- },
-};
diff --git a/examples/src/docs/main.ts b/examples/src/docs/main.ts
index e64d733014..8d4ff1a400 100644
--- a/examples/src/docs/main.ts
+++ b/examples/src/docs/main.ts
@@ -26,7 +26,7 @@ import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { DEFAULT_DOCUMENT_DATA_CN } from '../data';
-import { locales } from './locales';
+import { enUS, ruRU, zhCN } from '../locales';
// package info
// eslint-disable-next-line no-console
@@ -41,7 +41,11 @@ console.table({
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
- locales,
+ locales: {
+ [LocaleType.ZH_CN]: zhCN,
+ [LocaleType.EN_US]: enUS,
+ [LocaleType.RU_RU]: ruRU,
+ },
});
// core plugins
diff --git a/examples/src/locales.ts b/examples/src/locales.ts
new file mode 100644
index 0000000000..dc18100795
--- /dev/null
+++ b/examples/src/locales.ts
@@ -0,0 +1,116 @@
+/**
+ * Copyright 2023-present DreamNum Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { Tools } from '@univerjs/core';
+import DesignEnUS from '@univerjs/design/locale/en-US';
+import DesignRuRU from '@univerjs/design/locale/ru-RU';
+import DesignZhCN from '@univerjs/design/locale/zh-CN';
+import DocsUIEnUS from '@univerjs/docs-ui/locale/en-US';
+import DocsUIRuRU from '@univerjs/docs-ui/locale/ru-RU';
+import DocsUIZhCN from '@univerjs/docs-ui/locale/zh-CN';
+import FindReplaceEnUS from '@univerjs/find-replace/locale/en-US';
+import FindReplaceRuRU from '@univerjs/find-replace/locale/ru-RU';
+import FindReplaceZhCN from '@univerjs/find-replace/locale/zh-CN';
+import SheetsEnUS from '@univerjs/sheets/locale/en-US';
+import SheetsRuRU from '@univerjs/sheets/locale/ru-RU';
+import SheetsZhCN from '@univerjs/sheets/locale/zh-CN';
+import SheetsUIEnUS from '@univerjs/sheets-ui/locale/en-US';
+import SheetsUIRuRU from '@univerjs/sheets-ui/locale/ru-RU';
+import SheetsUIZhCN from '@univerjs/sheets-ui/locale/zh-CN';
+import SheetsFormulaEnUS from '@univerjs/sheets-formula/locale/en-US';
+import SheetsFormulaRuRU from '@univerjs/sheets-formula/locale/ru-RU';
+import SheetsFormulaZhCN from '@univerjs/sheets-formula/locale/zh-CN';
+import SheetsDataValidationEnUS from '@univerjs/sheets-data-validation/locale/en-US';
+import SheetsDataValidationRuRU from '@univerjs/sheets-data-validation/locale/ru-RU';
+import SheetsDataValidationZhCN from '@univerjs/sheets-data-validation/locale/zh-CN';
+import SheetsConditionalFormattingUIEnUS from '@univerjs/sheets-conditional-formatting-ui/locale/en-US';
+import SheetsConditionalFormattingUIRuRU from '@univerjs/sheets-conditional-formatting-ui/locale/ru-RU';
+import SheetsConditionalFormattingUIZhCN from '@univerjs/sheets-conditional-formatting-ui/locale/zh-CN';
+import SheetsZenEditorEnUS from '@univerjs/sheets-zen-editor/locale/en-US';
+import SheetsZenEditorRuRU from '@univerjs/sheets-zen-editor/locale/ru-RU';
+import SheetsZenEditorZhCN from '@univerjs/sheets-zen-editor/locale/zh-CN';
+import UIEnUS from '@univerjs/ui/locale/en-US';
+import UIRuRU from '@univerjs/ui/locale/ru-RU';
+import UIZhCN from '@univerjs/ui/locale/zh-CN';
+import SheetsFilterUIEnUS from '@univerjs/sheets-filter-ui/locale/en-US';
+import SheetsFilterUIRuRU from '@univerjs/sheets-filter-ui/locale/ru-RU';
+import SheetsFilterUIZhCN from '@univerjs/sheets-filter-ui/locale/zh-CN';
+import SheetsThreadCommentEnUS from '@univerjs/sheets-thread-comment/locale/en-US';
+import SheetsThreadCommentRuRU from '@univerjs/sheets-thread-comment/locale/ru-RU';
+import SheetsThreadCommentZhCN from '@univerjs/sheets-thread-comment/locale/zh-CN';
+import ThreadCommentUIEnUS from '@univerjs/thread-comment-ui/locale/en-US';
+import ThreadCommentUIRuRU from '@univerjs/thread-comment-ui/locale/ru-RU';
+import ThreadCommentUIZhCN from '@univerjs/thread-comment-ui/locale/zh-CN';
+import SheetsNumfmtEnUS from '@univerjs/sheets-numfmt/locale/en-US';
+import SheetsNumfmtRuRU from '@univerjs/sheets-numfmt/locale/ru-RU';
+import SheetsNumfmtZhCN from '@univerjs/sheets-numfmt/locale/zh-CN';
+import UniscriptEnUS from '@univerjs/uniscript/locale/en-US';
+import UniscriptRuRU from '@univerjs/uniscript/locale/ru-RU';
+import UniscriptZhCN from '@univerjs/uniscript/locale/zh-CN';
+
+export const zhCN = Tools.deepMerge(
+ SheetsZhCN,
+ DocsUIZhCN,
+ FindReplaceZhCN,
+ SheetsUIZhCN,
+ SheetsFormulaZhCN,
+ SheetsDataValidationZhCN,
+ SheetsConditionalFormattingUIZhCN,
+ SheetsZenEditorZhCN,
+ UIZhCN,
+ DesignZhCN,
+ SheetsFilterUIZhCN,
+ SheetsThreadCommentZhCN,
+ ThreadCommentUIZhCN,
+ SheetsNumfmtZhCN,
+ UniscriptZhCN
+);
+
+export const enUS = Tools.deepMerge(
+ SheetsEnUS,
+ DocsUIEnUS,
+ FindReplaceEnUS,
+ SheetsUIEnUS,
+ SheetsFormulaEnUS,
+ SheetsDataValidationEnUS,
+ SheetsConditionalFormattingUIEnUS,
+ SheetsZenEditorEnUS,
+ UIEnUS,
+ DesignEnUS,
+ SheetsFilterUIEnUS,
+ SheetsThreadCommentEnUS,
+ ThreadCommentUIEnUS,
+ SheetsNumfmtEnUS,
+ UniscriptEnUS
+);
+
+export const ruRU = Tools.deepMerge(
+ SheetsRuRU,
+ DocsUIRuRU,
+ FindReplaceRuRU,
+ SheetsUIRuRU,
+ SheetsFormulaRuRU,
+ SheetsDataValidationRuRU,
+ SheetsConditionalFormattingUIRuRU,
+ SheetsZenEditorRuRU,
+ UIRuRU,
+ DesignRuRU,
+ SheetsFilterUIRuRU,
+ SheetsThreadCommentRuRU,
+ ThreadCommentUIRuRU,
+ SheetsNumfmtRuRU,
+ UniscriptRuRU
+);
diff --git a/examples/src/sheets-multi/main.tsx b/examples/src/sheets-multi/main.tsx
index 540d070bbf..bc9aaf9031 100644
--- a/examples/src/sheets-multi/main.tsx
+++ b/examples/src/sheets-multi/main.tsx
@@ -33,12 +33,18 @@ import { createRoot } from 'react-dom/client';
import { Mosaic, MosaicWindow } from 'react-mosaic-component';
import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data';
+import { enUS, ruRU, zhCN } from '../locales';
function factory(id: string) {
return function createUniverOnContainer() {
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
+ locales: {
+ [LocaleType.ZH_CN]: zhCN,
+ [LocaleType.EN_US]: enUS,
+ [LocaleType.RU_RU]: ruRU,
+ },
logLevel: LogLevel.VERBOSE,
});
diff --git a/examples/src/sheets-uniscript/main.ts b/examples/src/sheets-uniscript/main.ts
index 314f3dd735..5df1106ffe 100644
--- a/examples/src/sheets-uniscript/main.ts
+++ b/examples/src/sheets-uniscript/main.ts
@@ -29,11 +29,17 @@ import { UniverUniscriptPlugin } from '@univerjs/uniscript';
import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { UNISCRIT_WORKBOOK_DATA_DEMO } from '../data/sheets/uniscript-data';
+import { enUS, ruRU, zhCN } from '../locales';
// univer
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
+ locales: {
+ [LocaleType.ZH_CN]: zhCN,
+ [LocaleType.EN_US]: enUS,
+ [LocaleType.RU_RU]: ruRU,
+ },
logLevel: LogLevel.VERBOSE,
});
diff --git a/examples/src/sheets/locales.ts b/examples/src/sheets/locales.ts
deleted file mode 100644
index 72b9b4e1a5..0000000000
--- a/examples/src/sheets/locales.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { LocaleType, Tools } from '@univerjs/core';
-import { enUS as UniverDesignEnUS, ruRU as UniverDesignRuRU } from '@univerjs/design';
-import { enUS as UniverDocsUIEnUS, ruRU as UniverDocsUIRuRU } from '@univerjs/docs-ui';
-import { enUS as UniverSheetsEnUS, ruRU as UniverSheetsRuRU } from '@univerjs/sheets';
-import { enUS as UniverSheetsUIEnUS, ruRU as UniverSheetsUIRuRU } from '@univerjs/sheets-ui';
-import { enUS as UniverFindReplaceEnUS, ruRU as UniverFindReplaceRuRU } from '@univerjs/find-replace';
-import { enUS as UniverSheetsFormulaEnUS, ruRU as UniverSheetsFormulaRuRU } from '@univerjs/sheets-formula';
-import { enUS as UniverSheetsDataValidationEnUS, ruRU as UniverSheetsDataValidationRuRU } from '@univerjs/sheets-data-validation';
-import { enUS as UniverSheetsConditionalFormattingUIEnUS, ruRU as UniverSheetsConditionalFormattingUIRuRU } from '@univerjs/sheets-conditional-formatting-ui';
-import { enUS as UniverSheetsZenEditorEnUS, ruRU as UniverSheetsZenEditorRuRU } from '@univerjs/sheets-zen-editor';
-import { enUS as UniverUIEnUS, ruRU as UniverUIRuRU } from '@univerjs/ui';
-import { enUS as UniverSheetsFilterUIEnUS, ruRU as UniverSheetsFilterUIRuRU } from '@univerjs/sheets-filter-ui';
-
-export const locales = {
- [LocaleType.EN_US]: Tools.deepMerge(
- UniverSheetsEnUS,
- UniverDocsUIEnUS,
- UniverFindReplaceEnUS,
- UniverSheetsUIEnUS,
- UniverSheetsFormulaEnUS,
- UniverSheetsDataValidationEnUS,
- UniverSheetsConditionalFormattingUIEnUS,
- UniverSheetsZenEditorEnUS,
- UniverUIEnUS,
- UniverDesignEnUS,
- UniverSheetsFilterUIEnUS
- ),
- [LocaleType.RU_RU]: Tools.deepMerge(
- UniverSheetsRuRU,
- UniverDocsUIRuRU,
- UniverFindReplaceRuRU,
- UniverSheetsUIRuRU,
- UniverSheetsFormulaRuRU,
- UniverSheetsDataValidationRuRU,
- UniverSheetsConditionalFormattingUIRuRU,
- UniverSheetsZenEditorRuRU,
- UniverUIRuRU,
- UniverDesignRuRU,
- UniverSheetsFilterUIRuRU
- ),
-};
diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.ts
index 51477894e9..34c1ea1ca7 100644
--- a/examples/src/sheets/main.ts
+++ b/examples/src/sheets/main.ts
@@ -40,7 +40,7 @@ import { UniverDebuggerPlugin } from '@univerjs/debugger';
import { FUniver } from '@univerjs/facade';
import { IThreadCommentMentionDataService } from '@univerjs/thread-comment-ui';
import { DEFAULT_WORKBOOK_DATA_DEMO } from '../data/sheets/demo/default-workbook-data-demo';
-import { locales } from './locales';
+import { enUS, ruRU, zhCN } from '../locales';
/* eslint-disable-next-line node/prefer-global/process */
const IS_E2E: boolean = !!process.env.IS_E2E;
@@ -51,7 +51,11 @@ const LOAD_LAZY_PLUGINS_TIMEOUT = 1_000;
const univer = new Univer({
theme: defaultTheme,
locale: LocaleType.ZH_CN,
- locales,
+ locales: {
+ [LocaleType.ZH_CN]: zhCN,
+ [LocaleType.EN_US]: enUS,
+ [LocaleType.RU_RU]: ruRU,
+ },
logLevel: LogLevel.VERBOSE,
});
diff --git a/examples/src/slides/main.ts b/examples/src/slides/main.ts
index d72f52c26a..c4f6e2e6e0 100644
--- a/examples/src/slides/main.ts
+++ b/examples/src/slides/main.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { Univer, UniverInstanceType } from '@univerjs/core';
+import { LocaleType, Univer, UniverInstanceType } from '@univerjs/core';
import { greenTheme } from '@univerjs/design';
import { UniverRenderEnginePlugin } from '@univerjs/engine-render';
import { UniverSlidesPlugin } from '@univerjs/slides';
@@ -23,10 +23,17 @@ import { UniverUIPlugin } from '@univerjs/ui';
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';
import { DEFAULT_SLIDE_DATA } from '../data';
+import { enUS, ruRU, zhCN } from '../locales';
// univer
const univer = new Univer({
theme: greenTheme,
+ locale: LocaleType.ZH_CN,
+ locales: {
+ [LocaleType.ZH_CN]: zhCN,
+ [LocaleType.EN_US]: enUS,
+ [LocaleType.RU_RU]: ruRU,
+ },
});
// base-render
diff --git a/packages/design/package.json b/packages/design/package.json
index ec5cb8094c..ea2c50f97e 100644
--- a/packages/design/package.json
+++ b/packages/design/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/design/src/components/config-provider/ConfigProvider.stories.tsx b/packages/design/src/components/config-provider/ConfigProvider.stories.tsx
index 3199985436..022c1a9c50 100644
--- a/packages/design/src/components/config-provider/ConfigProvider.stories.tsx
+++ b/packages/design/src/components/config-provider/ConfigProvider.stories.tsx
@@ -17,7 +17,9 @@
import type { Meta } from '@storybook/react';
import React, { useState } from 'react';
-import { enUS, type ILocale, zhCN } from '../../locale';
+import enUS from '../../locale/en-US';
+import zhCN from '../../locale/zh-CN';
+import type { ILocale } from '../../locale/interface';
import { Button } from '../button/Button';
import { Confirm } from '../confirm/Confirm';
import { ConfigProvider } from './ConfigProvider';
@@ -47,7 +49,7 @@ export const Playground = {
<>
<Button onClick={() => handleChangeLocale(enUS)}>enUS</Button>
<Button onClick={() => handleChangeLocale(zhCN)}>zhCN</Button>
- <ConfigProvider locale={locale} mountContainer={document.body}>
+ <ConfigProvider locale={locale?.design} mountContainer={document.body}>
<Confirm visible={visible} onClose={() => setVisible(false)}>
xx
</Confirm>
diff --git a/packages/design/src/components/config-provider/ConfigProvider.tsx b/packages/design/src/components/config-provider/ConfigProvider.tsx
index c3d4c39246..d8aa1b0dc6 100644
--- a/packages/design/src/components/config-provider/ConfigProvider.tsx
+++ b/packages/design/src/components/config-provider/ConfigProvider.tsx
@@ -14,33 +14,34 @@
* limitations under the License.
*/
-import React, { createContext } from 'react';
+import React, { createContext, useMemo } from 'react';
import canUseDom from 'rc-util/lib/Dom/canUseDom';
-import type { ILocale } from '../../locale';
-import { zhCN } from '../../locale';
+import type { ILocale } from '../../locale/interface';
export interface IConfigProviderProps {
children: React.ReactNode;
- locale: ILocale;
+ locale?: ILocale['design'];
mountContainer: HTMLElement | null;
}
export const ConfigContext = createContext<Omit<IConfigProviderProps, 'children'>>({
- locale: zhCN,
mountContainer: canUseDom() ? document.body : null,
});
export function ConfigProvider(props: IConfigProviderProps) {
const { children, locale, mountContainer } = props;
- // set default locale to enUS
- let _locale: ILocale;
- if (Object.prototype.hasOwnProperty.call(locale, 'design')) {
- _locale = locale as ILocale;
- } else {
- _locale = zhCN;
- }
+ const value = useMemo(() => {
+ return {
+ locale,
+ mountContainer,
+ };
+ }, [locale, mountContainer]);
- return <ConfigContext.Provider value={{ locale: _locale, mountContainer }}>{children}</ConfigContext.Provider>;
+ return (
+ <ConfigContext.Provider value={value}>
+ {children}
+ </ConfigContext.Provider>
+ );
}
diff --git a/packages/design/src/components/config-provider/__tests__/index.spec.tsx b/packages/design/src/components/config-provider/__tests__/index.spec.tsx
index 34b54a9dfb..a25c96b64a 100644
--- a/packages/design/src/components/config-provider/__tests__/index.spec.tsx
+++ b/packages/design/src/components/config-provider/__tests__/index.spec.tsx
@@ -18,14 +18,14 @@ import { render } from '@testing-library/react';
import React, { useContext } from 'react';
import { describe, expect, it } from 'vitest';
-import type { ILocale } from '../../../locale';
-import { zhCN } from '../../../locale';
+import zhCN from '../../../locale/zh-CN';
+import type { ILocale } from '../../../locale/interface';
import { ConfigContext, ConfigProvider } from '../ConfigProvider';
describe('ConfigProvider', () => {
it('should render correctly', () => {
let _mountContainer: HTMLElement | null = null;
- let _locale: ILocale | null = null;
+ let _locale: ILocale['design'] | undefined;
function Empty() {
const { locale, mountContainer } = useContext(ConfigContext);
@@ -33,16 +33,16 @@ describe('ConfigProvider', () => {
_locale = locale;
_mountContainer = mountContainer;
- return <></>;
+ return null;
}
const root = render(
- <ConfigProvider locale={zhCN} mountContainer={document.body}>
+ <ConfigProvider locale={zhCN?.design} mountContainer={document.body}>
<Empty />
</ConfigProvider>
);
- expect(_locale).equals(zhCN);
+ expect(_locale).equals(zhCN.design);
expect(_mountContainer).equals(document.body);
root.unmount();
@@ -59,11 +59,11 @@ describe('ConfigProvider', () => {
_mountContainer = mountContainer;
- return <></>;
+ return null;
}
const root = render(
- <ConfigProvider locale={zhCN} mountContainer={mountContainer}>
+ <ConfigProvider locale={zhCN?.design} mountContainer={mountContainer}>
<Empty />
</ConfigProvider>
);
@@ -72,29 +72,4 @@ describe('ConfigProvider', () => {
root.unmount();
});
-
- it('should render correctly when locale is invalid', () => {
- const mountContainer = document.createElement('div');
- document.body.appendChild(mountContainer);
-
- let _locale: ILocale | null = null;
-
- function Empty() {
- const { locale } = useContext(ConfigContext);
-
- _locale = locale;
-
- return <></>;
- }
-
- const root = render(
- <ConfigProvider locale={{} as any} mountContainer={mountContainer}>
- <Empty />
- </ConfigProvider>
- );
-
- expect(_locale).equals(zhCN);
-
- root.unmount();
- });
});
diff --git a/packages/design/src/components/confirm/Confirm.tsx b/packages/design/src/components/confirm/Confirm.tsx
index fea0a10624..183865d42a 100644
--- a/packages/design/src/components/confirm/Confirm.tsx
+++ b/packages/design/src/components/confirm/Confirm.tsx
@@ -19,6 +19,7 @@ import React, { useContext } from 'react';
import { Button } from '../button/Button';
import { ConfigContext } from '../config-provider/ConfigProvider';
import { Dialog } from '../dialog/Dialog';
+import type { ILocale } from '../../locale/interface';
import styles from './index.module.less';
export interface IConfirmProps {
@@ -56,24 +57,39 @@ export interface IConfirmProps {
onConfirm?: () => void;
}
+function Footer(props: { locale: ILocale['design']; cancelText?: string; confirmText?: string; onClose: (() => void) | undefined; onConfirm: (() => void) | undefined }) {
+ const { locale, cancelText, confirmText, onClose, onConfirm } = props;
+
+ return (
+ <footer className={styles.confirmFooter}>
+ <Button onClick={onClose}>{cancelText ?? locale?.Confirm.cancel}</Button>
+ <Button type="primary" onClick={onConfirm}>
+ {confirmText ?? locale?.Confirm.confirm}
+ </Button>
+ </footer>
+ );
+}
+
export function Confirm(props: IConfirmProps) {
const { children, visible = false, title, cancelText, confirmText, onClose, onConfirm } = props;
const { locale } = useContext(ConfigContext);
- function Footer() {
- return (
- <footer className={styles.confirmFooter}>
- <Button onClick={onClose}>{cancelText ?? locale.design.Confirm.cancel}</Button>
- <Button type="primary" onClick={onConfirm}>
- {confirmText ?? locale.design.Confirm.confirm}
- </Button>
- </footer>
- );
- }
-
return (
- <Dialog visible={visible} title={title} footer={<Footer />} onClose={onClose}>
+ <Dialog
+ visible={visible}
+ title={title}
+ footer={(
+ <Footer
+ locale={locale!}
+ cancelText={cancelText}
+ confirmText={confirmText}
+ onClose={onClose}
+ onConfirm={onConfirm}
+ />
+ )}
+ onClose={onClose}
+ >
{children}
</Dialog>
);
diff --git a/packages/design/src/components/date-picker/DatePanel.tsx b/packages/design/src/components/date-picker/DatePanel.tsx
index 2b5c520a4a..e67fa8f19b 100644
--- a/packages/design/src/components/date-picker/DatePanel.tsx
+++ b/packages/design/src/components/date-picker/DatePanel.tsx
@@ -32,7 +32,7 @@ export const DatePanel = (props: IDatePanelProps) => {
{...props}
generateConfig={generateConfig}
prefixCls={styles.datePicker}
- locale={locale.design.Picker}
+ locale={locale?.Picker!}
/>
);
};
diff --git a/packages/design/src/components/date-picker/DatePicker.tsx b/packages/design/src/components/date-picker/DatePicker.tsx
index 98d9133367..d983f0b084 100644
--- a/packages/design/src/components/date-picker/DatePicker.tsx
+++ b/packages/design/src/components/date-picker/DatePicker.tsx
@@ -52,7 +52,7 @@ export function DatePicker(props: IDatePickerProps) {
value={value}
prefixCls={styles.datePicker}
generateConfig={generateConfig}
- locale={locale.design.Picker}
+ locale={locale?.Picker!}
suffixIcon={<CalendarSingle className={styles.datePickerSuffixIcon} />}
onChange={handleChange}
/>
diff --git a/packages/design/src/components/date-range-picker/DateRangePicker.tsx b/packages/design/src/components/date-range-picker/DateRangePicker.tsx
index dfeb070ae0..7060cd1407 100644
--- a/packages/design/src/components/date-range-picker/DateRangePicker.tsx
+++ b/packages/design/src/components/date-range-picker/DateRangePicker.tsx
@@ -51,7 +51,7 @@ export function DateRangePicker(props: IDateRangePickerProps) {
value={value}
prefixCls={styles.dateRangePicker}
generateConfig={generateConfig}
- locale={locale.design.Picker}
+ locale={locale?.Picker!}
separator={<GuideSingle />}
suffixIcon={<CalendarSingle className={styles.dateRangePickerSuffixIcon} />}
onChange={handleChange}
diff --git a/packages/design/src/components/slider/Slider.tsx b/packages/design/src/components/slider/Slider.tsx
index 46129d12cd..b85d27df49 100644
--- a/packages/design/src/components/slider/Slider.tsx
+++ b/packages/design/src/components/slider/Slider.tsx
@@ -157,7 +157,7 @@ export function Slider(props: ISliderProps) {
<div className={styles.sliderRail}>
<div ref={sliderInnerRailRef} role="track" className={styles.sliderInnerRail}>
- <Tooltip title={`${locale.design.Slider.resetTo} ${resetPoint}%`}>
+ <Tooltip title={`${locale?.Slider.resetTo} ${resetPoint}%`}>
<a className={styles.sliderResetPoint} role="reset button" onClick={handleReset} />
</Tooltip>
diff --git a/packages/design/src/index.ts b/packages/design/src/index.ts
index ad1f7dd05d..2cf01369ea 100644
--- a/packages/design/src/index.ts
+++ b/packages/design/src/index.ts
@@ -57,7 +57,6 @@ export { type ISegmentedProps, Segmented } from './components/segmented';
export { type ISliderProps, Slider } from './components/slider';
export { type ITooltipProps, Tooltip, resizeObserverCtor } from './components/tooltip';
export { type ITreeNodeProps, type ITreeProps, Tree, TreeSelectionMode, mergeTreeSelected, findSubTreeFromPath, findNodePathFromTree, filterLeafNode } from './components/tree';
-export { enUS, zhCN, ruRU } from './locale';
export { type ILocale } from './locale/interface';
export { defaultTheme, greenTheme, themeInstance } from './themes';
export { DraggableList, type IDraggableListProps } from './components/draggable-list';
diff --git a/packages/design/src/locale/index.ts b/packages/design/src/locale/index.ts
deleted file mode 100644
index 5641b7de0d..0000000000
--- a/packages/design/src/locale/index.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { type ILocale } from './interface';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/docs-ui/package.json b/packages/docs-ui/package.json
index a60908f69f..52d4d2c7c9 100644
--- a/packages/docs-ui/package.json
+++ b/packages/docs-ui/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/docs-ui/src/docs-ui-plugin.ts b/packages/docs-ui/src/docs-ui-plugin.ts
index 38989109de..7c218b7cd8 100644
--- a/packages/docs-ui/src/docs-ui-plugin.ts
+++ b/packages/docs-ui/src/docs-ui-plugin.ts
@@ -43,7 +43,6 @@ import { DefaultDocUiConfig } from './basics';
import { DOC_UI_PLUGIN_NAME } from './basics/const/plugin-name';
import { AppUIController } from './controllers';
import { DocUIController } from './controllers/doc-ui.controller';
-import { zhCN } from './locale';
import { BreakLineShortcut, DeleteLeftShortcut, DeleteRightShortcut } from './shortcuts/core-editing.shortcut';
import { DocClipboardService, IDocClipboardService } from './services/clipboard/clipboard.service';
@@ -68,8 +67,6 @@ export class UniverDocsUIPlugin extends Plugin {
) {
super();
- this._localeService.load({ zhCN });
-
this._config = Tools.deepMerge({}, DefaultDocUiConfig, this._config);
this._initDependencies(_injector);
this._initializeCommands();
diff --git a/packages/docs-ui/src/index.ts b/packages/docs-ui/src/index.ts
index 05be3ebcb0..03ff6c005b 100644
--- a/packages/docs-ui/src/index.ts
+++ b/packages/docs-ui/src/index.ts
@@ -16,6 +16,5 @@
export * from './basics';
export * from './docs-ui-plugin';
-export { enUS, zhCN, ruRU } from './locale';
export { DocCanvasView } from './views/doc-canvas-view';
export * from './services';
diff --git a/packages/docs-ui/src/locale/index.ts b/packages/docs-ui/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/docs-ui/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/facade/src/apis/__tests__/create-test-bed.ts b/packages/facade/src/apis/__tests__/create-test-bed.ts
index 78854ade5b..b5cce25efc 100644
--- a/packages/facade/src/apis/__tests__/create-test-bed.ts
+++ b/packages/facade/src/apis/__tests__/create-test-bed.ts
@@ -31,14 +31,14 @@ import { ISocketService, WebSocketService } from '@univerjs/network';
import { SelectionManagerService, SheetInterceptorService, SheetPermissionService } from '@univerjs/sheets';
import {
DescriptionService,
- enUS,
FormulaCustomFunctionService,
IDescriptionService,
IFormulaCustomFunctionService,
IRegisterFunctionService,
RegisterFunctionService,
- zhCN,
} from '@univerjs/sheets-formula';
+import enUS from '@univerjs/sheets-formula/locale/en-US';
+import zhCN from '@univerjs/sheets-formula/locale/zh-CN';
import type { Dependency } from '@wendellhu/redi';
import { Inject, Injector } from '@wendellhu/redi';
diff --git a/packages/facade/src/apis/docs/__tests__/create-test-bed.ts b/packages/facade/src/apis/docs/__tests__/create-test-bed.ts
index dbed0de461..b497ae8411 100644
--- a/packages/facade/src/apis/docs/__tests__/create-test-bed.ts
+++ b/packages/facade/src/apis/docs/__tests__/create-test-bed.ts
@@ -23,10 +23,8 @@ import {
Plugin,
Univer,
} from '@univerjs/core';
-import {
- enUS,
- zhCN,
-} from '@univerjs/sheets-formula';
+import enUS from '@univerjs/sheets-formula/locale/en-US';
+import zhCN from '@univerjs/sheets-formula/locale/zh-CN';
import type { Dependency } from '@wendellhu/redi';
import { Inject, Injector } from '@wendellhu/redi';
diff --git a/packages/facade/src/apis/sheets/__tests__/create-test-bed.ts b/packages/facade/src/apis/sheets/__tests__/create-test-bed.ts
index c5533a7f10..27c7a0e52b 100644
--- a/packages/facade/src/apis/sheets/__tests__/create-test-bed.ts
+++ b/packages/facade/src/apis/sheets/__tests__/create-test-bed.ts
@@ -30,14 +30,14 @@ import { ISocketService, WebSocketService } from '@univerjs/network';
import { SelectionManagerService, SheetInterceptorService } from '@univerjs/sheets';
import {
DescriptionService,
- enUS,
FormulaCustomFunctionService,
IDescriptionService,
IFormulaCustomFunctionService,
IRegisterFunctionService,
RegisterFunctionService,
- zhCN,
} from '@univerjs/sheets-formula';
+import enUS from '@univerjs/sheets-formula/locale/en-US';
+import zhCN from '@univerjs/sheets-formula/locale/zh-CN';
import type { Dependency } from '@wendellhu/redi';
import { Inject, Injector } from '@wendellhu/redi';
diff --git a/packages/find-replace/package.json b/packages/find-replace/package.json
index 8b2fda76d5..bf77aa89f8 100644
--- a/packages/find-replace/package.json
+++ b/packages/find-replace/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/find-replace/src/index.ts b/packages/find-replace/src/index.ts
index c7160f1d72..7dcac2f284 100644
--- a/packages/find-replace/src/index.ts
+++ b/packages/find-replace/src/index.ts
@@ -25,4 +25,3 @@ export type {
IReplaceAllResult,
} from './services/find-replace.service';
export { FindModel, IFindReplaceService, FindBy, FindScope, FindDirection } from './services/find-replace.service';
-export { enUS, zhCN, ruRU } from './locale';
diff --git a/packages/find-replace/src/locale/index.ts b/packages/find-replace/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/find-replace/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/find-replace/src/plugin.ts b/packages/find-replace/src/plugin.ts
index c46da5155b..c3cb22d9d4 100644
--- a/packages/find-replace/src/plugin.ts
+++ b/packages/find-replace/src/plugin.ts
@@ -19,7 +19,6 @@ import { type Dependency, Inject, Injector } from '@wendellhu/redi';
import type { IUniverFindReplaceConfig } from './controllers/find-replace.controller';
import { DefaultFindReplaceConfig, FindReplaceController } from './controllers/find-replace.controller';
-import { zhCN } from './locale';
import { FindReplaceService, IFindReplaceService } from './services/find-replace.service';
const PLUGIN_NAME = 'FIND_REPLACE_PLUGIN';
@@ -34,7 +33,6 @@ export class UniverFindReplacePlugin extends Plugin {
) {
super();
- this._localeService.load({ zhCN });
this._config = Tools.deepMerge({}, DefaultFindReplaceConfig, this._config);
}
diff --git a/packages/find-replace/src/views/dialog/FindReplaceDialog.stories.tsx b/packages/find-replace/src/views/dialog/FindReplaceDialog.stories.tsx
index b5cd135215..65b82355f9 100644
--- a/packages/find-replace/src/views/dialog/FindReplaceDialog.stories.tsx
+++ b/packages/find-replace/src/views/dialog/FindReplaceDialog.stories.tsx
@@ -23,7 +23,9 @@ import { DesktopLayoutService, ILayoutService } from '@univerjs/ui';
import { LocaleService, LocaleType } from '@univerjs/core';
import { FindReplaceService, IFindReplaceService } from '../../services/find-replace.service';
import { FindReplaceController } from '../../controllers/find-replace.controller';
-import { enUS, ruRU, zhCN } from '../../locale';
+import enUS from '../../locale/en-US';
+import zhCN from '../../locale/zh-CN';
+import ruRU from '../../locale/ru-RU';
import { FindReplaceDialog } from './FindReplaceDialog';
const meta: Meta = {
diff --git a/packages/sheets-conditional-formatting-ui/package.json b/packages/sheets-conditional-formatting-ui/package.json
index d1c7f677b4..42717fc2a0 100644
--- a/packages/sheets-conditional-formatting-ui/package.json
+++ b/packages/sheets-conditional-formatting-ui/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets-conditional-formatting-ui/src/controllers/cf.i18n.controller.ts b/packages/sheets-conditional-formatting-ui/src/controllers/cf.i18n.controller.ts
index 55a6c7375f..afacca42ba 100644
--- a/packages/sheets-conditional-formatting-ui/src/controllers/cf.i18n.controller.ts
+++ b/packages/sheets-conditional-formatting-ui/src/controllers/cf.i18n.controller.ts
@@ -18,7 +18,6 @@ import { Disposable, LifecycleStages, LocaleService, OnLifecycle } from '@univer
import { Inject } from '@wendellhu/redi';
import type { ReactNode } from 'react';
-import { zhCN } from '../locale';
@OnLifecycle(LifecycleStages.Rendered, ConditionalFormattingI18nController)
export class ConditionalFormattingI18nController extends Disposable {
@@ -28,7 +27,6 @@ export class ConditionalFormattingI18nController extends Disposable {
}
private _initLocal = () => {
- this._localeService.load({ zhCN });
};
public tWithReactNode(key: string, ...args: (ReactNode | string)[]) {
diff --git a/packages/sheets-conditional-formatting-ui/src/index.ts b/packages/sheets-conditional-formatting-ui/src/index.ts
index 99139533bd..990408a21d 100644
--- a/packages/sheets-conditional-formatting-ui/src/index.ts
+++ b/packages/sheets-conditional-formatting-ui/src/index.ts
@@ -15,4 +15,3 @@
*/
export { UniverSheetsConditionalFormattingUIPlugin } from './plugin';
-export { enUS, zhCN, ruRU } from './locale';
diff --git a/packages/sheets-conditional-formatting-ui/src/locale/index.ts b/packages/sheets-conditional-formatting-ui/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-conditional-formatting-ui/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-data-validation/package.json b/packages/sheets-data-validation/package.json
index 5c47f5eff8..6171490e3b 100644
--- a/packages/sheets-data-validation/package.json
+++ b/packages/sheets-data-validation/package.json
@@ -22,7 +22,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
@@ -42,6 +43,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets-data-validation/src/index.ts b/packages/sheets-data-validation/src/index.ts
index ac265a5c73..e5389bcbda 100644
--- a/packages/sheets-data-validation/src/index.ts
+++ b/packages/sheets-data-validation/src/index.ts
@@ -31,4 +31,3 @@ export { DataValidationAutoFillController } from './controllers/dv-auto-fill.con
export { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';
export { HideDataValidationDropdown, ShowDataValidationDropdown } from './commands/operations/data-validation.operation';
export { DataValidationRejectInputController } from './controllers/dv-reject-input.controller';
-export { enUS, zhCN, ruRU } from './locale';
diff --git a/packages/sheets-data-validation/src/locale/index.ts b/packages/sheets-data-validation/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-data-validation/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-data-validation/src/plugin.ts b/packages/sheets-data-validation/src/plugin.ts
index dfe42fab08..3972222c52 100644
--- a/packages/sheets-data-validation/src/plugin.ts
+++ b/packages/sheets-data-validation/src/plugin.ts
@@ -26,7 +26,6 @@ import { DataValidationCacheService } from './services/dv-cache.service';
import { DataValidationFormulaService } from './services/dv-formula.service';
import { DataValidationCustomFormulaService } from './services/dv-custom-formula.service';
import { DataValidationRefRangeController } from './controllers/dv-ref-range.controller';
-import { zhCN } from './locale';
import { DATA_VALIDATION_PLUGIN_NAME } from './common/const';
import { DataValidationAutoFillController } from './controllers/dv-auto-fill.controller';
import { DataValidationCopyPasteController } from './controllers/dv-copy-paste.controller';
@@ -92,7 +91,5 @@ export class UniverSheetsDataValidationPlugin extends Plugin {
].forEach((command) => {
this._commandService.registerCommand(command);
});
-
- this._localeService.load({ zhCN });
}
}
diff --git a/packages/sheets-filter-ui/package.json b/packages/sheets-filter-ui/package.json
index 7de2e2b798..7011d53405 100644
--- a/packages/sheets-filter-ui/package.json
+++ b/packages/sheets-filter-ui/package.json
@@ -23,7 +23,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -43,6 +44,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets-filter-ui/src/index.ts b/packages/sheets-filter-ui/src/index.ts
index f968015293..d3471b8c03 100644
--- a/packages/sheets-filter-ui/src/index.ts
+++ b/packages/sheets-filter-ui/src/index.ts
@@ -15,4 +15,3 @@
*/
export { UniverSheetsFilterUIPlugin } from './plugin';
-export { zhCN, enUS, ruRU } from './locale';
diff --git a/packages/sheets-filter-ui/src/locale/index.ts b/packages/sheets-filter-ui/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-filter-ui/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-filter-ui/src/plugin.ts b/packages/sheets-filter-ui/src/plugin.ts
index 982e84562b..c7febaf223 100644
--- a/packages/sheets-filter-ui/src/plugin.ts
+++ b/packages/sheets-filter-ui/src/plugin.ts
@@ -18,7 +18,6 @@ import { LocaleService, Plugin, Tools, UniverInstanceType } from '@univerjs/core
import type { Dependency } from '@wendellhu/redi';
import { Inject, Injector } from '@wendellhu/redi';
-import { zhCN } from './locale';
import type { IUniverSheetsFilterUIConfig } from './controllers/sheets-filter-ui.controller';
import { DefaultSheetFilterUiConfig, SheetsFilterUIController } from './controllers/sheets-filter-ui.controller';
import { SheetsFilterPanelService } from './services/sheets-filter-panel.service';
@@ -36,7 +35,6 @@ export class UniverSheetsFilterUIPlugin extends Plugin {
) {
super();
- this._localeService.load({ zhCN });
this._config = Tools.deepMerge({}, DefaultSheetFilterUiConfig, this._config);
}
diff --git a/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx b/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx
index 05db64aef6..4e60df12ef 100644
--- a/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx
+++ b/packages/sheets-filter-ui/src/views/components/SheetsFilterPanel.stories.tsx
@@ -27,7 +27,9 @@ import { SheetsFilterPanelService } from '../../services/sheets-filter-panel.ser
import { ClearSheetsFilterCriteriaCommand, ReCalcSheetsFilterCommand, SetSheetsFilterCriteriaCommand, SmartToggleSheetsFilterCommand } from '../../commands/sheets-filter.command';
import type { IOpenFilterPanelOperationParams } from '../../commands/sheets-filter.operation';
import { ChangeFilterByOperation, CloseFilterPanelOperation, OpenFilterPanelOperation } from '../../commands/sheets-filter.operation';
-import { enUS, ruRU, zhCN } from '../../locale';
+import enUS from '../../locale/en-US';
+import zhCN from '../../locale/zh-CN';
+import ruRU from '../../locale/ru-RU';
import { WithCustomFilterModelFactory, WithValuesFilterModelFactory } from '../../__testing__/data';
import { FilterPanel } from './SheetsFilterPanel';
diff --git a/packages/sheets-find-replace/src/index.ts b/packages/sheets-find-replace/src/index.ts
index 4f3d15c9f7..fd3dc5bbd0 100644
--- a/packages/sheets-find-replace/src/index.ts
+++ b/packages/sheets-find-replace/src/index.ts
@@ -14,5 +14,4 @@
* limitations under the License.
*/
-export { enUS, zhCN, ruRU } from './locale';
export { UniverSheetsFindReplacePlugin } from './plugin';
diff --git a/packages/sheets-find-replace/src/locale/index.ts b/packages/sheets-find-replace/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-find-replace/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-formula/package.json b/packages/sheets-formula/package.json
index 42c9ce1f35..31feead48b 100644
--- a/packages/sheets-formula/package.json
+++ b/packages/sheets-formula/package.json
@@ -21,7 +21,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -41,6 +42,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets-formula/src/formula-ui-plugin.ts b/packages/sheets-formula/src/formula-ui-plugin.ts
index 075141dc0f..41552f99ab 100644
--- a/packages/sheets-formula/src/formula-ui-plugin.ts
+++ b/packages/sheets-formula/src/formula-ui-plugin.ts
@@ -29,7 +29,6 @@ import { DefaultSheetFormulaConfig, FormulaUIController } from './controllers/fo
import { PromptController } from './controllers/prompt.controller';
import { TriggerCalculationController } from './controllers/trigger-calculation.controller';
import { UpdateFormulaController } from './controllers/update-formula.controller';
-import { zhCN } from './locale';
import { DescriptionService, IDescriptionService } from './services/description.service';
import {
@@ -66,8 +65,6 @@ export class UniverSheetsFormulaPlugin extends Plugin {
}
_init(): void {
- this._localeService.load({ zhCN });
-
const dependencies: Dependency[] = [
// services
[IFormulaPromptService, { useClass: FormulaPromptService }],
diff --git a/packages/sheets-formula/src/index.ts b/packages/sheets-formula/src/index.ts
index c8e293487d..6189dfc24b 100644
--- a/packages/sheets-formula/src/index.ts
+++ b/packages/sheets-formula/src/index.ts
@@ -15,7 +15,6 @@
*/
export { UniverSheetsFormulaPlugin } from './formula-ui-plugin';
-export { enUS, zhCN, ruRU } from './locale';
export { IDescriptionService } from './services/description.service';
export { DescriptionService } from './services/description.service';
export {
diff --git a/packages/sheets-formula/src/locale/index.ts b/packages/sheets-formula/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-formula/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-numfmt/package.json b/packages/sheets-numfmt/package.json
index 1357e690f5..43fbf50069 100644
--- a/packages/sheets-numfmt/package.json
+++ b/packages/sheets-numfmt/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets-numfmt/src/components/stories/Panel.stories.tsx b/packages/sheets-numfmt/src/components/stories/Panel.stories.tsx
index 03784cf1f4..458640dd4d 100644
--- a/packages/sheets-numfmt/src/components/stories/Panel.stories.tsx
+++ b/packages/sheets-numfmt/src/components/stories/Panel.stories.tsx
@@ -19,8 +19,9 @@ import { LocaleService, LocaleType } from '@univerjs/core';
import type { Dependency } from '@wendellhu/redi';
import { RediContext } from '@wendellhu/redi/react-bindings';
import React, { useContext, useState } from 'react';
-
-import { enUS, ruRU, zhCN } from '../../locale';
+import enUS from '../../locale/en-US';
+import zhCN from '../../locale/zh-CN';
+import ruRU from '../../locale/ru-RU';
import type { ISheetNumfmtPanelProps } from '../index';
import { SheetNumfmtPanel } from '../index';
import { UserHabitController } from '../../controllers/user-habit.controller';
diff --git a/packages/sheets-numfmt/src/controllers/numfmt.i18n.controller.ts b/packages/sheets-numfmt/src/controllers/numfmt.i18n.controller.ts
index f3d196047b..889d34600f 100644
--- a/packages/sheets-numfmt/src/controllers/numfmt.i18n.controller.ts
+++ b/packages/sheets-numfmt/src/controllers/numfmt.i18n.controller.ts
@@ -17,16 +17,9 @@
import { Disposable, LifecycleStages, LocaleService, OnLifecycle } from '@univerjs/core';
import { Inject } from '@wendellhu/redi';
-import { enUS, zhCN } from '../locale';
-
@OnLifecycle(LifecycleStages.Rendered, NumfmtI18nController)
export class NumfmtI18nController extends Disposable {
constructor(@Inject(LocaleService) private _localeService: LocaleService) {
super();
- this._initLocal();
}
-
- private _initLocal = () => {
- this._localeService.load({ zhCN, enUS });
- };
}
diff --git a/packages/sheets-numfmt/src/index.ts b/packages/sheets-numfmt/src/index.ts
index a6c69f419f..54ff91dae5 100644
--- a/packages/sheets-numfmt/src/index.ts
+++ b/packages/sheets-numfmt/src/index.ts
@@ -15,6 +15,5 @@
*/
export { type ISetNumfmtCommandParams, SetNumfmtCommand } from './commands/commands/set-numfmt.command';
-export { enUS, zhCN, ruRU } from './locale';
export { UniverSheetsNumfmtPlugin } from './numfmt-plugin';
export { getPatternPreview } from './utils/pattern';
diff --git a/packages/sheets-numfmt/src/locale/index.ts b/packages/sheets-numfmt/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-numfmt/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-thread-comment/package.json b/packages/sheets-thread-comment/package.json
index e16410d48d..1c64a10e94 100644
--- a/packages/sheets-thread-comment/package.json
+++ b/packages/sheets-thread-comment/package.json
@@ -20,7 +20,8 @@
"keywords": [],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -40,6 +41,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets-thread-comment/src/controllers/sheets-thread-comment.controller.ts b/packages/sheets-thread-comment/src/controllers/sheets-thread-comment.controller.ts
index 7a625975de..3a38d9b91c 100644
--- a/packages/sheets-thread-comment/src/controllers/sheets-thread-comment.controller.ts
+++ b/packages/sheets-thread-comment/src/controllers/sheets-thread-comment.controller.ts
@@ -30,7 +30,6 @@ import { DeleteCommentMutation } from '@univerjs/thread-comment';
import { SheetsThreadCommentCell } from '../views/sheets-thread-comment-cell';
import { COMMENT_SINGLE_ICON, SHEETS_THREAD_COMMENT_MODAL } from '../types/const';
import { SheetsThreadCommentPanel } from '../views/sheets-thread-comment-panel';
-import { zhCN } from '../locale';
import { SheetsThreadCommentPopupService } from '../services/sheets-thread-comment-popup.service';
import { SheetsThreadCommentModel } from '../models/sheets-thread-comment.model';
import { AddCommentShortcut, threadCommentMenuFactory, threadPanelMenuFactory } from './menu';
@@ -63,7 +62,6 @@ export class SheetsThreadCommentController extends Disposable {
this._initMenu();
this._initShortcut();
this._initComponent();
- this._initLocale();
this._initCommandListener();
this._initPanelListener();
}
@@ -133,10 +131,6 @@ export class SheetsThreadCommentController extends Disposable {
});
}
- private _initLocale() {
- this._localeService.load({ zhCN });
- }
-
private _initPanelListener() {
this.disposeWithMe(this._threadCommentPanelService.activeCommentId$.subscribe(async (commentInfo) => {
if (commentInfo) {
diff --git a/packages/sheets-thread-comment/src/locale/index.ts b/packages/sheets-thread-comment/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-thread-comment/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-ui/package.json b/packages/sheets-ui/package.json
index a2577118a2..182fe22eb2 100644
--- a/packages/sheets-ui/package.json
+++ b/packages/sheets-ui/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets-ui/src/index.ts b/packages/sheets-ui/src/index.ts
index 3f4f223f90..7f4906a21c 100644
--- a/packages/sheets-ui/src/index.ts
+++ b/packages/sheets-ui/src/index.ts
@@ -50,7 +50,6 @@ export {
export { useActiveWorkbook, useActiveWorksheet } from './components/hook';
export { whenSheetEditorFocused } from './controllers/shortcuts/utils';
export type { IEditorBridgeServiceParam } from './services/editor-bridge.service';
-export { enUS, zhCN, ruRU } from './locale';
export { AutoFillService, IAutoFillService } from './services/auto-fill/auto-fill.service';
export { getAutoFillRepeatRange } from './services/auto-fill/tools';
export type { ICopyDataPiece, ISheetAutoFillHook } from './services/auto-fill/type';
diff --git a/packages/sheets-ui/src/locale/index.ts b/packages/sheets-ui/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-ui/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-ui/src/sheets-ui-plugin.ts b/packages/sheets-ui/src/sheets-ui-plugin.ts
index 55304bdc01..c957c8265b 100644
--- a/packages/sheets-ui/src/sheets-ui-plugin.ts
+++ b/packages/sheets-ui/src/sheets-ui-plugin.ts
@@ -40,7 +40,6 @@ import { SheetRenderController } from './controllers/sheet-render.controller';
import type { IUniverSheetsUIConfig } from './controllers/sheet-ui.controller';
import { DefaultSheetUiConfig, SheetUIController } from './controllers/sheet-ui.controller';
import { StatusBarController } from './controllers/status-bar.controller';
-import { zhCN } from './locale';
import { AutoFillService, IAutoFillService } from './services/auto-fill/auto-fill.service';
import { ISheetClipboardService, SheetClipboardService } from './services/clipboard/clipboard.service';
import { CellEditorManagerService, ICellEditorManagerService } from './services/editor/cell-editor-manager.service';
@@ -88,7 +87,6 @@ export class UniverSheetsUIPlugin extends Plugin {
) {
super();
- this._localeService.load({ zhCN });
this._config = Tools.deepMerge({}, DefaultSheetUiConfig, this._config);
}
diff --git a/packages/sheets-zen-editor/package.json b/packages/sheets-zen-editor/package.json
index 091b33c898..474e38c53c 100644
--- a/packages/sheets-zen-editor/package.json
+++ b/packages/sheets-zen-editor/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets-zen-editor/src/index.ts b/packages/sheets-zen-editor/src/index.ts
index fe70aa5f90..5eff458c0e 100644
--- a/packages/sheets-zen-editor/src/index.ts
+++ b/packages/sheets-zen-editor/src/index.ts
@@ -15,4 +15,3 @@
*/
export { UniverSheetsZenEditorPlugin } from './plugin';
-export { enUS, zhCN, ruRU } from './locale';
diff --git a/packages/sheets-zen-editor/src/locale/index.ts b/packages/sheets-zen-editor/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets-zen-editor/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets-zen-editor/src/plugin.ts b/packages/sheets-zen-editor/src/plugin.ts
index 7210fdbff7..2b3117db2d 100644
--- a/packages/sheets-zen-editor/src/plugin.ts
+++ b/packages/sheets-zen-editor/src/plugin.ts
@@ -22,7 +22,6 @@ import { ZenEditorController } from './controllers/zen-editor.controller';
import type { IUniverSheetsZenEditorUIConfig } from './controllers/zen-editor-ui.controller';
import { DefaultSheetZenEditorUiConfig, ZenEditorUIController } from './controllers/zen-editor-ui.controller';
import { IZenEditorManagerService, ZenEditorManagerService } from './services/zen-editor.service';
-import { zhCN } from './locale';
export class UniverSheetsZenEditorPlugin extends Plugin {
static override pluginName = 'zen-editor';
@@ -35,15 +34,10 @@ export class UniverSheetsZenEditorPlugin extends Plugin {
) {
super();
- this._initialize();
this._initializeDependencies(this._injector);
this._config = Tools.deepMerge({}, DefaultSheetZenEditorUiConfig, this._config);
}
- private _initialize(): void {
- this._localeService.load({ zhCN });
- }
-
private _initializeDependencies(injector: Injector) {
const dependencies: Dependency[] = [
[
diff --git a/packages/sheets/package.json b/packages/sheets/package.json
index 98af8fb15f..20c638aa37 100644
--- a/packages/sheets/package.json
+++ b/packages/sheets/package.json
@@ -22,7 +22,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -42,6 +43,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/sheets/src/index.ts b/packages/sheets/src/index.ts
index ef9958b094..c232f990d6 100644
--- a/packages/sheets/src/index.ts
+++ b/packages/sheets/src/index.ts
@@ -256,7 +256,6 @@ export { getInsertRangeMutations, getRemoveRangeMutations } from './commands/uti
export { handleInsertRangeMutation } from './commands/utils/handle-range-mutation';
export { type ISheetCommandSharedParams } from './commands/utils/interface';
export { getAddMergeMutationRangeByType } from './controllers/merge-cell.controller';
-export { enUS, zhCN, ruRU } from './locale';
export { NumfmtService } from './services/numfmt/numfmt.service';
export type { INumfmtItem, INumfmtItemWithCache } from './services/numfmt/type';
export { INumfmtService } from './services/numfmt/type';
diff --git a/packages/sheets/src/locale/index.ts b/packages/sheets/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/sheets/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/sheets/src/sheets-plugin.ts b/packages/sheets/src/sheets-plugin.ts
index c07812c647..2deb3c43ca 100644
--- a/packages/sheets/src/sheets-plugin.ts
+++ b/packages/sheets/src/sheets-plugin.ts
@@ -22,7 +22,6 @@ import { BasicWorksheetController } from './controllers/basic-worksheet.controll
import { CalculateResultApplyController } from './controllers/calculate-result-apply.controller';
import { FeatureCalculationController } from './controllers/feature-calculation.controller';
import { MergeCellController } from './controllers/merge-cell.controller';
-import { zhCN } from './locale';
import { BorderStyleManagerService } from './services/border-style-manager.service';
import { NumfmtService } from './services/numfmt/numfmt.service';
import { INumfmtService } from './services/numfmt/type';
@@ -57,9 +56,6 @@ export class UniverSheetsPlugin extends Plugin {
}
override onRendered(): void {
- this._localeService.load({
- zhCN,
- });
}
private _initializeDependencies(sheetInjector: Injector) {
diff --git a/packages/slides-ui/package.json b/packages/slides-ui/package.json
index 5a5b659a82..bf1d6a047a 100644
--- a/packages/slides-ui/package.json
+++ b/packages/slides-ui/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/slides-ui/src/index.ts b/packages/slides-ui/src/index.ts
index d1478834c3..fe308b39e1 100644
--- a/packages/slides-ui/src/index.ts
+++ b/packages/slides-ui/src/index.ts
@@ -15,4 +15,3 @@
*/
export * from './slides-ui-plugin';
-export { enUS, zhCN, ruRU } from './locale';
diff --git a/packages/slides-ui/src/locale/index.ts b/packages/slides-ui/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/slides-ui/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/slides-ui/src/slides-ui-plugin.ts b/packages/slides-ui/src/slides-ui-plugin.ts
index 07554d6788..e22e45bf57 100644
--- a/packages/slides-ui/src/slides-ui-plugin.ts
+++ b/packages/slides-ui/src/slides-ui-plugin.ts
@@ -20,7 +20,6 @@ import type { Dependency } from '@wendellhu/redi';
import { Inject, Injector } from '@wendellhu/redi';
import { SlideUIController } from './controllers/slide-ui.controller';
-import { zhCN } from './locale';
export const SLIDE_UI_PLUGIN_NAME = 'slides-ui';
@@ -38,10 +37,6 @@ export class UniverSlidesUIPlugin extends Plugin {
}
override onStarting(injector: Injector): void {
- this._localeService.load({
- zhCN,
- });
-
([[SlideUIController]] as Dependency[]).forEach((d) => injector.add(d));
}
diff --git a/packages/slides/src/index.ts b/packages/slides/src/index.ts
index d71446293a..6bbb56738d 100644
--- a/packages/slides/src/index.ts
+++ b/packages/slides/src/index.ts
@@ -16,4 +16,3 @@
export * from './slides-plugin';
export * from './views/render';
-export { enUS, zhCN, ruRU } from './locale';
diff --git a/packages/slides/src/locale/index.ts b/packages/slides/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/slides/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/slides/src/slides-plugin.ts b/packages/slides/src/slides-plugin.ts
index b769187ad6..1788a24675 100644
--- a/packages/slides/src/slides-plugin.ts
+++ b/packages/slides/src/slides-plugin.ts
@@ -20,7 +20,6 @@ import { IRenderingEngine } from '@univerjs/engine-render';
import type { Dependency } from '@wendellhu/redi';
import { Inject, Injector } from '@wendellhu/redi';
-import { zhCN } from './locale';
import { CanvasView } from './views/render';
export interface IUniverSlidesConfig {}
@@ -52,9 +51,6 @@ export class UniverSlidesPlugin extends Plugin {
}
initialize(): void {
- this._localeService.load({
- zhCN,
- });
this.initCanvasEngine();
}
diff --git a/packages/thread-comment-ui/package.json b/packages/thread-comment-ui/package.json
index 83a44ce94c..0a7073dd0b 100644
--- a/packages/thread-comment-ui/package.json
+++ b/packages/thread-comment-ui/package.json
@@ -23,7 +23,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -43,6 +44,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/thread-comment-ui/src/controllers/thread-comment-ui.controller.ts b/packages/thread-comment-ui/src/controllers/thread-comment-ui.controller.ts
index cc3fbed904..e10c31ceb2 100644
--- a/packages/thread-comment-ui/src/controllers/thread-comment-ui.controller.ts
+++ b/packages/thread-comment-ui/src/controllers/thread-comment-ui.controller.ts
@@ -16,7 +16,6 @@
import { Disposable, LifecycleStages, LocaleService, OnLifecycle } from '@univerjs/core';
import { Inject } from '@wendellhu/redi';
-import { zhCN } from '../locale';
@OnLifecycle(LifecycleStages.Starting, ThreadCommentUIController)
export class ThreadCommentUIController extends Disposable {
@@ -24,11 +23,5 @@ export class ThreadCommentUIController extends Disposable {
@Inject(LocaleService) private readonly _localeService: LocaleService
) {
super();
-
- this._initLocales();
- }
-
- private _initLocales() {
- this._localeService.load({ zhCN });
}
}
diff --git a/packages/thread-comment-ui/src/locale/index.ts b/packages/thread-comment-ui/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/thread-comment-ui/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/ui/package.json b/packages/ui/package.json
index b64ea7ff5f..11109e5519 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index a6f515f016..9d70e677a2 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -30,7 +30,6 @@ export {
export { IUIController, type IWorkbenchOptions } from './controllers/ui/ui.controller';
export { DesktopUIController } from './controllers/ui/ui-desktop.controller';
export { IUIPartsService, BuiltInUIPart, UIPartsService } from './services/parts/parts.service';
-export { enUS, zhCN, ruRU } from './locale';
export { DesktopBeforeCloseService, IBeforeCloseService } from './services/before-close/before-close.service';
export { CopyCommand, CutCommand, PasteCommand } from './services/clipboard/clipboard.command';
export {
diff --git a/packages/ui/src/locale/index.ts b/packages/ui/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/ui/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/ui/src/ui-plugin.ts b/packages/ui/src/ui-plugin.ts
index 7e31da6125..ecb36d6f42 100644
--- a/packages/ui/src/ui-plugin.ts
+++ b/packages/ui/src/ui-plugin.ts
@@ -29,7 +29,6 @@ import { ShortcutPanelController } from './controllers/shortcut-display/shortcut
import type { IUniverUIConfig } from './controllers/ui/ui.controller';
import { IUIController } from './controllers/ui/ui.controller';
import { DesktopUIController } from './controllers/ui/ui-desktop.controller';
-import { zhCN } from './locale';
import { DesktopBeforeCloseService, IBeforeCloseService } from './services/before-close/before-close.service';
import { BrowserClipboardService, IClipboardInterfaceService } from './services/clipboard/clipboard-interface.service';
import { IConfirmService } from './services/confirm/confirm.service';
@@ -76,7 +75,6 @@ export class UniverUIPlugin extends Plugin {
) {
super();
- this._localeService.load({ zhCN });
this._config = Tools.deepMerge({}, DefaultUiConfig, this._config);
if (this._config.disableAutoFocus) {
diff --git a/packages/ui/src/views/App.tsx b/packages/ui/src/views/App.tsx
index 9915d8096f..f1b2e4d22f 100644
--- a/packages/ui/src/views/App.tsx
+++ b/packages/ui/src/views/App.tsx
@@ -127,7 +127,7 @@ export function App(props: IUniverAppProps) {
}, [localeService, messageService, mountContainer, portalContainer, themeService.currentTheme$]);
return (
- <ConfigProvider locale={locale} mountContainer={portalContainer}>
+ <ConfigProvider locale={locale?.design} mountContainer={portalContainer}>
{/**
* IMPORTANT! This `tabIndex` should not be moved. This attribute allows the element to catch
* all focusin event merged from its descendants. The DesktopLayoutService would listen to focusin events
diff --git a/packages/umd/package.json b/packages/umd/package.json
index 3308982779..115cae3951 100644
--- a/packages/umd/package.json
+++ b/packages/umd/package.json
@@ -76,6 +76,7 @@
"@wendellhu/redi": "0.15.2",
"clsx": "^2.1.1",
"dayjs": "^1.11.11",
+ "lodash": "^4.17.21",
"monaco-editor": "0.48.0",
"react": "18.2.0",
"react-dom": "18.2.0",
diff --git a/packages/umd/scripts/index.mjs b/packages/umd/scripts/index.mjs
index 2ae2ae79cc..880cc2ce98 100644
--- a/packages/umd/scripts/index.mjs
+++ b/packages/umd/scripts/index.mjs
@@ -24,12 +24,56 @@
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
+import lodash from 'lodash';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const nodeModulesPath = path.resolve(__dirname, '../node_modules');
+async function generateLocale() {
+ const libs = [
+ '@univerjs/design',
+ '@univerjs/docs-ui',
+ '@univerjs/find-replace',
+ '@univerjs/sheets',
+ '@univerjs/sheets-ui',
+ '@univerjs/sheets-formula',
+ '@univerjs/sheets-data-validation',
+ '@univerjs/sheets-conditional-formatting-ui',
+ '@univerjs/sheets-zen-editor',
+ '@univerjs/ui',
+ '@univerjs/sheets-filter-ui',
+ '@univerjs/sheets-thread-comment',
+ '@univerjs/slides-ui',
+ '@univerjs/thread-comment-ui',
+ '@univerjs/sheets-numfmt',
+ '@univerjs/uniscript',
+ ];
+
+ const languages = ['en-US', 'ru-RU', 'zh-CN'];
+
+ const outputDir = path.resolve(__dirname, '../lib/locale');
+ if (!fs.existsSync(outputDir)) {
+ fs.mkdirSync(outputDir, { recursive: true });
+ }
+
+ for (const lang of languages) {
+ let output = {};
+ for (const lib of libs) {
+ const file = path.resolve(nodeModulesPath, lib, `lib/locale/${lang}.json`);
+ if (!fs.existsSync(file)) {
+ throw new Error(`File not found: ${file}`);
+ }
+
+ const data = fs.readFileSync(file, 'utf-8');
+ output = lodash.merge(JSON.parse(data), output);
+ }
+
+ fs.writeFileSync(path.resolve(outputDir, `${lang}.json`), JSON.stringify(output, null, 2), 'utf-8');
+ }
+};
+
function buildCSS() {
const libs = [
'@univerjs/design',
@@ -149,7 +193,7 @@ function generateOutput(filename, output) {
fs.writeFileSync(outputFile, output, 'utf-8');
}
-function main() {
+async function main() {
generateOutput('univer.css', buildCSS());
const outputJS = buildJS();
@@ -166,6 +210,8 @@ function main() {
});
generateOutput('univer.slim.umd.js', `${slimLib}\n${outputJS}`);
+ await generateLocale();
+
// eslint-disable-next-line no-console
console.log('\u001B[32m[@univerjs/umd] Build completed.');
}
diff --git a/packages/uniscript/package.json b/packages/uniscript/package.json
index bcdc4e1135..8eafc33e55 100644
--- a/packages/uniscript/package.json
+++ b/packages/uniscript/package.json
@@ -25,7 +25,8 @@
],
"exports": {
".": "./src/index.ts",
- "./*": "./src/*"
+ "./*": "./src/*",
+ "./locale/*": "./src/locale/*.ts"
},
"main": "./lib/cjs/index.js",
"module": "./lib/es/index.js",
@@ -45,6 +46,7 @@
"require": "./lib/cjs/*",
"types": "./lib/types/index.d.ts"
},
+ "./locale/*": "./lib/locale/*.json",
"./lib/*": "./lib/*"
}
},
diff --git a/packages/uniscript/src/index.ts b/packages/uniscript/src/index.ts
index 68eccca63e..a0deebd1e3 100644
--- a/packages/uniscript/src/index.ts
+++ b/packages/uniscript/src/index.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-export { enUS, zhCN, ruRU } from './locale';
export { UniverUniscriptPlugin } from './plugin';
export { ScriptEditorService } from './services/script-editor.service';
export { IUniscriptExecutionService } from './services/script-execution.service';
diff --git a/packages/uniscript/src/locale/index.ts b/packages/uniscript/src/locale/index.ts
deleted file mode 100644
index ab1fcfc7ee..0000000000
--- a/packages/uniscript/src/locale/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Copyright 2023-present DreamNum Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export { default as enUS } from './en-US';
-export { default as zhCN } from './zh-CN';
-export { default as ruRU } from './ru-RU';
diff --git a/packages/uniscript/src/plugin.ts b/packages/uniscript/src/plugin.ts
index 8c6766b0a0..1eb567b75c 100644
--- a/packages/uniscript/src/plugin.ts
+++ b/packages/uniscript/src/plugin.ts
@@ -20,7 +20,6 @@ import { Inject, Injector } from '@wendellhu/redi';
import type { IUniverUniscriptConfig } from './controllers/uniscript.controller';
import { DefaultUniscriptConfig, UniscriptController } from './controllers/uniscript.controller';
-import { zhCN } from './locale';
import { ScriptEditorService } from './services/script-editor.service';
import { IUniscriptExecutionService, UniscriptExecutionService } from './services/script-execution.service';
import { ScriptPanelService } from './services/script-panel.service';
@@ -53,8 +52,6 @@ export class UniverUniscriptPlugin extends Plugin {
dependencies.forEach((d) => injector.add(d));
this.registerExecution();
-
- this._localeService.load({ zhCN });
}
/**
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1cf2fea65a..387bda1126 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1918,6 +1918,9 @@ importers:
dayjs:
specifier: ^1.11.11
version: 1.11.11
+ lodash:
+ specifier: ^4.17.21
+ version: 4.17.21
monaco-editor:
specifier: 0.48.0
version: 0.48.0