From 69c980edbf885234375db2b00dc7e15c1bb82aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E7=86=B1?= Date: Wed, 27 Nov 2024 12:08:24 +0800 Subject: [PATCH] feat: add `fr-FR` locale (#20) --- .../export-virtual-locales-module.ts.spec.ts | 2 +- .../core/src/export-virtual-locales-module.ts | 2 +- packages/esbuild-plugin/README.md | 3 +- packages/esbuild-plugin/types.d.ts | 1 + packages/vite-plugin/README.md | 3 +- packages/vite-plugin/types.d.ts | 1 + packages/webpack-plugin/README.md | 3 +- packages/webpack-plugin/types.d.ts | 1 + pnpm-lock.yaml | 55 ++++++++----------- 9 files changed, 34 insertions(+), 37 deletions(-) diff --git a/packages/core/src/__tests__/export-virtual-locales-module.ts.spec.ts b/packages/core/src/__tests__/export-virtual-locales-module.ts.spec.ts index d67d18a..02c3a9e 100644 --- a/packages/core/src/__tests__/export-virtual-locales-module.ts.spec.ts +++ b/packages/core/src/__tests__/export-virtual-locales-module.ts.spec.ts @@ -13,7 +13,6 @@ describe('export-virtual-locales-module', () => { 'node_modules/@univerjs/ui/lib/es/locale/en-US.js': '/* en-US locale */', 'node_modules/@univerjs/ui/lib/es/locale/zh-CN.js': '/* zh-CN locale */', 'node_modules/@univerjs/ui/lib/es/locale/ru-RU.js': '/* ru-RU locale */', - 'node_modules/@univerjs/ui/lib/locale/ru-RU.json': '/* ru-RU locale */', 'node_modules/@univerjs/design/lib/locale/vi-VN.json': '/* vi-VN locale */', 'node_modules/@univerjs/design/lib/index.css': '/* univerjs design css */', @@ -36,5 +35,6 @@ describe('export-virtual-locales-module', () => { expect(outputCode).toMatch(/export const enUS = _Tools.deepMerge\([a-zA-Z]{8}enUS,\n\);/) expect(outputCode).toMatch(/export const ruRU = _Tools.deepMerge\([a-zA-Z]{8}ruRU,\n\);/) expect(outputCode).toMatch(/export const zhCN = _Tools.deepMerge\([a-zA-Z]{8}zhCN,\n\);/) + expect(outputCode).toMatch(/export const viVN = _Tools.deepMerge\([a-zA-Z]{8}viVN,\n\);/) }) }) diff --git a/packages/core/src/export-virtual-locales-module.ts b/packages/core/src/export-virtual-locales-module.ts index 042eab3..951c0a6 100644 --- a/packages/core/src/export-virtual-locales-module.ts +++ b/packages/core/src/export-virtual-locales-module.ts @@ -12,7 +12,7 @@ export const virtualLocalesModuleId = 'univer:locales' export function exportVirtualLocalesModule() { const scopes = ['@univerjs', '@univerjs-pro'] - const languages = ['en-US', 'ru-RU', 'zh-CN', 'vi-VN', 'zh-TW', 'fa-IR'].reduce((acc, lang) => { + const languages = ['en-US', 'ru-RU', 'zh-CN', 'vi-VN', 'zh-TW', 'fa-IR', 'fr-FR'].reduce((acc, lang) => { acc[lang] = new Set() return acc }, {}) diff --git a/packages/esbuild-plugin/README.md b/packages/esbuild-plugin/README.md index 9431ff7..a98ac0a 100644 --- a/packages/esbuild-plugin/README.md +++ b/packages/esbuild-plugin/README.md @@ -44,7 +44,7 @@ The plugin provides a virtual module `univer:locales`, which simplifies the impo ```typescript import { LocaleType } from '@univerjs/core' -import { enUS, faIR, ruRU, viVN, zhCN, zhTW } from 'univer:locales' +import { enUS, faIR, frFR, ruRU, viVN, zhCN, zhTW } from 'univer:locales' new Univer({ locales: { @@ -54,6 +54,7 @@ new Univer({ [LocaleType.VI_VN]: viVN, [LocaleType.ZH_TW]: zhTW, [LocaleType.FA_IR]: faIR, + [LocaleType.FR_FR]: frFR, } }) ``` diff --git a/packages/esbuild-plugin/types.d.ts b/packages/esbuild-plugin/types.d.ts index 7a5abb6..5df445c 100644 --- a/packages/esbuild-plugin/types.d.ts +++ b/packages/esbuild-plugin/types.d.ts @@ -5,4 +5,5 @@ declare module 'univer:locales' { export const viVN: { [key: string]: string } export const zhTW: { [key: string]: string } export const faIR: { [key: string]: string } + export const frFR: { [key: string]: string } } diff --git a/packages/vite-plugin/README.md b/packages/vite-plugin/README.md index 0877af5..35afd3f 100644 --- a/packages/vite-plugin/README.md +++ b/packages/vite-plugin/README.md @@ -44,7 +44,7 @@ The plugin provides a virtual module `univer:locales`, which simplifies the impo ```typescript import { LocaleType } from '@univerjs/core' -import { enUS, faIR, ruRU, viVN, zhCN, zhTW } from 'univer:locales' +import { enUS, faIR, frFR, ruRU, viVN, zhCN, zhTW } from 'univer:locales' new Univer({ locales: { @@ -54,6 +54,7 @@ new Univer({ [LocaleType.VI_VN]: viVN, [LocaleType.ZH_TW]: zhTW, [LocaleType.FA_IR]: faIR, + [LocaleType.FR_FR]: frFR, } }) ``` diff --git a/packages/vite-plugin/types.d.ts b/packages/vite-plugin/types.d.ts index 7a5abb6..5df445c 100644 --- a/packages/vite-plugin/types.d.ts +++ b/packages/vite-plugin/types.d.ts @@ -5,4 +5,5 @@ declare module 'univer:locales' { export const viVN: { [key: string]: string } export const zhTW: { [key: string]: string } export const faIR: { [key: string]: string } + export const frFR: { [key: string]: string } } diff --git a/packages/webpack-plugin/README.md b/packages/webpack-plugin/README.md index 6e65184..433a731 100644 --- a/packages/webpack-plugin/README.md +++ b/packages/webpack-plugin/README.md @@ -43,7 +43,7 @@ The plugin provides a virtual module `univer:locales`, which simplifies the impo ```typescript import { LocaleType } from '@univerjs/core' -import { enUS, faIR, ruRU, viVN, zhCN, zhTW } from 'univer:locales' +import { enUS, faIR, frFR, ruRU, viVN, zhCN, zhTW } from 'univer:locales' new Univer({ locales: { @@ -53,6 +53,7 @@ new Univer({ [LocaleType.VI_VN]: viVN, [LocaleType.ZH_TW]: zhTW, [LocaleType.FA_IR]: faIR, + [LocaleType.FR_FR]: frFR, } }) ``` diff --git a/packages/webpack-plugin/types.d.ts b/packages/webpack-plugin/types.d.ts index 7a5abb6..5df445c 100644 --- a/packages/webpack-plugin/types.d.ts +++ b/packages/webpack-plugin/types.d.ts @@ -5,4 +5,5 @@ declare module 'univer:locales' { export const viVN: { [key: string]: string } export const zhTW: { [key: string]: string } export const faIR: { [key: string]: string } + export const frFR: { [key: string]: string } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ce1e791..8870684 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,10 +89,10 @@ importers: version: link:../packages/vite-plugin '@univerjs/webpack-plugin': specifier: file:../packages/webpack-plugin - version: file:packages/webpack-plugin(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) + version: file:packages/webpack-plugin(webpack@5.95.0) css-loader: specifier: ^6.10.0 - version: 6.11.0(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) + version: 6.11.0(webpack@5.95.0) esbuild: specifier: ^0.24.0 version: 0.24.0 @@ -101,13 +101,13 @@ importers: version: 1.6.3 html-webpack-plugin: specifier: ^5.6.0 - version: 5.6.0(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) + version: 5.6.0(webpack@5.95.0) style-loader: specifier: ^3.3.4 - version: 3.3.4(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) + version: 3.3.4(webpack@5.95.0) ts-loader: specifier: ^9.5.1 - version: 9.5.1(typescript@5.6.2)(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) + version: 9.5.1(typescript@5.6.2)(webpack@5.95.0) typescript: specifier: ^5.4.5 version: 5.6.2 @@ -1233,55 +1233,46 @@ packages: resolution: {integrity: sha512-btVgIsCjuYFKUjopPoWiDqmoUXQDiW2A4C3Mtmp5vACm7/GnyuprqIDPNczeyR5W8rTXEbkmrJux7cJmD99D2g==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.21.3': resolution: {integrity: sha512-zmjbSphplZlau6ZTkxd3+NMtE4UKVy7U4aVFMmHcgO5CUbw17ZP6QCgyxhzGaU/wFFdTfiojjbLG3/0p9HhAqA==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.21.3': resolution: {integrity: sha512-nSZfcZtAnQPRZmUkUQwZq2OjQciR6tEoJaZVFvLHsj0MF6QhNMg0fQ6mUOsiCUpTqxTx0/O6gX0V/nYc7LrgPw==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.21.3': resolution: {integrity: sha512-MnvSPGO8KJXIMGlQDYfvYS3IosFN2rKsvxRpPO2l2cum+Z3exiExLwVU+GExL96pn8IP+GdH8Tz70EpBhO0sIQ==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-powerpc64le-gnu@4.21.3': resolution: {integrity: sha512-+W+p/9QNDr2vE2AXU0qIy0qQE75E8RTwTwgqS2G5CRQ11vzq0tbnfBd6brWhS9bCRjAjepJe2fvvkvS3dno+iw==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.21.3': resolution: {integrity: sha512-yXH6K6KfqGXaxHrtr+Uoy+JpNlUlI46BKVyonGiaD74ravdnF9BUNC+vV+SIuB96hUMGShhKV693rF9QDfO6nQ==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.21.3': resolution: {integrity: sha512-R8cwY9wcnApN/KDYWTH4gV/ypvy9yZUHlbJvfaiXSB48JO3KpwSpjOGqO4jnGkLDSk1hgjYkTbTt6Q7uvPf8eg==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.21.3': resolution: {integrity: sha512-kZPbX/NOPh0vhS5sI+dR8L1bU2cSO9FgxwM8r7wHzGydzfSjLRCFAT87GR5U9scj2rhzN3JPYVC7NoBbl4FZ0g==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.21.3': resolution: {integrity: sha512-S0Yq+xA1VEH66uiMNhijsWAafffydd2X5b77eLHfRmfLsRSpbiAWiRHV6DEpz6aOToPsgid7TI9rGd6zB1rhbg==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.21.3': resolution: {integrity: sha512-9isNzeL34yquCPyerog+IMCNxKR8XYmGd0tHSV+OVx0TmE0aJOo9uw4fZfUuk2qxobP5sug6vNdZR6u7Mw7Q+Q==} @@ -7662,7 +7653,7 @@ snapshots: - typescript - vite - '@univerjs/webpack-plugin@file:packages/webpack-plugin(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4))': + '@univerjs/webpack-plugin@file:packages/webpack-plugin(webpack@5.95.0)': dependencies: webpack: 5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4) @@ -7825,17 +7816,17 @@ snapshots: '@webassemblyjs/ast': 1.12.1 '@xtuc/long': 4.2.2 - '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4))': + '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4)(webpack@5.95.0)': dependencies: webpack: 5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0) - '@webpack-cli/info@2.0.2(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4))': + '@webpack-cli/info@2.0.2(webpack-cli@5.1.4)(webpack@5.95.0)': dependencies: webpack: 5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0) - '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack-dev-server@5.1.0(webpack-cli@5.1.4)(webpack@5.95.0))(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4))': + '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4)(webpack-dev-server@5.1.0)(webpack@5.95.0)': dependencies: webpack: 5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4) webpack-cli: 5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0) @@ -8469,7 +8460,7 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 - css-loader@6.11.0(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)): + css-loader@6.11.0(webpack@5.95.0): dependencies: icss-utils: 5.1.0(postcss@8.4.45) postcss: 8.4.45 @@ -9441,7 +9432,7 @@ snapshots: relateurl: 0.2.7 terser: 5.31.1 - html-webpack-plugin@5.6.0(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)): + html-webpack-plugin@5.6.0(webpack@5.95.0): dependencies: '@types/html-minifier-terser': 6.1.0 html-minifier-terser: 6.1.0 @@ -11869,7 +11860,7 @@ snapshots: stubborn-fs@1.2.5: {} - style-loader@3.3.4(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)): + style-loader@3.3.4(webpack@5.95.0): dependencies: webpack: 5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4) @@ -11908,25 +11899,25 @@ snapshots: tapable@2.2.1: {} - terser-webpack-plugin@5.3.10(esbuild@0.24.0)(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)): + terser-webpack-plugin@5.3.10(esbuild@0.24.0)(webpack@5.95.0(esbuild@0.24.0)): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.2 terser: 5.31.1 - webpack: 5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4) + webpack: 5.95.0(esbuild@0.24.0) optionalDependencies: esbuild: 0.24.0 - terser-webpack-plugin@5.3.10(esbuild@0.24.0)(webpack@5.95.0(esbuild@0.24.0)): + terser-webpack-plugin@5.3.10(esbuild@0.24.0)(webpack@5.95.0): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 schema-utils: 3.3.0 serialize-javascript: 6.0.2 terser: 5.31.1 - webpack: 5.95.0(esbuild@0.24.0) + webpack: 5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4) optionalDependencies: esbuild: 0.24.0 @@ -12033,7 +12024,7 @@ snapshots: babel-jest: 29.7.0(@babel/core@7.25.2) esbuild: 0.24.0 - ts-loader@9.5.1(typescript@5.6.2)(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)): + ts-loader@9.5.1(typescript@5.6.2)(webpack@5.95.0): dependencies: chalk: 4.1.2 enhanced-resolve: 5.17.0 @@ -12253,9 +12244,9 @@ snapshots: webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0): dependencies: '@discoveryjs/json-ext': 0.5.7 - '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) - '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) - '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4(webpack-dev-server@5.1.0)(webpack@5.95.0))(webpack-dev-server@5.1.0(webpack-cli@5.1.4)(webpack@5.95.0))(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) + '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4)(webpack@5.95.0) + '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4)(webpack@5.95.0) + '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4)(webpack-dev-server@5.1.0)(webpack@5.95.0) colorette: 2.0.20 commander: 10.0.1 cross-spawn: 7.0.3 @@ -12269,7 +12260,7 @@ snapshots: optionalDependencies: webpack-dev-server: 5.1.0(webpack-cli@5.1.4)(webpack@5.95.0) - webpack-dev-middleware@7.4.2(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)): + webpack-dev-middleware@7.4.2(webpack@5.95.0): dependencies: colorette: 2.0.20 memfs: 4.11.1 @@ -12308,7 +12299,7 @@ snapshots: serve-index: 1.9.1 sockjs: 0.3.24 spdy: 4.0.2 - webpack-dev-middleware: 7.4.2(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) + webpack-dev-middleware: 7.4.2(webpack@5.95.0) ws: 8.18.0 optionalDependencies: webpack: 5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4) @@ -12379,7 +12370,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(esbuild@0.24.0)(webpack@5.95.0(esbuild@0.24.0)(webpack-cli@5.1.4)) + terser-webpack-plugin: 5.3.10(esbuild@0.24.0)(webpack@5.95.0) watchpack: 2.4.1 webpack-sources: 3.2.3 optionalDependencies: