Skip to content

Commit

Permalink
chore: update locale path
Browse files Browse the repository at this point in the history
  • Loading branch information
hexf00 committed Nov 11, 2024
1 parent cb88b3d commit a17629d
Show file tree
Hide file tree
Showing 4 changed files with 577 additions and 178 deletions.
27 changes: 14 additions & 13 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@
"build": "tsc && vite build"
},
"dependencies": {
"@univerjs/core": "0.4.0-alpha.1",
"@univerjs/design": "0.4.0-alpha.1",
"@univerjs/docs": "0.4.0-alpha.1",
"@univerjs/docs-ui": "0.4.0-alpha.1",
"@univerjs/engine-formula": "0.4.0-alpha.1",
"@univerjs/engine-numfmt": "0.4.0-alpha.1",
"@univerjs/engine-render": "0.4.0-alpha.1",
"@univerjs/sheets": "0.4.0-alpha.1",
"@univerjs/sheets-formula": "0.4.0-alpha.1",
"@univerjs/sheets-numfmt": "0.4.0-alpha.1",
"@univerjs/sheets-ui": "0.4.0-alpha.1",
"@univerjs/sheets-zen-editor": "0.4.0-alpha.1",
"@univerjs/ui": "0.4.0-alpha.1"
"@univerjs/core": "0.5.0-alpha.0",
"@univerjs/design": "0.5.0-alpha.0",
"@univerjs/docs": "0.5.0-alpha.0",
"@univerjs/docs-ui": "0.5.0-alpha.0",
"@univerjs/engine-formula": "0.5.0-alpha.0",
"@univerjs/engine-numfmt": "0.5.0-alpha.0",
"@univerjs/engine-render": "0.5.0-alpha.0",
"@univerjs/sheets": "0.5.0-alpha.0",
"@univerjs/sheets-formula": "0.5.0-alpha.0",
"@univerjs/sheets-formula-ui": "0.5.0-alpha.0",
"@univerjs/sheets-numfmt": "0.5.0-alpha.0",
"@univerjs/sheets-ui": "0.5.0-alpha.0",
"@univerjs/sheets-zen-editor": "0.5.0-alpha.0",
"@univerjs/ui": "0.5.0-alpha.0"
},
"devDependencies": {
"@types/react": "^18.3.11",
Expand Down
11 changes: 7 additions & 4 deletions examples/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula'
import { UniverRenderEnginePlugin } from '@univerjs/engine-render'
import { UniverSheetsPlugin } from '@univerjs/sheets'
import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula'
import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui'
import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt'
import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui'
import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor'
Expand All @@ -25,20 +26,22 @@ const univer = new Univer({
},
})

univer.registerPlugin(UniverDocsPlugin, {
hasScroll: false,
})
univer.registerPlugin(UniverDocsUIPlugin)
univer.registerPlugin(UniverRenderEnginePlugin)
univer.registerPlugin(UniverUIPlugin, {
container: 'app',
})
univer.registerPlugin(UniverDocsPlugin, {
hasScroll: false,
})
univer.registerPlugin(UniverDocsUIPlugin)

univer.registerPlugin(UniverSheetsPlugin)
univer.registerPlugin(UniverSheetsUIPlugin)

univer.registerPlugin(UniverSheetsNumfmtPlugin)
univer.registerPlugin(UniverFormulaEnginePlugin)
univer.registerPlugin(UniverSheetsFormulaPlugin)
univer.registerPlugin(UniverSheetsFormulaUIPlugin)
univer.registerPlugin(UniverSheetsZenEditorPlugin)

univer.createUnit(UniverInstanceType.UNIVER_SHEET, {})
6 changes: 5 additions & 1 deletion packages/core/src/export-virtual-locales-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ export function exportVirtualLocalesModule() {
const langVar = `${lang.replace('-', '')}`

const key = `${generateRandomString(8)}${langVar}`
importStatement += `import ${key} from '${packageName}/lib/locale/${lang}';\n`
// if version is greater than 0.5.0, use lib/es/locale
const localePath = fs.existsSync(path.resolve('node_modules', packageName, 'lib/es/locale', `${lang}.d.ts`))
? 'lib/es/locale'
: 'lib/locale'
importStatement += `import ${key} from '${packageName}/${localePath}/${lang}';\n`
languages[lang].add(key)
}
})
Expand Down
Loading

0 comments on commit a17629d

Please sign in to comment.