提交 95c02462 编写于 作者: P Peter Pan

fix: translation fix

上级 5e49be32
...@@ -155,13 +155,13 @@ const ChartPage = <T extends Item>({ ...@@ -155,13 +155,13 @@ const ChartPage = <T extends Item>({
) : ( ) : (
<Empty height={rem(500)}> <Empty height={rem(500)}>
{search ? ( {search ? (
<Trans i18nKey="search-empty"> <Trans i18nKey="common:search-empty">
Nothing found. Please try again with another word. Nothing found. Please try again with another word.
<br /> <br />
Or you can <a onClick={() => setInputValue('')}>see all charts</a>. Or you can <a onClick={() => setInputValue('')}>see all charts</a>.
</Trans> </Trans>
) : ( ) : (
t('empty') t('common:empty')
)} )}
</Empty> </Empty>
)} )}
...@@ -174,14 +174,14 @@ const ChartPage = <T extends Item>({ ...@@ -174,14 +174,14 @@ const ChartPage = <T extends Item>({
<div className={className}> <div className={className}>
<Search> <Search>
<SearchInput <SearchInput
placeholder={t('search-tags')} placeholder={t('common:search-tags')}
rounded rounded
value={inputValue} value={inputValue}
onChange={(value: string) => setInputValue(value)} onChange={(value: string) => setInputValue(value)}
/> />
</Search> </Search>
{searchValue ? ( {searchValue ? (
<ChartCollapse title={t('search-result')} total={matchedTags.length}> <ChartCollapse title={t('common:search-result')} total={matchedTags.length}>
{withCharts(pageMatchedTags, true)} {withCharts(pageMatchedTags, true)}
{pageMatchedTags.length ? <StyledPagination page={page} total={total} onChange={setPage} /> : null} {pageMatchedTags.length ? <StyledPagination page={page} total={total} onChange={setPage} /> : null}
</ChartCollapse> </ChartCollapse>
...@@ -198,7 +198,7 @@ const ChartPage = <T extends Item>({ ...@@ -198,7 +198,7 @@ const ChartPage = <T extends Item>({
)) ))
) : ( ) : (
<Empty height={`calc(100vh - ${headerHeight} - ${rem(96)})`}> <Empty height={`calc(100vh - ${headerHeight} - ${rem(96)})`}>
<Trans i18nKey="unselected-empty"> <Trans i18nKey="common:unselected-empty">
Nothing selected. Nothing selected.
<br /> <br />
Please select display data from right side. Please select display data from right side.
......
...@@ -40,7 +40,7 @@ const PropertyList = styled(DataList)` ...@@ -40,7 +40,7 @@ const PropertyList = styled(DataList)`
const NodeInfo: FunctionComponent<NodeInfoProps> = props => { const NodeInfo: FunctionComponent<NodeInfoProps> = props => {
const {t} = useTranslation('graphs'); const {t} = useTranslation('graphs');
if (!props.node) { if (!props.node) {
return <p>{t('click-node')}</p>; return <p>{t('graphs:click-node')}</p>;
} }
const node = props.node; const node = props.node;
...@@ -50,10 +50,10 @@ const NodeInfo: FunctionComponent<NodeInfoProps> = props => { ...@@ -50,10 +50,10 @@ const NodeInfo: FunctionComponent<NodeInfoProps> = props => {
return ( return (
<PropertyList <PropertyList
items={[ items={[
{key: t('node-type'), value: typeName[node.type]}, {key: t('graphs:node-type'), value: typeName[node.type]},
{key: t('node-name'), value: node.name}, {key: t('graphs:node-name'), value: node.name},
{key: t('node-data-shape'), value: node.shape}, {key: t('graphs:node-data-shape'), value: node.shape},
{key: t('node-data-type'), value: node.data_type} {key: t('graphs:node-data-type'), value: node.data_type}
]} ]}
/> />
); );
...@@ -61,15 +61,15 @@ const NodeInfo: FunctionComponent<NodeInfoProps> = props => { ...@@ -61,15 +61,15 @@ const NodeInfo: FunctionComponent<NodeInfoProps> = props => {
return ( return (
<PropertyList <PropertyList
items={[ items={[
{key: t('node-type'), value: typeName[node.type]}, {key: t('graphs:node-type'), value: typeName[node.type]},
{key: t('input'), value: node.input}, {key: t('graphs:input'), value: node.input},
{key: t('op-type'), value: node.opType}, {key: t('graphs:op-type'), value: node.opType},
{key: t('output'), value: node.output} {key: t('graphs:output'), value: node.output}
]} ]}
/> />
); );
case 'unknown': case 'unknown':
return <PropertyList items={[{key: t('node-type'), value: typeName[node.guessType]}]} />; return <PropertyList items={[{key: t('graphs:node-type'), value: typeName[node.guessType]}]} />;
default: default:
return null; return null;
} }
......
...@@ -101,11 +101,11 @@ const HighDimensionalChart: FunctionComponent<HighDimensionalChartProps> = ({ ...@@ -101,11 +101,11 @@ const HighDimensionalChart: FunctionComponent<HighDimensionalChartProps> = ({
}, [points]); }, [points]);
if (!data && error) { if (!data && error) {
return <Empty>{t('error')}</Empty>; return <Empty>{t('common:error')}</Empty>;
} }
if (!data && !loading) { if (!data && !loading) {
return <Empty>{t('empty')}</Empty>; return <Empty>{t('common:empty')}</Empty>;
} }
return <StyledScatterChart loading={loading} data={chartData} gl={dimension === '3d'} />; return <StyledScatterChart loading={loading} data={chartData} gl={dimension === '3d'} />;
......
...@@ -52,7 +52,7 @@ const Image = React.forwardRef<ImageRef, ImageProps>(({src, cache}, ref) => { ...@@ -52,7 +52,7 @@ const Image = React.forwardRef<ImageRef, ImageProps>(({src, cache}, ref) => {
} }
if (error) { if (error) {
return <div>{t('error')}</div>; return <div>{t('common:error')}</div>;
} }
return <img src={url} />; return <img src={url} />;
......
...@@ -56,21 +56,21 @@ const Pagination: FunctionComponent<PaginationProps & WithStyled> = ({page, tota ...@@ -56,21 +56,21 @@ const Pagination: FunctionComponent<PaginationProps & WithStyled> = ({page, tota
<Wrapper className={className}> <Wrapper className={className}>
<div> <div>
<Button disabled={currentPage <= 1} onClick={() => setPage(currentPage - 1)}> <Button disabled={currentPage <= 1} onClick={() => setPage(currentPage - 1)}>
{t('previous-page')} {t('common:previous-page')}
</Button> </Button>
<Button disabled={currentPage >= total} onClick={() => setPage(currentPage + 1)}> <Button disabled={currentPage >= total} onClick={() => setPage(currentPage + 1)}>
{t('next-page')} {t('common:next-page')}
</Button> </Button>
</div> </div>
<div> <div>
<span>{t('total-page', {count: total})}</span> <span>{t('common:total-page', {count: total})}</span>
<Input <Input
value={jumpPage} value={jumpPage}
onChange={value => setJumpPage(value)} onChange={value => setJumpPage(value)}
onKeyDown={e => e.key === 'Enter' && setPage(jumpPage)} onKeyDown={e => e.key === 'Enter' && setPage(jumpPage)}
/> />
<Button onClick={() => setPage(jumpPage)} type="primary"> <Button onClick={() => setPage(jumpPage)} type="primary">
{t('confirm')} {t('common:confirm')}
</Button> </Button>
</div> </div>
</Wrapper> </Wrapper>
......
...@@ -135,16 +135,16 @@ const RunAside: FunctionComponent<RunAsideProps> = ({ ...@@ -135,16 +135,16 @@ const RunAside: FunctionComponent<RunAsideProps> = ({
<Aside> <Aside>
{children} {children}
<section className="run-section"> <section className="run-section">
<Field className="run-select" label={t('select-runs')}> <Field className="run-select" label={t('common:select-runs')}>
<SearchInput <SearchInput
className="search-input" className="search-input"
value={search} value={search}
onChange={setSearch} onChange={setSearch}
placeholder={t('search-runs')} placeholder={t('common:search-runs')}
rounded rounded
/> />
<Checkbox value={selectAll} onChange={toggleSelectAll}> <Checkbox value={selectAll} onChange={toggleSelectAll}>
{t('select-all')} {t('common:select-all')}
</Checkbox> </Checkbox>
<div className="run-list"> <div className="run-list">
{filteredRuns.map((run, index) => ( {filteredRuns.map((run, index) => (
......
...@@ -177,7 +177,7 @@ const SampleChart: FunctionComponent<SampleChartProps> = ({run, tag, brightness, ...@@ -177,7 +177,7 @@ const SampleChart: FunctionComponent<SampleChartProps> = ({run, tag, brightness,
items={[ items={[
{ {
icon: 'download', icon: 'download',
tooltip: t('download-image'), tooltip: t('samples:download-image'),
onClick: saveImage onClick: saveImage
} }
]} ]}
......
...@@ -45,7 +45,7 @@ const StepSlider: FunctionComponent<StepSliderProps> = ({onChange, onChangeCompl ...@@ -45,7 +45,7 @@ const StepSlider: FunctionComponent<StepSliderProps> = ({onChange, onChangeCompl
return ( return (
<> <>
<Label> <Label>
<span>{`${t('step')}: ${steps[step] ?? '...'}`}</span> <span>{`${t('samples:step')}: ${steps[step] ?? '...'}`}</span>
{children && <span>{children}</span>} {children && <span>{children}</span>}
</Label> </Label>
<FullWidthRangeSlider <FullWidthRangeSlider
......
...@@ -205,25 +205,25 @@ const ScalarChart: FunctionComponent<ScalarChartProps> = ({ ...@@ -205,25 +205,25 @@ const ScalarChart: FunctionComponent<ScalarChartProps> = ({
{ {
icon: 'maximize', icon: 'maximize',
activeIcon: 'minimize', activeIcon: 'minimize',
tooltip: t('maximize'), tooltip: t('scalars:maximize'),
activeTooltip: t('minimize'), activeTooltip: t('scalars:minimize'),
toggle: true, toggle: true,
onClick: toggleMaximized onClick: toggleMaximized
}, },
{ {
icon: 'restore-size', icon: 'restore-size',
tooltip: t('restore'), tooltip: t('scalars:restore'),
onClick: () => echart.current?.restore() onClick: () => echart.current?.restore()
}, },
{ {
icon: 'log-axis', icon: 'log-axis',
tooltip: t('axis'), tooltip: t('scalars:axis'),
toggle: true, toggle: true,
onClick: toggleYAxisType onClick: toggleYAxisType
}, },
{ {
icon: 'download', icon: 'download',
tooltip: t('download-image'), tooltip: t('scalars:download-image'),
onClick: () => echart.current?.saveAsImage() onClick: () => echart.current?.saveAsImage()
} }
]} ]}
......
...@@ -215,7 +215,7 @@ const Select = <T extends unknown>({ ...@@ -215,7 +215,7 @@ const Select = <T extends unknown>({
? multiple ? multiple
? (value as T[]).map(findLabelByValue).join(' / ') ? (value as T[]).map(findLabelByValue).join(' / ')
: findLabelByValue(value as T) : findLabelByValue(value as T)
: placeholder || t('select'), : placeholder || t('common:select'),
[multiple, value, findLabelByValue, isSelected, placeholder, t] [multiple, value, findLabelByValue, isSelected, placeholder, t]
); );
...@@ -227,7 +227,7 @@ const Select = <T extends unknown>({ ...@@ -227,7 +227,7 @@ const Select = <T extends unknown>({
</Trigger> </Trigger>
<List opened={isOpened} empty={isListEmpty}> <List opened={isOpened} empty={isListEmpty}>
{isListEmpty {isListEmpty
? t('empty') ? t('common:empty')
: list.map((item, index) => { : list.map((item, index) => {
if (multiple) { if (multiple) {
return ( return (
......
...@@ -14,7 +14,7 @@ const Error = styled.div` ...@@ -14,7 +14,7 @@ const Error = styled.div`
const Error404: NextI18NextPage = () => { const Error404: NextI18NextPage = () => {
const {t} = useTranslation('errors'); const {t} = useTranslation('errors');
return <Error>404 - {t('page-not-found')}</Error>; return <Error>404 - {t('errors:page-not-found')}</Error>;
}; };
// 404 page cannot have getInitialProps or getServerSideProps // 404 page cannot have getInitialProps or getServerSideProps
......
...@@ -18,7 +18,11 @@ interface ErrorProps { ...@@ -18,7 +18,11 @@ interface ErrorProps {
const Error: NextI18NextPage<ErrorProps> = ({statusCode}) => { const Error: NextI18NextPage<ErrorProps> = ({statusCode}) => {
const {t} = useTranslation('errors'); const {t} = useTranslation('errors');
return <ErrorDiv>{statusCode ? t('error-with-status', {statusCode}) : t('error-without-status')}</ErrorDiv>; return (
<ErrorDiv>
{statusCode ? t('errors:error-with-status', {statusCode}) : t('errors:error-without-status')}
</ErrorDiv>
);
}; };
Error.getInitialProps = ({res, err}) => { Error.getInitialProps = ({res, err}) => {
......
...@@ -264,21 +264,21 @@ const Graphs: NextI18NextPage = () => { ...@@ -264,21 +264,21 @@ const Graphs: NextI18NextPage = () => {
<AsideSection> <AsideSection>
<SubSection> <SubSection>
<Button rounded type="primary" icon="download" onClick={downloadImage}> <Button rounded type="primary" icon="download" onClick={downloadImage}>
{t('download-image')} {t('graphs:download-image')}
</Button> </Button>
<Button rounded type="primary" icon="revert" onClick={fitScreen}> <Button rounded type="primary" icon="revert" onClick={fitScreen}>
{t('restore-image')} {t('graphs:restore-image')}
</Button> </Button>
</SubSection> </SubSection>
<SubSection> <SubSection>
<Field label={`${t('scale')}:`}> <Field label={`${t('graphs:scale')}:`}>
<RangeSlider min={MIN_SCALE} max={MAX_SCALE} step={0.1} value={scale} onChange={setScale} /> <RangeSlider min={MIN_SCALE} max={MAX_SCALE} step={0.1} value={scale} onChange={setScale} />
</Field> </Field>
</SubSection> </SubSection>
<SubSection> <SubSection>
<Field label={`${t('node-info')}:`} /> <Field label={`${t('graphs:node-info')}:`} />
<NodeInfo node={currentNode} /> <NodeInfo node={currentNode} />
</SubSection> </SubSection>
</AsideSection> </AsideSection>
......
...@@ -77,13 +77,13 @@ const HighDimensional: NextI18NextPage = () => { ...@@ -77,13 +77,13 @@ const HighDimensional: NextI18NextPage = () => {
</Field> </Field>
<Field> <Field>
<Checkbox value={labelVisibility} onChange={setLabelVisibility}> <Checkbox value={labelVisibility} onChange={setLabelVisibility}>
{t('display-all-label')} {t('high-dimensional:display-all-label')}
</Checkbox> </Checkbox>
</Field> </Field>
<AsideDivider /> <AsideDivider />
<AsideTitle> <AsideTitle>
<StyledIcon type="dimension" /> <StyledIcon type="dimension" />
{t('dimension')} {t('high-dimensional:dimension')}
</AsideTitle> </AsideTitle>
<Field> <Field>
<RadioGroup value={dimension} onChange={value => setDimension(value)}> <RadioGroup value={dimension} onChange={value => setDimension(value)}>
...@@ -97,7 +97,7 @@ const HighDimensional: NextI18NextPage = () => { ...@@ -97,7 +97,7 @@ const HighDimensional: NextI18NextPage = () => {
<AsideDivider /> <AsideDivider />
<AsideTitle> <AsideTitle>
<StyledIcon type="reduction" /> <StyledIcon type="reduction" />
{t('reduction-method')} {t('high-dimensional:reduction-method')}
</AsideTitle> </AsideTitle>
<Field> <Field>
<RadioGroup value={reduction} onChange={value => setReduction(value)}> <RadioGroup value={reduction} onChange={value => setReduction(value)}>
......
...@@ -57,16 +57,16 @@ const Samples: NextI18NextPage = () => { ...@@ -57,16 +57,16 @@ const Samples: NextI18NextPage = () => {
> >
<section> <section>
<Checkbox value={showActualSize} onChange={setShowActualSize}> <Checkbox value={showActualSize} onChange={setShowActualSize}>
{t('show-actual-size')} {t('samples:show-actual-size')}
</Checkbox> </Checkbox>
</section> </section>
<section> <section>
<Field label={t('brightness')}> <Field label={t('samples:brightness')}>
<Slider min={0} max={2} step={0.01} value={brightness} onChange={setBrightness} /> <Slider min={0} max={2} step={0.01} value={brightness} onChange={setBrightness} />
</Field> </Field>
</section> </section>
<section> <section>
<Field label={t('contrast')}> <Field label={t('samples:contrast')}>
<Slider min={0} max={2} step={0.01} value={contrast} onChange={setContrast} /> <Slider min={0} max={2} step={0.01} value={contrast} onChange={setContrast} />
</Field> </Field>
</section> </section>
......
...@@ -48,7 +48,6 @@ const Scalars: NextI18NextPage = () => { ...@@ -48,7 +48,6 @@ const Scalars: NextI18NextPage = () => {
const [xAxis, setXAxis] = useState<XAxis>(xAxisValues[0]); const [xAxis, setXAxis] = useState<XAxis>(xAxisValues[0]);
const [tooltipSorting, setTooltipSorting] = useState<TooltipSorting>(toolTipSortingValues[0]); const [tooltipSorting, setTooltipSorting] = useState<TooltipSorting>(toolTipSortingValues[0]);
const onChangeTooltipSorting = (value: TooltipSorting) => setTooltipSorting(value);
const [ignoreOutliers, setIgnoreOutliers] = useState(false); const [ignoreOutliers, setIgnoreOutliers] = useState(false);
...@@ -62,24 +61,24 @@ const Scalars: NextI18NextPage = () => { ...@@ -62,24 +61,24 @@ const Scalars: NextI18NextPage = () => {
> >
<section> <section>
<Checkbox value={ignoreOutliers} onChange={setIgnoreOutliers}> <Checkbox value={ignoreOutliers} onChange={setIgnoreOutliers}>
{t('ignore-outliers')} {t('scalars:ignore-outliers')}
</Checkbox> </Checkbox>
<TooltipSortingDiv> <TooltipSortingDiv>
<span>{t('tooltip-sorting')}</span> <span>{t('scalars:tooltip-sorting')}</span>
<Select <Select
list={toolTipSortingValues.map(value => ({label: t(`tooltip-sorting-value.${value}`), value}))} list={toolTipSortingValues.map(value => ({label: t(`tooltip-sorting-value.${value}`), value}))}
value={tooltipSorting} value={tooltipSorting}
onChange={onChangeTooltipSorting} onChange={setTooltipSorting}
/> />
</TooltipSortingDiv> </TooltipSortingDiv>
</section> </section>
<section> <section>
<Field label={t('smoothing')}> <Field label={t('scalars:smoothing')}>
<Slider min={0} max={0.99} step={0.01} value={smoothing} onChangeComplete={setSmoothing} /> <Slider min={0} max={0.99} step={0.01} value={smoothing} onChangeComplete={setSmoothing} />
</Field> </Field>
</section> </section>
<section> <section>
<Field label={t('x-axis')}> <Field label={t('scalars:x-axis')}>
<RadioGroup value={xAxis} onChange={setXAxis}> <RadioGroup value={xAxis} onChange={setXAxis}>
{xAxisValues.map(value => ( {xAxisValues.map(value => (
<RadioButton key={value} value={value}> <RadioButton key={value} value={value}>
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
"search-result": "搜索结果", "search-result": "搜索结果",
"search-empty": "没有找到您期望的内容,你可以尝试其他搜索词<1/>或者点击<3>查看全部图表</3>", "search-empty": "没有找到您期望的内容,你可以尝试其他搜索词<1/>或者点击<3>查看全部图表</3>",
"unselected-empty": "未选中任何数据<1/>请在右侧操作栏选择要展示的数据", "unselected-empty": "未选中任何数据<1/>请在右侧操作栏选择要展示的数据",
"all": "全部",
"empty": "空空如也", "empty": "空空如也",
"select": "请选择", "select": "请选择",
"select-all": "全选", "select-all": "全选",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册