fix(bi): localization (#3159)
* fix(bi): localization * fix: bug * fix(map): localization * fix: antd config provider
This commit is contained in:
parent
1fddf0bcb5
commit
8708765f43
@ -10,6 +10,7 @@ import {
|
||||
Button,
|
||||
Cascader,
|
||||
CascaderProps,
|
||||
ConfigProvider,
|
||||
Dropdown,
|
||||
Empty,
|
||||
MenuItemProps,
|
||||
@ -952,6 +953,7 @@ export const SchemaSettingsModalItem: FC<SchemaSettingsModalItemProps> = (props)
|
||||
const { theme } = useGlobalTheme();
|
||||
const ctx = useContext(BlockRequestContext);
|
||||
const upLevelActiveFields = useFormActiveFields();
|
||||
const { locale } = useContext(ConfigProvider.ConfigContext);
|
||||
|
||||
if (hidden) {
|
||||
return null;
|
||||
@ -988,7 +990,9 @@ export const SchemaSettingsModalItem: FC<SchemaSettingsModalItemProps> = (props)
|
||||
`}
|
||||
>
|
||||
<APIClientProvider apiClient={apiClient}>
|
||||
<SchemaComponent components={components} scope={scope} schema={schema} />
|
||||
<ConfigProvider locale={locale}>
|
||||
<SchemaComponent components={components} scope={scope} schema={schema} />
|
||||
</ConfigProvider>
|
||||
</APIClientProvider>
|
||||
</FormLayout>
|
||||
</SchemaComponentOptions>
|
||||
|
@ -24,6 +24,7 @@ import { Alert } from 'antd';
|
||||
import { getPropsSchemaByComponent } from './utils';
|
||||
import { Field, onFieldValueChange } from '@formily/core';
|
||||
import { css, cx } from '@emotion/css';
|
||||
import { ConfigProvider } from 'antd';
|
||||
|
||||
const FieldComponentProps: React.FC = observer((props) => {
|
||||
const form = useForm();
|
||||
@ -78,6 +79,7 @@ export const ChartFilterFormItem = observer(
|
||||
export const ChartFilterCustomItemInitializer: React.FC<{
|
||||
insert?: any;
|
||||
}> = (props) => {
|
||||
const { locale } = useContext(ConfigProvider.ConfigContext);
|
||||
const { t: lang } = useChartsTranslation();
|
||||
const t = useMemoizedFn(lang);
|
||||
const { scope, components } = useContext(SchemaOptionsContext);
|
||||
@ -101,44 +103,46 @@ export const ChartFilterCustomItemInitializer: React.FC<{
|
||||
message={t('To filter with custom fields, use "Current filter" variables in the chart configuration.')}
|
||||
style={{ marginBottom: 16 }}
|
||||
/>
|
||||
<SchemaComponent
|
||||
schema={{
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
<ConfigProvider locale={locale}>
|
||||
<SchemaComponent
|
||||
schema={{
|
||||
properties: {
|
||||
name: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
title: t('Field title'),
|
||||
'x-component': 'Input',
|
||||
'x-decorator': 'FormItem',
|
||||
required: true,
|
||||
},
|
||||
source: {
|
||||
type: 'string',
|
||||
title: t('Field source'),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'Cascader',
|
||||
enum: sourceFields,
|
||||
description: t('Select a source field to use metadata of the field'),
|
||||
},
|
||||
component: {
|
||||
type: 'string',
|
||||
title: t('Field component'),
|
||||
'x-component': 'Select',
|
||||
'x-decorator': 'FormItem',
|
||||
required: true,
|
||||
enum: fieldComponents,
|
||||
},
|
||||
props: {
|
||||
type: 'object',
|
||||
title: t('Component properties'),
|
||||
'x-component': 'FieldComponentProps',
|
||||
},
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
title: t('Field title'),
|
||||
'x-component': 'Input',
|
||||
'x-decorator': 'FormItem',
|
||||
required: true,
|
||||
},
|
||||
source: {
|
||||
type: 'string',
|
||||
title: t('Field source'),
|
||||
'x-decorator': 'FormItem',
|
||||
'x-component': 'Cascader',
|
||||
enum: sourceFields,
|
||||
description: t('Select a source field to use metadata of the field'),
|
||||
},
|
||||
component: {
|
||||
type: 'string',
|
||||
title: t('Field component'),
|
||||
'x-component': 'Select',
|
||||
'x-decorator': 'FormItem',
|
||||
required: true,
|
||||
enum: fieldComponents,
|
||||
},
|
||||
props: {
|
||||
type: 'object',
|
||||
title: t('Component properties'),
|
||||
'x-component': 'FieldComponentProps',
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
}}
|
||||
/>
|
||||
</ConfigProvider>
|
||||
</FormLayout>
|
||||
</SchemaComponentOptions>
|
||||
),
|
||||
|
@ -10,9 +10,9 @@ export const NAMESPACE = 'data-visualization';
|
||||
// i18n.addResources('tr-TR', NAMESPACE, trTR);
|
||||
|
||||
export function lang(key: string) {
|
||||
return i18n.t(key, { ns: NAMESPACE });
|
||||
return i18n.t(key, { ns: [NAMESPACE, 'client'] });
|
||||
}
|
||||
|
||||
export function useChartsTranslation() {
|
||||
return useTranslation(NAMESPACE);
|
||||
return useTranslation([NAMESPACE, 'client'], { nsMode: 'fallback' });
|
||||
}
|
||||
|
@ -1,51 +1,51 @@
|
||||
{
|
||||
"Map": "Map",
|
||||
"Map-based geometry": "Map-based geometry",
|
||||
"Map type": "Map type",
|
||||
"Point": "Point",
|
||||
"Line": "Line",
|
||||
"Circle": "Circle",
|
||||
"Polygon": "Polygon",
|
||||
"Access key": "Access key",
|
||||
"securityJsCode or serviceHost": "securityJsCode or serviceHost",
|
||||
"AMap": "AMap",
|
||||
"Google Maps": "Google Maps",
|
||||
"Clear": "Clear",
|
||||
"Click to select the starting point and double-click to end the drawing": "Click to select the starting point and double-click to end the drawing",
|
||||
"Clear the canvas": "Clear the canvas",
|
||||
"Are you sure to clear the canvas?": "Are you sure to clear the canvas?",
|
||||
"Confirm": "Confirm",
|
||||
"Cancel": "Cancel",
|
||||
"Enter keywords to search": "Enter keywords to search",
|
||||
"The AccessKey is incorrect, please check it": "The AccessKey is incorrect, please check it",
|
||||
"Please configure the AMap securityCode or serviceHost correctly": "Please configure the AMap securityCode or serviceHost correctly",
|
||||
"Map Manager": "Map Manager",
|
||||
"Configuration": "Configuration",
|
||||
"Saved successfully": "Saved successfully",
|
||||
"Saved failed": "Saved failed",
|
||||
"Edit": "Edit",
|
||||
"Save": "Save",
|
||||
"Please configure the AccessKey and SecurityJsCode first": "Please configure the AccessKey and SecurityJsCode first",
|
||||
"Go to the configuration page": "Go to the configuration page",
|
||||
"Zoom": "Zoom",
|
||||
"Set default zoom level": "Set default zoom level",
|
||||
"The default zoom level of the map": "The default zoom level of the map",
|
||||
"Edit field title": "Edit field title",
|
||||
"Field title": "Field title",
|
||||
"Edit tooltip": "Edit tooltip",
|
||||
"Delete field": "Delete field",
|
||||
"Required": "Required",
|
||||
"Pattern": "Pattern",
|
||||
"Operator": "Operator",
|
||||
"Editable": "Editable",
|
||||
"Readonly": "Readonly",
|
||||
"Easy-reading": "Easy-reading",
|
||||
"Edit description": "Edit description",
|
||||
"Map field": "Map field",
|
||||
"Marker field": "Marker field",
|
||||
"Load google maps failed, Please check the Api key and refresh the page": "Load google maps failed, Please check the Api key and refresh the page",
|
||||
"Create map block": "Create map block",
|
||||
"Start point": "Start point",
|
||||
"End point": "End point",
|
||||
"Concatenation order field": "Concatenation order field"
|
||||
"Map": "地图",
|
||||
"Map-based geometry": "基于地图的几何图形",
|
||||
"Map type": "地图类型",
|
||||
"Point": "点",
|
||||
"Line": "线",
|
||||
"Circle": "圆",
|
||||
"Polygon": "多边形",
|
||||
"Access key": "访问密钥",
|
||||
"securityJsCode or serviceHost": "securityJsCode 或 serviceHost",
|
||||
"AMap": "高德地图",
|
||||
"Google Maps": "谷歌地图",
|
||||
"Clear": "清空",
|
||||
"Click to select the starting point and double-click to end the drawing": "点击选择起点,双击结束绘制",
|
||||
"Clear the canvas": "清空画布",
|
||||
"Are you sure to clear the canvas?": "您确定要清空画布吗?",
|
||||
"Confirm": "确定",
|
||||
"Cancel": "取消",
|
||||
"Enter keywords to search": "输入地方名关键字搜索(必须包含省/市)",
|
||||
"The AccessKey is incorrect, please check it": "访问密钥不正确,请检查",
|
||||
"Please configure the AMap securityCode or serviceHost correctly": "请正确配置高德地图 securityCode 或 serviceHost",
|
||||
"Map Manager": "地图管理",
|
||||
"Configuration": "配置",
|
||||
"Saved successfully": "保存成功",
|
||||
"Saved failed": "保存失败",
|
||||
"Edit": "编辑",
|
||||
"Save": "保存",
|
||||
"Please configure the AccessKey and SecurityJsCode first": "请先配置 AccessKey 和 SecurityJsCode",
|
||||
"Go to the configuration page": "前往配置页面",
|
||||
"Zoom": "缩放",
|
||||
"Set default zoom level": "设置默认缩放级别",
|
||||
"The default zoom level of the map": "地图默认缩放级别",
|
||||
"Edit field title": "编辑字段标题",
|
||||
"Field title": "字段标题",
|
||||
"Edit tooltip": "编辑提示信息",
|
||||
"Delete field": "删除字段",
|
||||
"Required": "必填",
|
||||
"Pattern": "模式",
|
||||
"Operator": "运算符",
|
||||
"Editable": "可编辑",
|
||||
"Readonly": "只读(禁止编辑)",
|
||||
"Easy-reading": "只读(阅读模式)",
|
||||
"Edit description": "编辑描述",
|
||||
"Map field": "地图字段",
|
||||
"Marker field": "标记字段",
|
||||
"Load google maps failed, Please check the Api key and refresh the page": "加载谷歌地图失败,请检查 Api key 并刷新页面",
|
||||
"Create map block": "创建地图区块",
|
||||
"Start point": "起点",
|
||||
"End point": "终点",
|
||||
"Concatenation order field": "连接顺序字段"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user