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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
refactor(debugger): refactor localization handling in debugger package (#5251)
白熱67c2f7107c3e
diff --git a/examples/.gitignore b/examples/.gitignoreindex 2dae1a5cee..bc2e208629 100644--- a/examples/.gitignore+++ b/examples/.gitignore@@ -1,4 +1,3 @@-src/locales.tspublic!public/index.html!public/favicon.svgdiff --git a/examples/package.json b/examples/package.jsonindex 70c18714f3..ff224087dc 100644--- a/examples/package.json+++ b/examples/package.json@@ -8,7 +8,7 @@"./*": "./src/*"},"scripts": {- "prepare": "tsx ./scripts/generate-locales.ts && tsx ./scripts/generate-html.ts",+ "prepare": "tsx ./scripts/generate-html.ts","build:demo": "tsx ./esbuild.config.ts","dev:demo": "tsx ./esbuild.config.ts --watch","dev:e2e": "tsx ./esbuild.config.ts --watch --e2e",diff --git a/examples/scripts/generate-locales.ts b/examples/scripts/generate-locales.tsdeleted file mode 100644index 15cffea848..0000000000--- a/examples/scripts/generate-locales.ts+++ /dev/null@@ -1,76 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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 path from 'node:path';-import { fileURLToPath } from 'node:url';-import fs from 'fs-extra';--const __dirname = path.dirname(fileURLToPath(import.meta.url));--/**- * Generate locales files- */-async function generateLocales() {- const pkg = fs.readJSONSync(path.resolve(__dirname, '../package.json'));- const output = path.resolve(__dirname, '../src/locales.ts');- const locales = ['en-US', 'fr-FR', 'ru-RU', 'zh-CN', 'zh-TW', 'vi-VN', 'fa-IR'];-- const header = `/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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';-`;-- const deps = Object.keys(pkg.dependencies)- .filter((dep) => dep.startsWith('@univerjs') && fs.existsSync(path.resolve(__dirname, `../node_modules/${dep}/src/locale`)));-- const importStatements = deps.reduce((acc, dep) => {- const formattedDep = dep.replace(/(@univerjs\/|\-)/g, '');- locales.forEach((locale) => {- acc += `import ${formattedDep}${locale.replace(/-/g, '')} from '${dep}/locale/${locale}';\n`;- });- return acc;- }, '');-- const exportStatements = locales.reduce((acc, locale) => {- const formattedLocale = locale.replace(/-/g, '');- const depStatements = deps.map((dep) => {- return ` ${dep.replace(/(@univerjs\/|\-)/g, '')}${formattedLocale}`;- }).join(',\n');-- acc += `export const ${formattedLocale} = Tools.deepMerge(\n {},\n${depStatements}\n);\n`;- return acc;- }, '');-- const content = `${header}\n${importStatements}\n${exportStatements}`;-- fs.writeFileSync(output, content);-}--generateLocales();diff --git a/examples/src/docs-uniscript/main.ts b/examples/src/docs-uniscript/main.tsindex ce4f227084..4c0e884e9c 100644--- a/examples/src/docs-uniscript/main.ts+++ b/examples/src/docs-uniscript/main.ts@@ -20,12 +20,11 @@ import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_DOCUMENT_DATA_CN } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverSheetsPlugin } from '@univerjs/sheets';-import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverUIPlugin } from '@univerjs/ui';import { UniverUniscriptPlugin } from '@univerjs/uniscript';-import { enUS, faIR, ruRU, zhCN } from '../locales';import '../global.css';@@ -34,9 +33,6 @@ const univer = new Univer({locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.RU_RU]: ruRU,- [LocaleType.FA_IR]: faIR,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/docs/main.ts b/examples/src/docs/main.tsindex 1b4f6b0f20..7262c21ad1 100644--- a/examples/src/docs/main.ts+++ b/examples/src/docs/main.ts@@ -27,8 +27,8 @@ import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_DOCUMENT_DATA_SIMPLE } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverUIPlugin } from '@univerjs/ui';-import { enUS, faIR, ruRU, zhCN } from '../locales';import '../global.css';@@ -40,9 +40,6 @@ const univer = new Univer({locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.RU_RU]: ruRU,- [LocaleType.FA_IR]: faIR,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/mobile-s/main.ts b/examples/src/mobile-s/main.tsindex 2696978f83..299038cc75 100644--- a/examples/src/mobile-s/main.ts+++ b/examples/src/mobile-s/main.ts@@ -21,6 +21,7 @@ import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsConditionalFormattingMobileUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';@@ -32,16 +33,14 @@ import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';import { UniverSheetsMobileUIPlugin } from '@univerjs/sheets-ui';import { UniverMobileUIPlugin } from '@univerjs/ui';-import { enUS, faIR } from '../locales';import '../global.css';// univerconst univer = new Univer({- locale: LocaleType.EN_US,+ locale: LocaleType.ZH_CN,locales: {- [LocaleType.EN_US]: enUS,- [LocaleType.FA_IR]: faIR,+ [LocaleType.ZH_CN]: zhCN,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/node/sdk/index.ts b/examples/src/node/sdk/index.tsindex f0c5ab82e9..d28ed538f4 100644--- a/examples/src/node/sdk/index.ts+++ b/examples/src/node/sdk/index.ts@@ -21,6 +21,7 @@ import { UniverDocsPlugin } from '@univerjs/docs';import { UniverDocsDrawingPlugin } from '@univerjs/docs-drawing';import { UniverDrawingPlugin } from '@univerjs/drawing';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverRPCNodeMainPlugin } from '@univerjs/rpc-node';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';@@ -32,8 +33,6 @@ import { UniverSheetsHyperLinkPlugin } from '@univerjs/sheets-hyper-link';import { UniverSheetsSortPlugin } from '@univerjs/sheets-sort';import { UniverThreadCommentPlugin } from '@univerjs/thread-comment';-import { enUS } from '../../locales';-import './facade';export interface ICreateUniverOnNodeOptions {@@ -44,9 +43,9 @@ export function createUniverOnNode(options: ICreateUniverOnNodeOptions = {}): Unconst { useComputingWorker = false } = options;const univer = new Univer({- locale: LocaleType.EN_US,+ locale: LocaleType.ZH_CN,locales: {- [LocaleType.EN_US]: enUS,+ [LocaleType.ZH_CN]: zhCN,},});diff --git a/examples/src/sheets-multi-units/main.ts b/examples/src/sheets-multi-units/main.tsindex 7758cc05b3..82d69ba7a0 100644--- a/examples/src/sheets-multi-units/main.ts+++ b/examples/src/sheets-multi-units/main.ts@@ -22,6 +22,7 @@ import { UniverDocsMentionUIPlugin } from '@univerjs/docs-mention-ui';import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';@@ -38,7 +39,6 @@ import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';import { UniverUIPlugin } from '@univerjs/ui';-import { enUS, faIR, frFR, ruRU, viVN, zhCN, zhTW } from '../locales';import '@univerjs/sheets/facade';import '@univerjs/ui/facade';import '@univerjs/docs-ui/facade';@@ -74,12 +74,6 @@ const univer = new Univer({locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.FR_FR]: frFR,- [LocaleType.RU_RU]: ruRU,- [LocaleType.ZH_TW]: zhTW,- [LocaleType.VI_VN]: viVN,- [LocaleType.FA_IR]: faIR,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/sheets-multi/main.tsx b/examples/src/sheets-multi/main.tsxindex 243b1023a6..bd505f5190 100644--- a/examples/src/sheets-multi/main.tsx+++ b/examples/src/sheets-multi/main.tsx@@ -21,6 +21,7 @@ import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';@@ -30,7 +31,6 @@ import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverUIPlugin } from '@univerjs/ui';import { useEffect } from 'react';import { Mosaic, MosaicWindow } from 'react-mosaic-component';-import { enUS, faIR, frFR, ruRU, zhCN } from '../locales';import 'react-mosaic-component/react-mosaic-component.css';@@ -42,10 +42,6 @@ function factory(id: string) {locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.FR_FR]: frFR,- [LocaleType.RU_RU]: ruRU,- [LocaleType.FA_IR]: faIR,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/sheets-uniscript/main.ts b/examples/src/sheets-uniscript/main.tsindex 4b93646345..d7180064ce 100644--- a/examples/src/sheets-uniscript/main.ts+++ b/examples/src/sheets-uniscript/main.ts@@ -21,6 +21,7 @@ import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { UNISCRIT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';@@ -28,7 +29,6 @@ import { UniverSheetsNumfmtUIPlugin } from '@univerjs/sheets-numfmt-ui';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverUIPlugin } from '@univerjs/ui';import { UniverUniscriptPlugin } from '@univerjs/uniscript';-import { enUS, faIR, ruRU, zhCN } from '../locales';import '../global.css';@@ -37,9 +37,6 @@ const univer = new Univer({locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.RU_RU]: ruRU,- [LocaleType.FA_IR]: faIR,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/sheets-webcomponent/main.tsx b/examples/src/sheets-webcomponent/main.tsxindex 3c73aba55e..e7e4e39e16 100644--- a/examples/src/sheets-webcomponent/main.tsx+++ b/examples/src/sheets-webcomponent/main.tsx@@ -22,6 +22,7 @@ import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';@@ -32,7 +33,6 @@ import { UniverUIPlugin } from '@univerjs/ui';import { html, LitElement } from 'lit';import { customElement } from 'lit/decorators.js';import React from 'react';-import { enUS, faIR, frFR, ruRU, zhCN } from '../locales';import '../global.css';// 创建 Lit Element@@ -45,10 +45,6 @@ class MyWebComponent extends LitElement {locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.FR_FR]: frFR,- [LocaleType.RU_RU]: ruRU,- [LocaleType.FA_IR]: faIR,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/sheets-webcomponent/univer.tsx b/examples/src/sheets-webcomponent/univer.tsxindex 1b6d4bd64e..0929e4b656 100644--- a/examples/src/sheets-webcomponent/univer.tsx+++ b/examples/src/sheets-webcomponent/univer.tsx@@ -20,6 +20,7 @@ import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';@@ -28,7 +29,6 @@ import { UniverSheetsNumfmtUIPlugin } from '@univerjs/sheets-numfmt-ui';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverUIPlugin } from '@univerjs/ui';import { useEffect, useRef } from 'react';-import { enUS, faIR, frFR, ruRU, zhCN } from '../locales';import '../global.css';@@ -40,10 +40,6 @@ export function UniverComponent() {locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.FR_FR]: frFR,- [LocaleType.RU_RU]: ruRU,- [LocaleType.FA_IR]: faIR,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.tsindex 68989f4855..6f95b8d4c7 100644--- a/examples/src/sheets/main.ts+++ b/examples/src/sheets/main.ts@@ -22,6 +22,7 @@ import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverNetworkPlugin } from '@univerjs/network';import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';import { UniverSheetsPlugin } from '@univerjs/sheets';@@ -38,7 +39,6 @@ import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-commentimport { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';import { UniverUIPlugin } from '@univerjs/ui';-import { enUS, faIR, frFR, ruRU, viVN, zhCN, zhTW } from '../locales';import ImportCSVButtonPlugin from './custom-plugin/import-csv-button';import '@univerjs/sheets/facade';@@ -87,12 +87,6 @@ function createNewInstance() {locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.FR_FR]: frFR,- [LocaleType.RU_RU]: ruRU,- [LocaleType.ZH_TW]: zhTW,- [LocaleType.VI_VN]: viVN,- [LocaleType.FA_IR]: faIR,},logLevel: LogLevel.VERBOSE,});diff --git a/examples/src/sheets/worker.ts b/examples/src/sheets/worker.tsindex 1c2c0ee5da..97cd766704 100644--- a/examples/src/sheets/worker.ts+++ b/examples/src/sheets/worker.ts@@ -16,11 +16,11 @@import { LocaleType, LogLevel, Univer } from '@univerjs/core';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { UniverRemoteSheetsFormulaPlugin } from '@univerjs/sheets-formula';-import { enUS, faIR, ruRU, viVN, zhCN, zhTW } from '../locales';// Univer web worker is also a univer application.const univer = new Univer({@@ -28,11 +28,6 @@ const univer = new Univer({logLevel: LogLevel.VERBOSE,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.RU_RU]: ruRU,- [LocaleType.ZH_TW]: zhTW,- [LocaleType.VI_VN]: viVN,- [LocaleType.FA_IR]: faIR,},});diff --git a/examples/src/slides/main.ts b/examples/src/slides/main.tsindex 5e2c091d60..b7c193b511 100644--- a/examples/src/slides/main.ts+++ b/examples/src/slides/main.ts@@ -19,13 +19,12 @@ import { UniverDocsPlugin } from '@univerjs/docs';import { UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverDrawingPlugin } from '@univerjs/drawing';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';-import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_SLIDE_DATA } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverSlidesPlugin } from '@univerjs/slides';import { UniverSlidesUIPlugin } from '@univerjs/slides-ui';import { UniverUIPlugin } from '@univerjs/ui';-import { enUS, faIR, ruRU, zhCN } from '../locales';import '../global.css';@@ -34,9 +33,6 @@ const univer = new Univer({locale: LocaleType.ZH_CN,locales: {[LocaleType.ZH_CN]: zhCN,- [LocaleType.EN_US]: enUS,- [LocaleType.RU_RU]: ruRU,- [LocaleType.FA_IR]: faIR,},});diff --git a/examples/src/uni/main.ts b/examples/src/uni/main.tsindex b09e66e16b..f22ca035a7 100644--- a/examples/src/uni/main.ts+++ b/examples/src/uni/main.ts@@ -23,6 +23,7 @@ import { DocUIController, UniverDocsUIPlugin } from '@univerjs/docs-ui';import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { DEFAULT_DOCUMENT_DATA_CN, DEFAULT_DOCUMENT_DATA_EN, DEFAULT_SLIDE_DATA, DEFAULT_WORKBOOK_DATA_DEMO, DEFAULT_WORKBOOK_DATA_DEMO1 } from '@univerjs/mockdata';+import zhCN from '@univerjs/mockdata/locales/zh-CN';import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';@@ -44,7 +45,6 @@ import { UniverDocUniFormulaPlugin } from '@univerjs/uni-formula';import { UniSheetsUIController } from '@univerjs/uni-sheets-ui';import { UniSlidesUIController } from '@univerjs/uni-slides-ui';import { UniverUniUIPlugin } from '@univerjs/uniui';-import { enUS, faIR } from '../locales';import '../global.css';@@ -52,10 +52,9 @@ const LOAD_LAZY_PLUGINS_TIMEOUT = 4_000;// univerconst univer = new Univer({- locale: LocaleType.EN_US,+ locale: LocaleType.ZH_CN,locales: {- [LocaleType.EN_US]: enUS,- [LocaleType.FA_IR]: faIR,+ [LocaleType.ZH_CN]: zhCN,},logLevel: LogLevel.VERBOSE,});diff --git a/mockdata/.gitignore b/mockdata/.gitignorenew file mode 100644index 0000000000..aa93b95b1d--- /dev/null+++ b/mockdata/.gitignore@@ -0,0 +1 @@+src/localesdiff --git a/mockdata/package.json b/mockdata/package.jsonindex d3770ea326..842519e766 100644--- a/mockdata/package.json+++ b/mockdata/package.json@@ -19,9 +19,13 @@},"exports": {".": "./src/index.ts",+ "./locales/*": "./src/locales/*.ts","./*": "./src/*"},"main": "./src/index.ts",+ "scripts": {+ "prepare": "tsx ./scripts/generate-locales.ts"+ },"dependencies": {"@univerjs/core": "workspace:*","@univerjs/data-validation": "workspace:*",@@ -38,10 +42,39 @@"@univerjs/sheets-hyper-link": "workspace:*","@univerjs/sheets-sort": "workspace:*","@univerjs/sheets-thread-comment": "workspace:*",- "@univerjs/thread-comment": "workspace:*"+ "@univerjs/thread-comment": "workspace:*",+ "@univerjs/action-recorder": "workspace:*",+ "@univerjs/design": "workspace:*",+ "@univerjs/docs-drawing-ui": "workspace:*",+ "@univerjs/docs-hyper-link-ui": "workspace:*",+ "@univerjs/docs-quick-insert-ui": "workspace:*",+ "@univerjs/docs-ui": "workspace:*",+ "@univerjs/drawing-ui": "workspace:*",+ "@univerjs/find-replace": "workspace:*",+ "@univerjs/sheets-conditional-formatting-ui": "workspace:*",+ "@univerjs/sheets-crosshair-highlight": "workspace:*",+ "@univerjs/sheets-data-validation-ui": "workspace:*",+ "@univerjs/sheets-drawing-ui": "workspace:*",+ "@univerjs/sheets-filter-ui": "workspace:*",+ "@univerjs/sheets-find-replace": "workspace:*",+ "@univerjs/sheets-formula-ui": "workspace:*",+ "@univerjs/sheets-hyper-link-ui": "workspace:*",+ "@univerjs/sheets-note-ui": "workspace:*",+ "@univerjs/sheets-numfmt-ui": "workspace:*",+ "@univerjs/sheets-sort-ui": "workspace:*",+ "@univerjs/sheets-table-ui": "workspace:*",+ "@univerjs/sheets-thread-comment-ui": "workspace:*",+ "@univerjs/sheets-ui": "workspace:*",+ "@univerjs/sheets-zen-editor": "workspace:*",+ "@univerjs/slides-ui": "workspace:*",+ "@univerjs/thread-comment-ui": "workspace:*",+ "@univerjs/ui": "workspace:*",+ "@univerjs/uniscript": "workspace:*",+ "@univerjs/uni-formula-ui": "workspace:*"},"devDependencies": {"@univerjs-infra/shared": "workspace:*",+ "fs-extra": "^11.3.0","typescript": "^5.8.3"}}diff --git a/mockdata/scripts/generate-locales.ts b/mockdata/scripts/generate-locales.tsnew file mode 100644index 0000000000..08fd7928f8--- /dev/null+++ b/mockdata/scripts/generate-locales.ts@@ -0,0 +1,83 @@+/**+ * Copyright 2023-present DreamNum Co., Ltd.+ *+ * 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 path from 'node:path';+import { fileURLToPath } from 'node:url';+import fs from 'fs-extra';++const __dirname = path.dirname(fileURLToPath(import.meta.url));++const locales = [+ 'en-US',+ 'fr-FR',+ 'ru-RU',+ 'zh-CN',+ 'zh-TW',+ 'vi-VN',+ 'fa-IR',+];++/**+ * Generate locales files+ */+async function generateLocales() {+ const packageNames: string[] = [];++ const pkgJsonFile = fs.readJsonSync(path.resolve(__dirname, '../package.json'));++ const packages = fs.readdirSync(path.resolve(__dirname, '../../packages'))+ .filter((dir) => fs.statSync(path.join(__dirname, '../../packages', dir)).isDirectory())+ .map((dir) => path.join(__dirname, '../../packages', dir));++ const experimentalPackages = fs.readdirSync(path.resolve(__dirname, '../../packages-experimental'))+ .filter((dir) => fs.statSync(path.join(__dirname, '../../packages-experimental', dir)).isDirectory())+ .map((dir) => path.join(__dirname, '../../packages-experimental', dir));++ const allPackages = [...packages, ...experimentalPackages];+ for (const pkg of allPackages) {+ const localePath = path.join(pkg, 'src/locale');+ if (fs.existsSync(localePath)) {+ const pkgJson = fs.readJSONSync(path.join(pkg, 'package.json'));+ packageNames.push(pkgJson.name);+ pkgJsonFile.dependencies[pkgJson.name] = 'workspace:*';+ }+ }++ fs.writeJsonSync(path.resolve(__dirname, '../package.json'), pkgJsonFile, { spaces: 4, EOL: '\n' });++ locales.forEach((locale) => {+ let statements = '/* eslint-disable */\n' + 'import { merge } from \'@univerjs/core\';\n\n';++ packageNames.forEach((pkg) => {+ const pkgName = pkg.replace(/@|univerjs|\/|-/g, '');+ statements += `import ${pkgName}Locale from '${pkg}/locale/${locale}';\n`;+ });++ statements += '\nexport default merge(\n {},\n';++ packageNames.forEach((pkg) => {+ const pkgName = pkg.replace(/@|univerjs|\/|-/g, '');+ statements += ` ${pkgName}Locale,\n`;+ });+ statements += ');\n';++ const outputPath = path.resolve(__dirname, `../src/locales/${locale}.ts`);+ fs.ensureDirSync(path.dirname(outputPath));+ fs.writeFileSync(outputPath, statements);+ });+}++generateLocales();diff --git a/packages-experimental/debugger/package.json b/packages-experimental/debugger/package.jsonindex 517c877e4b..1e61d96e94 100644--- a/packages-experimental/debugger/package.json+++ b/packages-experimental/debugger/package.json@@ -20,8 +20,7 @@"keywords": [],"exports": {".": "./src/index.ts",- "./*": "./src/*",- "./locale/*": "./src/locale/*.ts"+ "./*": "./src/*"},"main": "./src/index.ts","types": "./lib/types/index.d.ts",@@ -40,11 +39,6 @@"require": "./lib/cjs/*","types": "./lib/types/index.d.ts"},- "./locale/*": {- "import": "./lib/es/locale/*.js",- "require": "./lib/cjs/locale/*.js",- "types": "./lib/types/locale/*.d.ts"- },"./lib/*": "./lib/*"}},diff --git a/packages-experimental/debugger/src/locale/en-US.ts b/packages-experimental/debugger/src/locale/en-US.tsdeleted file mode 100644index 305e32bf00..0000000000--- a/packages-experimental/debugger/src/locale/en-US.ts+++ /dev/null@@ -1,53 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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 type zhCN from './zh-CN';--const locale: typeof zhCN = {- 'univer-watermark': {- title: 'Watermark',- type: 'Type',- text: 'Text',- image: 'Image',- uploadImage: 'Upload Image',- replaceImage: 'Replace Image',- keepRatio: 'Keep Ratio',- width: 'Width',- height: 'Height',- style: 'Style Settings',- content: 'Content',- textPlaceholder: 'Enter text',- fontSize: 'Font Size',- direction: 'Direction',- ltr: 'Left to Right',- rtl: 'Right to Left',- inherits: 'Inherit',- opacity: 'Opacity',- layout: 'Layout Settings',- rotate: 'Rotate',- repeat: 'Repeat',- spacingX: 'Horizontal Spacing',- spacingY: 'Vertical Spacing',- startX: 'Horizontal Start Position',- startY: 'Vertical Start Position',-- cancel: 'Cancel Watermark',- close: 'Close Panel',- copy: 'Copy Config',- },-};--export default locale;diff --git a/packages-experimental/debugger/src/locale/fa-IR.ts b/packages-experimental/debugger/src/locale/fa-IR.tsdeleted file mode 100644index 8d361ad584..0000000000--- a/packages-experimental/debugger/src/locale/fa-IR.ts+++ /dev/null@@ -1,53 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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 type zhCN from './zh-CN';--const locale: typeof zhCN = {- 'univer-watermark': {- title: 'علامت آب',- type: 'نوع',- text: 'متن',- image: 'تصویر',- uploadImage: 'آپلود تصویر',- replaceImage: 'جایگزینی تصویر',- keepRatio: 'حفظ نسبت',- width: 'عرض',- height: 'ارتفاع',- style: 'تنظیمات سبک',- content: 'محتوا',- textPlaceholder: 'متن را وارد کنید',- fontSize: 'اندازه فونت',- direction: 'جهت',- ltr: 'چپ به راست',- rtl: 'راست به چپ',- inherits: 'ارث بردن',- opacity: 'شفافیت',- layout: 'تنظیمات چیدمان',- rotate: 'چرخاندن',- repeat: 'تکرار',- spacingX: 'فاصله افقی',- spacingY: 'فاصله عمودی',- startX: 'موقعیت شروع افقی',- startY: 'موقعیت شروع عمودی',-- cancel: 'لغو علامت آب',- close: 'بستن پنل',- copy: 'کپی تنظیمات',- },-};--export default locale;diff --git a/packages-experimental/debugger/src/locale/fr-FR.ts b/packages-experimental/debugger/src/locale/fr-FR.tsdeleted file mode 100644index 91510fa887..0000000000--- a/packages-experimental/debugger/src/locale/fr-FR.ts+++ /dev/null@@ -1,53 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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 type enUS from './en-US';--const locale: typeof enUS = {- 'univer-watermark': {- title: 'Filigrane',- type: 'Type',- text: 'Texte',- image: 'Image',- uploadImage: 'Télécharger une image',- replaceImage: 'Remplacer l\'image',- keepRatio: 'Conserver les proportions',- width: 'Largeur',- height: 'Hauteur',- style: 'Paramètres de style',- content: 'Contenu',- textPlaceholder: 'Saisir du texte',- fontSize: 'Taille de police',- direction: 'Direction',- ltr: 'De gauche à droite',- rtl: 'De droite à gauche',- inherits: 'Hériter',- opacity: 'Opacité',- layout: 'Paramètres de mise en page',- rotate: 'Rotation',- repeat: 'Répéter',- spacingX: 'Espacement horizontal',- spacingY: 'Espacement vertical',- startX: 'Position horizontale de départ',- startY: 'Position verticale de départ',-- cancel: 'Annuler le filigrane',- close: 'Fermer le panneau',- copy: 'Copier la configuration',- },-};--export default locale;diff --git a/packages-experimental/debugger/src/locale/ru-RU.ts b/packages-experimental/debugger/src/locale/ru-RU.tsdeleted file mode 100644index 9a20f02cc0..0000000000--- a/packages-experimental/debugger/src/locale/ru-RU.ts+++ /dev/null@@ -1,53 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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 type zhCN from './zh-CN';--const locale: typeof zhCN = {- 'univer-watermark': {- title: 'Водяной знак',- type: 'Тип',- text: 'Текст',- image: 'Изображение',- uploadImage: 'Загрузить изображение',- replaceImage: 'Заменить изображение',- keepRatio: 'Сохранить пропорции',- width: 'Ширина',- height: 'Высота',- style: 'Настройки стиля',- content: 'Содержание',- textPlaceholder: 'Введите текст',- fontSize: 'Размер шрифта',- direction: 'Направление',- ltr: 'Слева направо',- rtl: 'Справа налево',- inherits: 'Наследовать',- opacity: 'Прозрачность',- layout: 'Настройки макета',- rotate: 'Поворот',- repeat: 'Повтор',- spacingX: 'Горизонтальный интервал',- spacingY: 'Вертикальный интервал',- startX: 'Горизонтальная начальная позиция',- startY: 'Вертикальная начальная позиция',-- cancel: 'Отменить водяной знак',- close: 'Закрыть панель',- copy: 'Копировать конфигурацию',- },-};--export default locale;diff --git a/packages-experimental/debugger/src/locale/vi-VN.ts b/packages-experimental/debugger/src/locale/vi-VN.tsdeleted file mode 100644index dd561cd666..0000000000--- a/packages-experimental/debugger/src/locale/vi-VN.ts+++ /dev/null@@ -1,53 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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 type zhCN from './zh-CN';--const locale: typeof zhCN = {- 'univer-watermark': {- title: 'Hình mờ',- type: 'Loại',- text: 'Văn bản',- image: 'Hình ảnh',- uploadImage: 'Tải lên hình ảnh',- replaceImage: 'Thay thế hình ảnh',- keepRatio: 'Giữ tỷ lệ',- width: 'Chiều rộng',- height: 'Chiều cao',- style: 'Cài đặt kiểu',- content: 'Nội dung',- textPlaceholder: 'Nhập văn bản',- fontSize: 'Kích thước phông chữ',- direction: 'Hướng',- ltr: 'Trái sang phải',- rtl: 'Phải sang trái',- inherits: 'Thừa kế',- opacity: 'Độ mờ',- layout: 'Cài đặt bố cục',- rotate: 'Xoay',- repeat: 'Lặp lại',- spacingX: 'Khoảng cách ngang',- spacingY: 'Khoảng cách dọc',- startX: 'Vị trí bắt đầu ngang',- startY: 'Vị trí bắt đầu dọc',-- cancel: 'Hủy hình mờ',- close: 'Đóng bảng điều khiển',- copy: 'Sao chép cấu hình',- },-};--export default locale;diff --git a/packages-experimental/debugger/src/locale/zh-CN.ts b/packages-experimental/debugger/src/locale/zh-CN.tsdeleted file mode 100644index 4cfbc700c8..0000000000--- a/packages-experimental/debugger/src/locale/zh-CN.ts+++ /dev/null@@ -1,51 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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 locale = {- 'univer-watermark': {- title: '水印',- type: '类型',- text: '文本',- image: '图片',- uploadImage: '上传图片',- replaceImage: '替换图片',- keepRatio: '保持比例',- width: '长度',- height: '高度',- style: '样式设置',- content: '内容',- textPlaceholder: '请输入文本',- fontSize: '字体大小',- direction: '方向',- ltr: '从左到右',- rtl: '从右到左',- inherits: '继承',- opacity: '透明度',- layout: '布局设置',- rotate: '旋转',- repeat: '重复',- spacingX: '水平间距',- spacingY: '垂直间距',- startX: '水平起始位置',- startY: '垂直起始位置',-- cancel: '取消水印',- close: '关闭面板',- copy: '复制配置',- },-};--export default locale;diff --git a/packages-experimental/debugger/src/locale/zh-TW.ts b/packages-experimental/debugger/src/locale/zh-TW.tsdeleted file mode 100644index 287ad63c1c..0000000000--- a/packages-experimental/debugger/src/locale/zh-TW.ts+++ /dev/null@@ -1,53 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * 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 type zhCN from './zh-CN';--const locale: typeof zhCN = {- 'univer-watermark': {- title: '浮水印',- type: '類型',- text: '文字',- image: '圖片',- uploadImage: '上傳圖片',- replaceImage: '替換圖片',- keepRatio: '保持比例',- width: '長度',- height: '高度',- style: '樣式設置',- content: '內容',- textPlaceholder: '請輸入文字',- fontSize: '字體大小',- direction: '方向',- ltr: '從左到右',- rtl: '從右到左',- inherits: '繼承',- opacity: '透明度',- layout: '佈局設置',- rotate: '旋轉',- repeat: '重複',- spacingX: '水平間距',- spacingY: '垂直間距',- startX: '水平起始位置',- startY: '垂直起始位置',-- cancel: '取消浮水印',- close: '關閉面板',- copy: '複製配置',- },-};--export default locale;diff --git a/packages-experimental/debugger/src/views/use-locale.ts b/packages-experimental/debugger/src/views/use-locale.tsindex e2286a2831..e3db606d4e 100644--- a/packages-experimental/debugger/src/views/use-locale.ts+++ b/packages-experimental/debugger/src/views/use-locale.ts@@ -48,15 +48,50 @@ const locales = [export function useLocale() {const localeService = useDependency(LocaleService);+ async function loadLocales(value: string) {+ let locales;+ switch (value) {+ case LocaleType.ZH_CN:+ locales = await import('@univerjs/mockdata/locales/zh-CN');+ break;+ case LocaleType.ZH_TW:+ locales = await import('@univerjs/mockdata/locales/zh-TW');+ break;+ case LocaleType.FR_FR:+ locales = await import('@univerjs/mockdata/locales/fr-FR');+ break;+ case LocaleType.RU_RU:+ locales = await import('@univerjs/mockdata/locales/ru-RU');+ break;+ case LocaleType.VI_VN:+ locales = await import('@univerjs/mockdata/locales/vi-VN');+ break;+ case LocaleType.EN_US:+ default:+ locales = await import('@univerjs/mockdata/locales/en-US');+ break;+ }++ localeService.load({+ [value]: locales.default,+ });+ }+useEffect(() => {const locale = localStorage.getItem('local.locale');+if (locale) {- localeService.setLocale(locale as LocaleType);+ loadLocales(locale).then(() => {+ localeService.setLocale(locale as LocaleType);+ });}}, []);- const onSelect = (value: string) => {+ const onSelect = async (value: string) => {+ await loadLocales(value);+localeService.setLocale(value as LocaleType);+localStorage.setItem('local.locale', value);};diff --git a/packages-experimental/debugger/src/views/use-watermark.ts b/packages-experimental/debugger/src/views/use-watermark.tsindex 49141f96e2..ce695f6319 100644--- a/packages-experimental/debugger/src/views/use-watermark.ts+++ b/packages-experimental/debugger/src/views/use-watermark.ts@@ -14,17 +14,15 @@* limitations under the License.*/-import { LocaleService } from '@univerjs/core';import { ISidebarService, useDependency } from '@univerjs/ui';import { WATERMARK_PANEL, WATERMARK_PANEL_FOOTER } from '../controllers/watermark.menu.controller';export function useWatermark() {const sidebarService = useDependency(ISidebarService);- const localeService = useDependency(LocaleService);const onSelect = () => {sidebarService.open({- header: { title: localeService.t('univer-watermark.title') },+ header: { title: 'Watermark' },children: { label: WATERMARK_PANEL },footer: { label: WATERMARK_PANEL_FOOTER },onClose: () => { },diff --git a/packages-experimental/debugger/src/views/watermark/WatermarkImageSetting.tsx b/packages-experimental/debugger/src/views/watermark/WatermarkImageSetting.tsxindex 9e75c73074..92a75cb9cf 100644--- a/packages-experimental/debugger/src/views/watermark/WatermarkImageSetting.tsx+++ b/packages-experimental/debugger/src/views/watermark/WatermarkImageSetting.tsx@@ -15,7 +15,6 @@*/import type { IImageWatermarkConfig } from '@univerjs/engine-render';-import { LocaleService } from '@univerjs/core';import { Button, Checkbox, InputNumber } from '@univerjs/design';import { ILocalFileService, useDependency } from '@univerjs/ui';import { WATERMARK_IMAGE_ALLOW_IMAGE_LIST } from '@univerjs/watermark';@@ -27,7 +26,6 @@ interface IWatermarkImageSettingProps {export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSettingProps) {const fileOpenService = useDependency(ILocalFileService);- const localeService = useDependency(LocaleService);if (!config) return null;@@ -64,19 +62,19 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSettireturn (<div className="univer-grid univer-gap-2">- <div className="univer-text-gray-400">{localeService.t('univer-watermark.image')}</div>+ <div className="univer-text-gray-400">Image</div><div className="univer-mb-4 univer-grid univer-gap-1"><ButtonclassName="univer-mb-2"onClick={handleUpdateImageUrl}>- {config.url ? localeService.t('univer-watermark.replaceImage') : localeService.t('univer-watermark.uploadImage')}+ {config.url ? 'Replace Image' : 'Upload Image'}</Button><div className="univer-flex univer-gap-2 univer-text-center"><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.opacity')}</div>+ <div>Opacity</div><InputNumberclassName="univer-box-border univer-h-7"value={config.opacity}@@ -92,7 +90,7 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti</div><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.keepRatio')}</div>+ <div>Keep Ratio</div><CheckboxclassName="univer-justify-center univer-self-baseline"checked={config.maintainAspectRatio}@@ -111,7 +109,7 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti<div className="univer-grid univer-gap-2 univer-text-center"><div className="univer-flex univer-gap-2"><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.width')}</div>+ <div>Width</div><InputNumberclassName="univer-box-border univer-h-7"value={config.width}@@ -130,7 +128,7 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti</div><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.height')}</div>+ <div>Height</div><InputNumberclassName="univer-box-border univer-h-7"value={config.height}@@ -150,12 +148,12 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti</div></div>- <div className="univer-text-gray-400">{localeService.t('univer-watermark.layout')}</div>+ <div className="univer-text-gray-400">Layout Settings</div><div className="univer-grid univer-gap-2 univer-text-center"><div className="univer-flex univer-gap-2"><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.rotate')}</div>+ <div>Rotate</div><InputNumberclassName="univer-box-border univer-h-7"value={config.rotate}@@ -169,7 +167,7 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti/></div><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.repeat')}</div>+ <div>Repeat</div><CheckboxclassName="univer-justify-center univer-self-baseline"checked={config.repeat}@@ -179,7 +177,7 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti</div><div className="univer-flex univer-gap-2"><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.spacingX')}</div>+ <div>Horizontal Spacing</div><InputNumberclassName="univer-box-border univer-h-7"value={config.spacingX}@@ -193,7 +191,7 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti</div><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.spacingY')}</div>+ <div>Vertical Spacing</div><InputNumberclassName="univer-box-border univer-h-7"value={config.spacingY}@@ -208,7 +206,7 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti</div><div className="univer-flex univer-gap-2"><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.startX')}</div>+ <div>Horizontal Start Position</div><InputNumberclassName="univer-box-border univer-h-7"value={config.x}@@ -222,7 +220,7 @@ export function WatermarkImageSetting({ config, onChange }: IWatermarkImageSetti</div><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.startY')}</div>+ <div>Vertical Start Position</div><InputNumberclassName="univer-box-border univer-h-7"value={config.y}diff --git a/packages-experimental/debugger/src/views/watermark/WatermarkPanel.tsx b/packages-experimental/debugger/src/views/watermark/WatermarkPanel.tsxindex a1540b4d53..1d6064d41a 100644--- a/packages-experimental/debugger/src/views/watermark/WatermarkPanel.tsx+++ b/packages-experimental/debugger/src/views/watermark/WatermarkPanel.tsx@@ -15,22 +15,21 @@*/import type { IWatermarkConfig, IWatermarkConfigWithType } from '@univerjs/engine-render';-import { ILocalStorageService, LocaleService } from '@univerjs/core';+import { ILocalStorageService } from '@univerjs/core';import { Select } from '@univerjs/design';import { IWatermarkTypeEnum, UNIVER_WATERMARK_STORAGE_KEY } from '@univerjs/engine-render';import { useDependency, useObservable } from '@univerjs/ui';import { WatermarkImageBaseConfig, WatermarkService, WatermarkTextBaseConfig } from '@univerjs/watermark';-import React, { useCallback, useEffect, useState } from 'react';+import { useCallback, useEffect, useState } from 'react';import { WatermarkImageSetting } from './WatermarkImageSetting';import { WatermarkTextSetting } from './WatermarkTextSetting';-export const WatermarkPanel: React.FC = () => {+export function WatermarkPanel() {const [watermarkType, setWatermarkType] = useState<IWatermarkTypeEnum>(IWatermarkTypeEnum.Text);const [config, setConfig] = useState<IWatermarkConfig>();const watermarkService = useDependency(WatermarkService);const localStorageService = useDependency(ILocalStorageService);const _refresh = useObservable(watermarkService.refresh$);- const localeService = useDependency(LocaleService);function handleConfigChange(config: IWatermarkConfig, type?: IWatermarkTypeEnum) {setConfig(config);@@ -55,12 +54,12 @@ export const WatermarkPanel: React.FC = () => {<div className="univer-grid univer-gap-3 univer-text-sm">{/* Watermark type */}<div className="univer-grid univer-gap-2">- <div className="univer-text-gray-400">{localeService.t('univer-watermark.type')}</div>+ <div className="univer-text-gray-400">Type</div><Selectvalue={watermarkType}options={[- { label: localeService.t('univer-watermark.text'), value: IWatermarkTypeEnum.Text },- { label: localeService.t('univer-watermark.image'), value: IWatermarkTypeEnum.Image },+ { label: 'Text', value: IWatermarkTypeEnum.Text },+ { label: 'Image', value: IWatermarkTypeEnum.Image },]}onChange={(v) => {setWatermarkType(v as IWatermarkTypeEnum);diff --git a/packages-experimental/debugger/src/views/watermark/WatermarkPanelFooter.tsx b/packages-experimental/debugger/src/views/watermark/WatermarkPanelFooter.tsxindex ec2b3e4838..d48a1561a9 100644--- a/packages-experimental/debugger/src/views/watermark/WatermarkPanelFooter.tsx+++ b/packages-experimental/debugger/src/views/watermark/WatermarkPanelFooter.tsx@@ -14,7 +14,6 @@* limitations under the License.*/-import { LocaleService } from '@univerjs/core';import { Button } from '@univerjs/design';import { IWatermarkTypeEnum } from '@univerjs/engine-render';import { IClipboardInterfaceService, ISidebarService, useDependency } from '@univerjs/ui';@@ -23,7 +22,6 @@ import { WatermarkService, WatermarkTextBaseConfig } from '@univerjs/watermark';export function WatermarkPanelFooter() {const sidebarService = useDependency(ISidebarService);const watermarkService = useDependency(WatermarkService);- const localeService = useDependency(LocaleService);const clipboardService = useDependency(IClipboardInterfaceService);return (@@ -38,7 +36,7 @@ export function WatermarkPanelFooter() {watermarkService.refresh();}}>- {localeService.t('univer-watermark.cancel')}+ Cancel Watermark</a><div className="univer-flex univer-items-center univer-gap-2">@@ -54,7 +52,7 @@ export function WatermarkPanelFooter() {clipboardService.writeText(JSON.stringify(config));}}>- {localeService.t('univer-watermark.copy')}+ Copy Config</Button><ButtononClick={async () => {@@ -67,7 +65,7 @@ export function WatermarkPanelFooter() {sidebarService.close();}}>- {localeService.t('univer-watermark.close')}+ Close Panel</Button></div></div>diff --git a/packages-experimental/debugger/src/views/watermark/WatermarkTextSetting.tsx b/packages-experimental/debugger/src/views/watermark/WatermarkTextSetting.tsxindex 6bcca8419d..681ee2322a 100644--- a/packages-experimental/debugger/src/views/watermark/WatermarkTextSetting.tsx+++ b/packages-experimental/debugger/src/views/watermark/WatermarkTextSetting.tsx@@ -15,10 +15,8 @@*/import type { ITextWatermarkConfig } from '@univerjs/engine-render';-import { LocaleService } from '@univerjs/core';import { Checkbox, clsx, ColorPicker, Dropdown, Input, InputNumber, Select } from '@univerjs/design';import { BoldSingle, FontColor, ItalicSingle } from '@univerjs/icons';-import { useDependency } from '@univerjs/ui';interface IWatermarkTextSettingProps {config?: ITextWatermarkConfig;@@ -27,27 +25,26 @@ interface IWatermarkTextSettingProps {export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {const { config, onChange } = props;- const localeService = useDependency(LocaleService);if (!config) return null;return (<div className="univer-grid univer-gap-2">- <div className="univer-text-gray-400">{localeService.t('univer-watermark.style')}</div>+ <div className="univer-text-gray-400">Style Settings</div><div className="univer-mb-4 univer-grid univer-gap-1">- <div>{localeService.t('univer-watermark.content')}</div>+ <div>Content</div><Inputvalue={config.content}onChange={(val) => onChange({ ...config, content: val })}- placeholder={localeService.t('univer-watermark.textPlaceholder')}+ placeholder="Enter text"/></div><div className="univer-grid univer-gap-4"><div className="univer-flex univer-gap-2"><div className="univer-grid univer-gap-1">- <div>{localeService.t('univer-watermark.fontSize')}</div>+ <div>Font Size</div><InputNumbervalue={config.fontSize}max={72}@@ -61,19 +58,19 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {</div><div className="univer-grid univer-gap-1">- <div>{localeService.t('univer-watermark.direction')}</div>+ <div>Direction</div><Selectvalue={config.direction}options={[- { label: localeService.t('univer-watermark.ltr'), value: 'ltr' },- { label: localeService.t('univer-watermark.rtl'), value: 'rtl' },+ { label: 'Left to Right', value: 'ltr' },+ { label: 'Right to Left', value: 'rtl' },]}onChange={(v) => onChange({ ...config, direction: v as 'ltr' | 'rtl' })}/></div><div className="univer-grid univer-gap-1">- <div>{localeService.t('univer-watermark.opacity')}</div>+ <div>Opacity</div><InputNumbermax={1}min={0}@@ -137,12 +134,12 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {</div>{/* Layout */}- <div className="univer-text-gray-400">{localeService.t('univer-watermark.layout')}</div>+ <div className="univer-text-gray-400">Layout Settings</div><div className="univer-grid univer-gap-2 univer-text-center"><div className="univer-flex univer-gap-2"><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.rotate')}</div>+ <div>Rotate</div><InputNumbervalue={config.rotate}max={360}@@ -155,7 +152,7 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {/></div><div className="univer-grid univer-flex-1 univer-gap-1">- <div>{localeService.t('univer-watermark.repeat')}</div>+ <div>Repeat</div><CheckboxclassName="univer-justify-center univer-self-baseline"checked={config.repeat}@@ -165,7 +162,7 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {</div><div className="univer-flex univer-gap-2"><div className="univer-grid univer-gap-1">- <div>{localeService.t('univer-watermark.spacingX')}</div>+ <div>Horizontal Spacing</div><InputNumbervalue={config.spacingX}min={0}@@ -178,7 +175,7 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {</div><div className="univer-grid univer-gap-1">- <div>{localeService.t('univer-watermark.spacingY')}</div>+ <div>Vertical Spacing</div><InputNumbervalue={config.spacingY}min={0}@@ -193,7 +190,7 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {<div className="univer-flex univer-gap-2"><div className="univer-grid univer-gap-1">- <div>{localeService.t('univer-watermark.startX')}</div>+ <div>Horizontal Start Position</div><InputNumbervalue={config.x}min={0}@@ -206,7 +203,7 @@ export function WatermarkTextSetting(props: IWatermarkTextSettingProps) {</div><div className="univer-grid univer-gap-1">- <div>{localeService.t('univer-watermark.startY')}</div>+ <div>Vertical Start Position</div><InputNumbervalue={config.y}min={0}diff --git a/packages/docs-quick-insert-ui/src/views/QuickInsertPopup.tsx b/packages/docs-quick-insert-ui/src/views/QuickInsertPopup.tsxindex 6470378907..d019e05a4b 100644--- a/packages/docs-quick-insert-ui/src/views/QuickInsertPopup.tsx+++ b/packages/docs-quick-insert-ui/src/views/QuickInsertPopup.tsx@@ -256,7 +256,7 @@ export const QuickInsertPopup = () => {key={menu.id}className={clsx('univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm', {'hover:univer-bg-transparent': !isFocused,- 'univer-bg-gray-100 dark:univer-bg-gray-500': isFocused,+ 'univer-bg-gray-100 dark:!univer-bg-gray-500': isFocused,})}onClick={() => {handleMenuSelect(menu as IDocPopupMenuItem);diff --git a/packages/docs-quick-insert-ui/src/views/menu/index.tsx b/packages/docs-quick-insert-ui/src/views/menu/index.tsxindex bd6de166e1..872fa72677 100644--- a/packages/docs-quick-insert-ui/src/views/menu/index.tsx+++ b/packages/docs-quick-insert-ui/src/views/menu/index.tsx@@ -74,13 +74,13 @@ export const QuickInsertButton = ({ className = '' }: IQuickInsertButtonProps) =layoutService.focus();});});+return (<divclassName={clsx(`univer-mr-1 univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-fulluniver-p-1.5 univer-shadow-sm- dark:hover:!univer-bg-gray-700- dark:univer-text-gray-200+ dark:!univer-text-gray-200 dark:hover:!univer-bg-gray-700hover:univer-bg-gray-100`, borderClassName, {'univer-bg-gray-100 dark:!univer-bg-gray-700': editPopup,@@ -90,7 +90,12 @@ export const QuickInsertButton = ({ className = '' }: IQuickInsertButtonProps) =tabIndex={0}onClick={onClick}>- <PlusSingle className="univer-text-gray-800 dark:univer-text-gray-200" />+ <PlusSingle+ className={`+ univer-text-gray-800+ dark:!univer-text-gray-200+ `}+ /></div>);};diff --git a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsx b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsxindex b1a1ce4c85..b105f5c297 100644--- a/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsx+++ b/packages/sheets-ui/src/views/sheet-bar/sheet-bar-tabs/SheetBarItem.tsx@@ -15,24 +15,26 @@*/import type { BooleanNumber } from '@univerjs/core';+import type { CSSProperties, ReactNode } from 'react';import { ColorKit, ThemeService } from '@univerjs/core';import { clsx } from '@univerjs/design';import { useDependency } from '@univerjs/ui';-import React, { useEffect, useState } from 'react';+import { useEffect, useState } from 'react';export interface IBaseSheetBarProps {- label?: React.ReactNode;+ label?: ReactNode;children?: any[];index?: number;color?: string;sheetId?: string;- style?: React.CSSProperties;+ style?: CSSProperties;hidden?: BooleanNumber;selected?: boolean;+ menuOverlay?: ReactNode;}export function SheetBarItem(props: IBaseSheetBarProps) {- const { sheetId, label, color, selected } = props;+ const { sheetId, label, color, selected, menuOverlay } = props;const [currentSelected, setCurrentSelected] = useState(selected);@@ -61,8 +63,8 @@ export function SheetBarItem(props: IBaseSheetBarProps) {dark:!univer-text-white`, currentSelected? `- univer-flex univer-justify-center univer-bg-white univer-font-bold univer-text-primary-700- univer-shadow-sm univer-transition-shadow+ univer-justify-center univer-bg-white univer-font-bold univer-text-primary-700 univer-shadow-sm+ univer-transition-shadowdark:!univer-bg-gray-900`: `diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 8c81a0d222..1fd6dc9f65 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -545,58 +545,145 @@ importers:mockdata:dependencies:+ '@univerjs/action-recorder':+ specifier: workspace:*+ version: link:../packages/action-recorder'@univerjs/core':specifier: workspace:*version: link:../packages/core'@univerjs/data-validation':specifier: workspace:*version: link:../packages/data-validation+ '@univerjs/design':+ specifier: workspace:*+ version: link:../packages/design'@univerjs/docs':specifier: workspace:*version: link:../packages/docs'@univerjs/docs-drawing':specifier: workspace:*version: link:../packages/docs-drawing+ '@univerjs/docs-drawing-ui':+ specifier: workspace:*+ version: link:../packages/docs-drawing-ui+ '@univerjs/docs-hyper-link-ui':+ specifier: workspace:*+ version: link:../packages/docs-hyper-link-ui+ '@univerjs/docs-quick-insert-ui':+ specifier: workspace:*+ version: link:../packages/docs-quick-insert-ui+ '@univerjs/docs-ui':+ specifier: workspace:*+ version: link:../packages/docs-ui'@univerjs/drawing':specifier: workspace:*version: link:../packages/drawing+ '@univerjs/drawing-ui':+ specifier: workspace:*+ version: link:../packages/drawing-ui'@univerjs/engine-render':specifier: workspace:*version: link:../packages/engine-render+ '@univerjs/find-replace':+ specifier: workspace:*+ version: link:../packages/find-replace'@univerjs/sheets':specifier: workspace:*version: link:../packages/sheets'@univerjs/sheets-conditional-formatting':specifier: workspace:*version: link:../packages/sheets-conditional-formatting+ '@univerjs/sheets-conditional-formatting-ui':+ specifier: workspace:*+ version: link:../packages/sheets-conditional-formatting-ui+ '@univerjs/sheets-crosshair-highlight':+ specifier: workspace:*+ version: link:../packages/sheets-crosshair-highlight'@univerjs/sheets-data-validation':specifier: workspace:*version: link:../packages/sheets-data-validation+ '@univerjs/sheets-data-validation-ui':+ specifier: workspace:*+ version: link:../packages/sheets-data-validation-ui'@univerjs/sheets-drawing':specifier: workspace:*version: link:../packages/sheets-drawing+ '@univerjs/sheets-drawing-ui':+ specifier: workspace:*+ version: link:../packages/sheets-drawing-ui'@univerjs/sheets-filter':specifier: workspace:*version: link:../packages/sheets-filter+ '@univerjs/sheets-filter-ui':+ specifier: workspace:*+ version: link:../packages/sheets-filter-ui+ '@univerjs/sheets-find-replace':+ specifier: workspace:*+ version: link:../packages/sheets-find-replace'@univerjs/sheets-formula':specifier: workspace:*version: link:../packages/sheets-formula+ '@univerjs/sheets-formula-ui':+ specifier: workspace:*+ version: link:../packages/sheets-formula-ui'@univerjs/sheets-hyper-link':specifier: workspace:*version: link:../packages/sheets-hyper-link+ '@univerjs/sheets-hyper-link-ui':+ specifier: workspace:*+ version: link:../packages/sheets-hyper-link-ui+ '@univerjs/sheets-note-ui':+ specifier: workspace:*+ version: link:../packages/sheets-note-ui+ '@univerjs/sheets-numfmt-ui':+ specifier: workspace:*+ version: link:../packages/sheets-numfmt-ui'@univerjs/sheets-sort':specifier: workspace:*version: link:../packages/sheets-sort+ '@univerjs/sheets-sort-ui':+ specifier: workspace:*+ version: link:../packages/sheets-sort-ui+ '@univerjs/sheets-table-ui':+ specifier: workspace:*+ version: link:../packages/sheets-table-ui'@univerjs/sheets-thread-comment':specifier: workspace:*version: link:../packages/sheets-thread-comment+ '@univerjs/sheets-thread-comment-ui':+ specifier: workspace:*+ version: link:../packages/sheets-thread-comment-ui+ '@univerjs/sheets-ui':+ specifier: workspace:*+ version: link:../packages/sheets-ui+ '@univerjs/sheets-zen-editor':+ specifier: workspace:*+ version: link:../packages/sheets-zen-editor+ '@univerjs/slides-ui':+ specifier: workspace:*+ version: link:../packages/slides-ui'@univerjs/thread-comment':specifier: workspace:*version: link:../packages/thread-comment+ '@univerjs/thread-comment-ui':+ specifier: workspace:*+ version: link:../packages/thread-comment-ui+ '@univerjs/ui':+ specifier: workspace:*+ version: link:../packages/ui+ '@univerjs/uni-formula-ui':+ specifier: workspace:*+ version: link:../packages-experimental/uni-formula-ui+ '@univerjs/uniscript':+ specifier: workspace:*+ version: link:../packages/uniscriptdevDependencies:'@univerjs-infra/shared':specifier: workspace:*version: link:../common/shared+ fs-extra:+ specifier: ^11.3.0+ version: 11.3.0typescript:specifier: ^5.8.3version: 5.8.3