mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 10:38:16 +08:00
chore: editor开发态国际化 (#7903)
* chore: editor开发态国际化 * chore: editor开发态国际化 * 插件不是用ts写的,没有声明 --------- Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>
This commit is contained in:
parent
866d3412b6
commit
31544b47cd
40
i18nConfig.ts
Normal file
40
i18nConfig.ts
Normal file
@ -0,0 +1,40 @@
|
||||
export default {
|
||||
entry: {
|
||||
dir: './packages/amis-editor-core/src'
|
||||
},
|
||||
file: {
|
||||
test: /.*(ts|tsx|js|jsx)$/
|
||||
},
|
||||
ignore: {
|
||||
list: [
|
||||
'packages/**/locale/*',
|
||||
'packages/amis/*',
|
||||
'packages/amis-ui/*',
|
||||
'packages/amis-core/*',
|
||||
'packages/amis-formula/*',
|
||||
'packages/**/examples/*'
|
||||
]
|
||||
},
|
||||
importInfo: {
|
||||
source: 'i18n-runtime',
|
||||
imported: 'i18n',
|
||||
local: '_i18n'
|
||||
},
|
||||
i18nModule: 'i18n-runtime',
|
||||
languages: [
|
||||
{
|
||||
name: 'en-US',
|
||||
path: [
|
||||
'./packages/amis-editor-core/src/locale',
|
||||
'./packages/amis-editor/src/locale'
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'zh-CN',
|
||||
path: [
|
||||
'./packages/amis-editor-core/src/locale',
|
||||
'./packages/amis-editor/src/locale'
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
@ -700,13 +700,19 @@ export default class AMisSchemaEditor extends React.Component<any, any> {
|
||||
|
||||
<div className="Editor-header-actions">
|
||||
<ShortcutKey />
|
||||
{/* <Select
|
||||
{
|
||||
// @ts-ignore
|
||||
// vite编译时替换
|
||||
__editor_i18n ? (
|
||||
<Select
|
||||
className="margin-left-space "
|
||||
options={editorLanguages}
|
||||
value={curLanguage}
|
||||
clearable={false}
|
||||
onChange={(e: any) => this.changeLocale(e.value)}
|
||||
/> */}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
|
||||
{i18nEnabled && (
|
||||
<Button
|
||||
|
@ -8,10 +8,36 @@ import fis3 from './scripts/fis3plugin';
|
||||
import markdown from './scripts/markdownPlugin';
|
||||
import mockApi from './scripts/mockApiPlugin';
|
||||
import transformMobileHtml from './scripts/transformMobileHtml';
|
||||
//@ts-ignore
|
||||
import i18nPlugin from 'plugin-react-i18n';
|
||||
import i18nConfig from './i18nConfig';
|
||||
|
||||
var I18N = process.env.I18N;
|
||||
|
||||
var PROXY_THEME = process.env.PROXY_THEME
|
||||
? [
|
||||
{
|
||||
find: 'amis-theme-editor/lib/renderers.css',
|
||||
replacement: path.resolve(
|
||||
__dirname,
|
||||
'../editor/packages/amis-theme-editor/src/renderers/style/_index.scss'
|
||||
)
|
||||
},
|
||||
{
|
||||
find: 'amis-theme-editor/lib',
|
||||
replacement: path.resolve(
|
||||
__dirname,
|
||||
'../editor/packages/amis-theme-editor/src'
|
||||
)
|
||||
}
|
||||
]
|
||||
: [];
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
I18N && i18nPlugin(i18nConfig),
|
||||
|
||||
fis3(),
|
||||
markdown(),
|
||||
mockApi(),
|
||||
@ -34,8 +60,11 @@ export default defineConfig({
|
||||
dimensions: false
|
||||
}
|
||||
}),
|
||||
monacoEditorPlugin({})
|
||||
],
|
||||
monacoEditorPlugin({}),
|
||||
replace({
|
||||
__editor_i18n: !!I18N
|
||||
})
|
||||
].filter(n => n),
|
||||
optimizeDeps: {
|
||||
include: ['amis-formula/lib/doc'],
|
||||
exclude: ['amis-core', 'amis-formula', 'amis', 'amis-ui'],
|
||||
@ -97,6 +126,6 @@ export default defineConfig({
|
||||
find: 'office-viewer',
|
||||
replacement: path.resolve(__dirname, './packages/office-viewer/src')
|
||||
}
|
||||
]
|
||||
].concat(PROXY_THEME)
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user