mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
fix: i18n
This commit is contained in:
parent
cb208530db
commit
71b2ac3acf
@ -274,6 +274,9 @@ export class Application {
|
||||
this.use(DataSourceApplicationProvider, { dataSourceManager: this.dataSourceManager });
|
||||
this.use(OpenModeProvider);
|
||||
this.flowEngine.context['app'] = this;
|
||||
this.flowEngine.context['api'] = this.apiClient;
|
||||
this.flowEngine.context['i18n'] = this.i18n;
|
||||
this.flowEngine.context['t'] = this.i18n.t.bind(this.i18n);
|
||||
this.use(FlowEngineProvider, { engine: this.flowEngine });
|
||||
this.use(FlowEngineGlobalsContextProvider);
|
||||
}
|
||||
|
@ -32,8 +32,6 @@ export class PluginFlowEngine extends Plugin {
|
||||
this.flowEngine.registerActions(actions);
|
||||
const dataSourceManager = new DataSourceManager();
|
||||
this.flowEngine.context['flowEngine'] = this.flowEngine;
|
||||
this.flowEngine.context['app'] = this.app;
|
||||
this.flowEngine.context['api'] = this.app.apiClient;
|
||||
this.flowEngine.context['dataSourceManager'] = dataSourceManager;
|
||||
const mainDataSource = new DataSource({
|
||||
key: 'main',
|
||||
|
@ -83,10 +83,10 @@ export class RecordActionModel extends ActionModel {
|
||||
|
||||
render() {
|
||||
const props = { ...this.defaultProps, ...this.props };
|
||||
const icon = <Icon type={props.icon as any} />;
|
||||
const icon = props.icon ? <Icon type={props.icon as any} /> : undefined;
|
||||
|
||||
return (
|
||||
<Button style={{ padding: 0, height: 'auto', gap: 0 }} {...props} icon={icon}>
|
||||
<Button style={{ padding: 0, height: 'auto' }} {...props} icon={icon}>
|
||||
{props.children || props.title}
|
||||
</Button>
|
||||
);
|
||||
|
@ -49,7 +49,7 @@ async function getDataSourcesWithCollections(model: FlowModel) {
|
||||
// 转换为我们需要的格式
|
||||
return allDataSources.map((dataSource: DataSource) => {
|
||||
const key = dataSource.key;
|
||||
const displayName = dataSource.options.displayName || dataSource.key;
|
||||
const displayName = dataSource.displayName || dataSource.key;
|
||||
|
||||
// 从 collectionManager 获取 collections
|
||||
const collections: Collection[] = dataSource.getCollections();
|
||||
|
@ -83,6 +83,14 @@ export class DataSource {
|
||||
this.collectionManager = new CollectionManager(this);
|
||||
}
|
||||
|
||||
get displayName() {
|
||||
return this.options.displayName
|
||||
? Schema.compile(this.options.displayName, {
|
||||
t: (text) => text,
|
||||
})
|
||||
: this.key;
|
||||
}
|
||||
|
||||
get key() {
|
||||
return this.options.key;
|
||||
}
|
||||
@ -244,7 +252,11 @@ export class Collection {
|
||||
}
|
||||
|
||||
get title() {
|
||||
return this.options.title || this.name;
|
||||
return this.options.title
|
||||
? Schema.compile(this.options.title, {
|
||||
t: (text) => text,
|
||||
})
|
||||
: this.name;
|
||||
}
|
||||
|
||||
initInherits() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user