datahub 汉化
1、修改主页RecommendationContainer
路径:datahub-web-react/src/app/home/HomePageRecommendations.tsx
有些标题是写在后端的, 不想改后端, 所以写了一个替换的function
function replaceModuleTitle(title: string) { switch (title) { case 'Most Popular': return "热门数据"; case 'Recently Viewed': return "最近查看"; case 'Platforms': return "数据平台"; case 'Top Tags': return "热门标签"; default: return title; } }
使用如下: <RecommendationTitle level={4}> {replaceModuleTitle(module.title)} </RecommendationTitle>
2、基础查找列替换:
http://localhost:3000/search?filter__entityType%E2%90%9EtypeNames___false___EQUAL___0=DATASET&page=1&query=%2A&unionType=0
代码路径:
组合展示由它完成:
datahub-web-react/src/app/search/filters/BasicFilters.tsx
更多搜索由下面的代码完成:
datahub-web-react/src/app/search/filters/MoreFilters.tsx
每个的返回由它完成:(重点改了里面的
displayName={replaceDisplayname(displayName) || ''}
增加了:
function replaceDisplayname(str: string)
)
datahub-web-react/src/app/search/filters/SearchFilter.tsx
修改段落:
<FlexWrapper> {loading && !visibleFilters?.length && <BasicFiltersLoadingSection />} {visibleFilters?.map((filter) => { return filterRendererRegistry.hasRenderer(filter.field) ? ( filterRendererRegistry.render(filter.field, { scenario: FilterScenarioType.SEARCH_V2_PRIMARY, filter, activeFilters, onChangeFilters, }) ) : ( <SearchFilter key={filter.field} filter={filter} activeFilters={activeFilters} onChangeFilters={onChangeFilters} /> ); })} {hiddenFilters && hiddenFilters.length > 0 && ( <MoreFilters filters={hiddenFilters} activeFilters={activeFilters} onChangeFilters={onChangeFilters} /> )} </FlexWrapper>
3、sidebar 修改
路径:
datahub-web-react/src/app/search/sidebar/BrowseSidebar.tsx
代码:
<SidebarBody visible={visible}> {entityAggregations && !entityAggregations.length && <div>No results found</div>} {entityAggregations ?.filter((entityAggregation) => entityAggregation?.value !== 'DATA_PRODUCT') ?.map((entityAggregation) => ( <BrowseProvider key={entityAggregation?.value} entityAggregation={entityAggregation}> <EntityNode sortBy={sortBy} /> </BrowseProvider> ))} {error && <SidebarLoadingError onClickRetry={retry} />} </SidebarBody>
4、修改Domains字样
datahub-web-react/src/app/domain/nestedDomains/DomainsTitle.tsx
<span> <IconWrapper> <DomainIcon /> </IconWrapper> 数据域 </span>
5、修改GlossaryTermEntity的名字
(可能不能改, 会引发连接的路由错误)
datahub-web-react/src/app/entity/glossaryTerm/GlossaryTermEntity.tsx
替换
getEntityName = () => '业务术语';
6、数据概概览汉化
主页面:
datahub-web-react/src/app/analyticsDashboard/components/AnalyticsPage.tsx
分组页面:
datahub-web-react/src/app/analyticsDashboard/components/ChartGroup.tsx
图表页面(下面两个):
datahub-web-react/src/app/analyticsDashboard/components/AnalyticsChart.tsx
datahub-web-react/src/app/analyticsDashboard/components/Highlight.tsx
(图表那边修改)