11import { addScript , addLink } from '../BootstrapBlazor/modules/utility.js'
22import DataService from './data-service.js'
33
4- const loadAssets = async ( ) => {
5- await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/js/react.production.min.js' ) ;
6- await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/js/react-dom.production.min.js' ) ;
7- await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/js/rxjs.umd.min.js' ) ;
8- await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/js/univerjs.presets.umd.min.js' ) ;
9- await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/js/univerjs.preset-sheets-core.umd.min.js' ) ;
10- await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/js/univerjs.preset-sheets-drawing.umd.min.js' ) ;
11- await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/js/univerjs.sheets-zen-editor.umd.min.js' ) ;
12- await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/js/univerjs.preset-sheets-data-validation.umd.min.js' ) ;
4+ const loadAssets = async lang => {
5+ console . log ( lang , 'lang' ) ;
6+ await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/react.production.min.js' ) ;
7+ await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/react-dom.production.min.js' ) ;
8+ await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/rxjs.umd.min.js' ) ;
9+ await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/univerjs.presets.umd.min.js' ) ;
10+ await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-core/index.umd.min.js' ) ;
11+ await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-drawing/index.umd.min.js' ) ;
12+ await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/univerjs.sheets-zen-editor/index.umd.min.js' ) ;
13+ await addScript ( './_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-data-validation/index.umd.min.js' ) ;
1314
14- await addScript ( ' ./_content/BootstrapBlazor.UniverSheet/univer/js/ univerjs.preset-sheets-core. locales.zh-CN.js' ) ;
15- await addScript ( ' ./_content/BootstrapBlazor.UniverSheet/univer/js/ univerjs.preset-sheets-drawing. locales.zhCN.js' ) ;
16- await addScript ( ' ./_content/BootstrapBlazor.UniverSheet/univer/js/ univerjs.sheets-zen-editor. locales.zh-CN.js' ) ;
17- await addScript ( ' ./_content/BootstrapBlazor.UniverSheet/univer/js/ univerjs.preset-sheets-data-validation. locales.zh-CN.js' ) ;
15+ await addScript ( ` ./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-core/ locales/ ${ lang } .js` ) ;
16+ await addScript ( ` ./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-drawing/ locales/ ${ lang } .js` ) ;
17+ await addScript ( ` ./_content/BootstrapBlazor.UniverSheet/univer/univerjs.sheets-zen-editor/ locales/ ${ lang } .js` ) ;
18+ await addScript ( ` ./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-data-validation/ locales/ ${ lang } .js` ) ;
1819
19- await addLink ( './_content/BootstrapBlazor.UniverSheet/univer/css/ univer-sheet.bundle.css' ) ;
20+ await addLink ( './_content/BootstrapBlazor.UniverSheet/univer/univer-sheet.bundle.css' ) ;
2021}
2122
2223export async function createUniverSheetAsync ( sheet ) {
23- await loadAssets ( ) ;
24-
24+ await loadAssets ( sheet . lang ) ;
25+
2526 const { el } = sheet ;
2627 const { LocaleType, merge } = UniverCore ;
2728 const { createUniver } = UniverPresets ;
@@ -30,18 +31,18 @@ export async function createUniverSheetAsync(sheet) {
3031 const { UniverSheetsZenEditorPlugin } = UniverSheetsZenEditor
3132 const { UniverSheetsDataValidationPlugin } = UniverSheetsDataValidation
3233 const { UniverSheetsDataValidationUIPlugin } = UniverSheetsDataValidationUi
33- const { defaultTheme } = UniverDesign ;
34-
34+ const lang = sheet . lang . replace ( '-' , '' )
35+ const langStr = lang . charAt ( 0 ) . toUpperCase ( ) + lang . slice ( 1 )
3536 const options = {
36- theme : sheet . theme ?? defaultTheme ,
37- locale : sheet . lang ?? LocaleType . ZH_CN ,
37+ theme : UniverDesign [ sheet . theme ] ?? UniverDesign . defaultTheme , //'defaultTheme' | greenTheme
38+ locale : lang ,
3839 locales : {
39- [ LocaleType . ZH_CN ] : merge (
40+ [ lang ] : merge (
4041 { } ,
41- UniverPresetSheetsCoreZhCN ,
42- UniverPresetSheetsDrawingZhCN ,
43- UniverSheetsZenEditorZhCN ,
44- UniverSheetsDataValidationUiZhCN ,
42+ window [ `UniverPresetSheetsCore ${ langStr } ` ] ,
43+ window [ `UniverPresetSheetsDrawing ${ langStr } ` ] ,
44+ window [ `UniverSheetsZenEditor ${ langStr } ` ] ,
45+ window [ `UniverSheetsDataValidationUi ${ langStr } ` ] ,
4546 ) ,
4647 } ,
4748 plugins : [
0 commit comments