mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +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">
|
<div className="Editor-header-actions">
|
||||||
<ShortcutKey />
|
<ShortcutKey />
|
||||||
{/* <Select
|
{
|
||||||
className="margin-left-space "
|
// @ts-ignore
|
||||||
options={editorLanguages}
|
// vite编译时替换
|
||||||
value={curLanguage}
|
__editor_i18n ? (
|
||||||
clearable={false}
|
<Select
|
||||||
onChange={(e: any) => this.changeLocale(e.value)}
|
className="margin-left-space "
|
||||||
/> */}
|
options={editorLanguages}
|
||||||
|
value={curLanguage}
|
||||||
|
clearable={false}
|
||||||
|
onChange={(e: any) => this.changeLocale(e.value)}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
|
||||||
{i18nEnabled && (
|
{i18nEnabled && (
|
||||||
<Button
|
<Button
|
||||||
|
@ -8,10 +8,36 @@ import fis3 from './scripts/fis3plugin';
|
|||||||
import markdown from './scripts/markdownPlugin';
|
import markdown from './scripts/markdownPlugin';
|
||||||
import mockApi from './scripts/mockApiPlugin';
|
import mockApi from './scripts/mockApiPlugin';
|
||||||
import transformMobileHtml from './scripts/transformMobileHtml';
|
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/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
I18N && i18nPlugin(i18nConfig),
|
||||||
|
|
||||||
fis3(),
|
fis3(),
|
||||||
markdown(),
|
markdown(),
|
||||||
mockApi(),
|
mockApi(),
|
||||||
@ -34,8 +60,11 @@ export default defineConfig({
|
|||||||
dimensions: false
|
dimensions: false
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
monacoEditorPlugin({})
|
monacoEditorPlugin({}),
|
||||||
],
|
replace({
|
||||||
|
__editor_i18n: !!I18N
|
||||||
|
})
|
||||||
|
].filter(n => n),
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: ['amis-formula/lib/doc'],
|
include: ['amis-formula/lib/doc'],
|
||||||
exclude: ['amis-core', 'amis-formula', 'amis', 'amis-ui'],
|
exclude: ['amis-core', 'amis-formula', 'amis', 'amis-ui'],
|
||||||
@ -97,6 +126,6 @@ export default defineConfig({
|
|||||||
find: 'office-viewer',
|
find: 'office-viewer',
|
||||||
replacement: path.resolve(__dirname, './packages/office-viewer/src')
|
replacement: path.resolve(__dirname, './packages/office-viewer/src')
|
||||||
}
|
}
|
||||||
]
|
].concat(PROXY_THEME)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user