Skip to content

Commit

Permalink
fix: fix i18n (#4055)
Browse files Browse the repository at this point in the history
  • Loading branch information
laojun authored Aug 27, 2024
1 parent b3f2bbb commit a4de75a
Show file tree
Hide file tree
Showing 18 changed files with 124 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,25 +182,25 @@ export class PureBuildLog extends React.PureComponent<IProps, IState> {
<div className="h-full">
<Tabs className="log-content">
{this.props.showLog && (
<TabPane tab={i18n.s('execution log')} key="log">
<TabPane tab={i18n.t('execution log')} key="log">
{logRollerComp}
</TabPane>
)}
<TabPane tab={i18n.s('configuration info')} key="config">
<TabPane tab={i18n.t('configuration info')} key="config">
<div>
<div className="grid grid-cols-12 gap-y-2">
<div className="text-default-6 col-span-2 flex items-center">
<ErdaIcon type="diedai" className="mr-2" />
{i18n.s('name')}
{i18n.t('name')}
</div>
<div className="col-span-10">{configParams?.actionName ?? '-'}</div>
<div className="text-default-6 col-span-2 flex items-center">
<ErdaIcon type="diedai" className="mr-2" />
{i18n.s('version')}
{i18n.t('version')}
</div>
<div className="col-span-10">{configParams?.version ?? '-'}</div>
</div>
<div className="mt-4">{i18n.s('task parameters')}</div>
<div className="mt-4">{i18n.t('task parameters')}</div>
<div className="grid grid-cols-12 gap-y-2 mt-4">
{map(configParams?.params, ({ name, value }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,26 +183,26 @@ export class PureBuildLog extends React.PureComponent<IProps, IState> {
<div className="build-log-detail">
<Tabs>
{this.props.showLog && (
<TabPane tab={i18n.s('execution log')} key="log">
<TabPane tab={i18n.t('execution log')} key="log">
{logRollerComp}
</TabPane>
)}
<TabPane tab={i18n.s('configuration info')} key="config">
<TabPane tab={i18n.t('configuration info')} key="config">
<div>
<div className="grid grid-cols-12 gap-y-2">
<div className="text-default-6 col-span-2 flex items-center">
<ErdaIcon type="diedai" className="mr-2" />
{i18n.s('name')}
{i18n.t('name')}
</div>
<div className="col-span-10">{configParams?.actionName ?? '-'}</div>
<div className="text-default-6 col-span-2 flex items-center">
<ErdaIcon type="diedai" className="mr-2" />
{i18n.s('version')}
{i18n.t('version')}
</div>
<div className="col-span-10">{configParams?.version ?? '-'}</div>
</div>

<div className="mt-4">{i18n.s('task parameters')}</div>
<div className="mt-4">{i18n.t('task parameters')}</div>
<div className="grid grid-cols-12 gap-y-2 mt-4">
{map(configParams?.params, ({ name, value }) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ const PipelineForm = ({ onCancel, pipelineCategory, onOk, data: editData, fixedA
);
setTreeValue(treeId);
form.setFieldsValue({ tree: treeId });
notification.success({ message: i18n.s('added successfully') });
notification.success({ message: i18n.t('added successfully') });
setVisible(false);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const AddFlow: React.FC<IProps> = ({ onAdd, issueId, flow, children }) => {
label: (
<div className="flex-h-center">
<span>{`${item}`}</span>
<Badge size="small" showDot={false} text={i18n.s('exist', 'dop')} status={'success'} className="mr-1" />
<Badge size="small" showDot={false} text={i18n.t('dop:exist')} status={'success'} className="mr-1" />
</div>
),
value: item,
Expand Down Expand Up @@ -219,10 +219,9 @@ const AddFlow: React.FC<IProps> = ({ onAdd, issueId, flow, children }) => {
},

{
label: i18n.s('Work branch', 'dop'),
labelTip: i18n.s(
'You can customize the branch name, and you can also choose an existing branch or a recommended new branch',
'dop',
label: i18n.t('dop:Work branch'),
labelTip: i18n.t(
'dop:You can customize the branch name, and you can also choose an existing branch or a recommended new branch',
),
name: 'currentBranch',
getComp: () => {
Expand All @@ -242,7 +241,7 @@ const AddFlow: React.FC<IProps> = ({ onAdd, issueId, flow, children }) => {
);
} else if (currentBranchRule && !validateBranchRule(value, currentBranchRule)) {
return Promise.reject(
new Error(`${i18n.s('Please fill in the correct branch rule', 'dop')}, ${currentBranchRule}`),
new Error(`${i18n.t('dop:Please fill in the correct branch rule')}, ${currentBranchRule}`),
);
}
}
Expand All @@ -269,7 +268,7 @@ const AddFlow: React.FC<IProps> = ({ onAdd, issueId, flow, children }) => {
}, [form, apps, chosenApp]);
return (
<Popover
title={`${i18n.s('Create workflow', 'dop')}: ${flow?.name}`}
title={`${i18n.t('dop:Create workflow')}: ${flow?.name}`}
trigger={['click']}
content={content}
visible={visible}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ const CodeCard = (props: CardProps) => {
<div className="mb-3 flex-h-center justify-between">
<div className="flex-h-center">
<span>{i18n.t('dop:Code')}</span>
<Tooltip title={i18n.s('All development code of this task is managed in this branch', 'dop')}>
<Tooltip title={i18n.t('dop:All development code of this task is managed in this branch')}>
<ErdaIcon type="help" className="text-default-3 ml-1" />
</Tooltip>
</div>
<Tooltip
title={!canJoin ? i18n.s('The temporary merge is not enabled, please set it before merging', 'dop') : ''}
title={!canJoin ? i18n.t('dop:The temporary merge is not enabled, please set it before merging') : ''}
>
<div
onClick={() => {
Expand All @@ -59,7 +59,7 @@ const CodeCard = (props: CardProps) => {
canJoin ? ' bg-purple-deep text-white' : 'bg-default-08 text-default-4'
}`}
>
{canJoin ? i18n.s('Merge into temporary branch', 'dop') : i18n.s('Merged into temporary branch', 'dop')}
{canJoin ? i18n.t('dop:Merge into temporary branch') : i18n.t('dop:Merged into temporary branch')}
</div>
</Tooltip>
</div>
Expand All @@ -75,7 +75,7 @@ const CodeCard = (props: CardProps) => {
) : null}
</div>
) : (
<div className="text-danger text-xs">{i18n.s('Branch does not exist or has been deleted', 'dop')}</div>
<div className="text-danger text-xs">{i18n.t('dop:Branch does not exist or has been deleted')}</div>
)}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const mrStatus = {
icon: (
<div className="text-xs text-yellow flex-h-center">
<ErdaIcon type="tishi" fill={'yellow'} size={14} />
{i18n.s('Not create', 'dop')}
{i18n.t('dop:Not create')}
</div>
),
stepStates: 'uncreate',
Expand Down Expand Up @@ -112,14 +112,14 @@ const MergeRequestCard = (props: CardProps) => {
}}
className={`px-3 rounded cursor-pointer bg-purple-deep text-white`}
>
{mergeRequestInfo ? i18n.s('check merge request', 'dop') : i18n.s('create merge request', 'dop')}
{mergeRequestInfo ? i18n.t('dop:check merge request', 'dop') : i18n.t('dop:create merge request')}
</div>
) : null}
</div>
{targetBranch ? (
<Branch className="mb-2" appId={appID} projectId={projectID} branch={targetBranch} />
) : (
<div className="text-xs text-default-8">{i18n.s('target branch is empty', 'dop')}</div>
<div className="text-xs text-default-8">{i18n.t('dop:target branch is empty')}</div>
)}
<div className="flex-h-center text-xs">
{mergeRequestInfo ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ const MergeCard = (props: CardProps) => {
<div className="ml-2 flex-1 overflow-hidden">
<div className="mb-3 flex-h-center justify-between">
<div className="flex-h-center">
<span>{i18n.s('Temporary merge', 'dop')}</span>
<span>{i18n.t('dop:Temporary merge')}</span>
<Tooltip
title={i18n.s(
'Code branches of different tasks can be temporarily merged and deployed to the corresponding environment',
'dop',
title={i18n.t(
'dop:Code branches of different tasks can be temporarily merged and deployed to the corresponding environment',
)}
>
<ErdaIcon type="help" className="text-default-3 ml-1" />
Expand All @@ -98,7 +97,7 @@ const MergeCard = (props: CardProps) => {
isJoinTempBranch ? 'cursor-pointer bg-purple-deep text-white' : 'bg-default-08 text-default-4'
}`}
>
{i18n.s('Revoke temporary merge', 'dop')}
{i18n.t('dop:Revoke temporary merge')}
</div>
) : null}
</div>
Expand All @@ -108,7 +107,7 @@ const MergeCard = (props: CardProps) => {
<Branch appId={appID} projectId={projectID} branch={tempBranch} className="overflow-hidden" />
<Popover content={ChangeList}>
<span className="text-purple-deep cursor-pointer ml-2 whitespace-nowrap">
{i18n.s('More merger information', 'dop')}
{i18n.t('dop:More merger information')}
</span>
</Popover>
</div>
Expand All @@ -124,15 +123,15 @@ const MergeCard = (props: CardProps) => {
<ErdaIcon type="commitID" className="mr-1 text-default-4" />
<Ellipsis
className="flex-1 text-default-8"
title={i18n.s('This task branch has no content merged', 'dop')}
title={i18n.t('dop:This task branch has no content merged')}
/>
</>
)}
</div>
</>
) : (
<div className="text-xs text-default-8">
<span>{i18n.s('The temporary merge function is not currently enabled, please go to', 'dop')}</span>
<span>{i18n.t('dop:The temporary merge function is not currently enabled, please go to')}</span>
&nbsp;
<span
className="text-purple-deep cursor-pointer"
Expand All @@ -146,7 +145,7 @@ const MergeCard = (props: CardProps) => {
{i18n.t('dop:R&D Workflow')}
</span>
&nbsp;
<span>{i18n.s('to set', 'dop')}</span>
<span>{i18n.t('dop:to set')}</span>
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ const PipelineCard = (props: CardProps) => {
if (!tempBranch) {
subContent = (
<div className="text-xs text-default-8">
{i18n.s('The temporary merge is not enabled, and there is no pipeline', 'dop')}
{i18n.t('dop:The temporary merge is not enabled, and there is no pipeline')}
</div>
);
} else if (!inode) {
subContent = (
<div className="text-xs text-default-8">
{i18n.s('There is no pipeline for the temporary branch, please contact the administrator to create', 'dop')}
{i18n.t('dop:There is no pipeline for the temporary branch, please contact the administrator to create')}
</div>
);
} else if (!hasOnPushBranch) {
Expand All @@ -97,7 +97,7 @@ const PipelineCard = (props: CardProps) => {
<Ellipsis className="text-default-8 group-hover:text-purple-deep" title={pipelineName} />
</div>
<div className="text-xs mt-2 text-default-8">
<span>{i18n.s('The pipeline is not configured with triggers yet.', 'dop')}</span>
<span>{i18n.t('dop:The pipeline is not configured with triggers yet.')}</span>
<Popover
content={
<div>
Expand All @@ -108,7 +108,7 @@ const PipelineCard = (props: CardProps) => {
</div>
}
>
<span className="text-purple-deep cursor-pointer">{i18n.s('How to configure?', 'dop')}</span>
<span className="text-purple-deep cursor-pointer">{i18n.t('dop:How to configure?')}</span>
</Popover>
</div>
</>
Expand Down Expand Up @@ -146,9 +146,8 @@ const PipelineCard = (props: CardProps) => {
<div className="mb-3 flex-h-center">
<span>{i18n.t('Pipeline')}</span>
<Tooltip
title={i18n.s(
'This is a temporary merge pipeline. If you need to modify it, please contact the application administrator',
'dop',
title={i18n.t(
'dop:This is a temporary merge pipeline. If you need to modify it, please contact the application administrator',
)}
>
<ErdaIcon type="help" className="text-default-3 ml-1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ const IssueWorkflow: React.FC<IProps> = ({ projectID, id }) => {
</If>
) : flowUseable ? (
<div className="py-4 px-8">
<span className=" text-default-6">{i18n.s('No workflow has been added yet, please click + Add', 'dop')}</span>
<span className=" text-default-6">{i18n.t('dop:No workflow has been added yet, please click + Add')}</span>
</div>
) : (
<div className="py-4 px-8 text-default-6">
<span>{i18n.s('Workflow {name} not exist', 'dop', { name: TASK_FLOW })}</span>
<span>{i18n.t('dop:Workflow {name} not exist', { name: TASK_FLOW })}</span>
<span>
<span>{i18n.s('Please contact the project administrator, go to', 'dop')}</span> &nbsp;
<span>{i18n.t('dop:Please contact the project administrator, go to')}</span> &nbsp;
<span
className="text-purple-deep cursor-pointer"
onClick={() => {
Expand All @@ -83,7 +83,7 @@ const IssueWorkflow: React.FC<IProps> = ({ projectID, id }) => {
{i18n.t('dop:R&D Workflow')}
</span>
&nbsp;
<span>{i18n.s('to set', 'dop')}</span>
<span>{i18n.t('dop:to set')}</span>
</span>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,8 @@ const ProjectSettings = () => {
</div>

<div>
{i18n.s(
'It is recommended to use the form of type/scope. For example, type is kind: indicates the item type team: indicates the team, src: indicates the source, area: indicates the field or module, and highlight: indicates the focus. Combinations such as: kind/security; team/test; src/customer appeal; area/unified authentication; highlight/delay risk',
'dop',
{i18n.t(
'dop:It is recommended to use the form of type/scope. For example, type is kind: indicates the item type team: indicates the team, src: indicates the source, area: indicates the field or module, and highlight: indicates the focus. Combinations such as: kind/security; team/test; src/customer appeal; area/unified authentication; highlight/delay risk',
)}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ const SourceBranchCard = (props: CardProps) => {
return (
<div className={`flex-col w-[180px] ${className}`}>
<div className="text-default-4 mr-2 text-center mb-2 flex-h-center justify-center">
{i18n.s('source branch', 'dop')}
{i18n.t('dop:source branch')}
<Tooltip
title={`${i18n.t('dop:Merge change branch')}, ${i18n.t(
'start with letters and can contain characters that are not wildcard',
Expand Down Expand Up @@ -339,15 +339,15 @@ const CurrentBranchCard = (props: CardProps) => {
<If condition={editing}>
<span data-required="* " className="ml-1 before:required" />
</If>
{i18n.s('current branch', 'dop')}
{i18n.t('dop:current branch')}
<Tooltip
title={
<div>
<div>{i18n.t('dop:A branch for feature development')}</div>
<div className="mt-1">{`${i18n.s('current branch', 'dop')}: ${i18n.t(
<div className="mt-1">{`${i18n.t('dop:current branch')}: ${i18n.t(
'start with letters and can contain',
)}`}</div>
<div className="mt-1">{`${i18n.s('temporary branch', 'dop')}: ${i18n.t(
<div className="mt-1">{`${i18n.t('dop:temporary branch')}: ${i18n.t(
'start with letters and can contain characters that are not wildcard',
)}`}</div>
</div>
Expand Down Expand Up @@ -380,7 +380,7 @@ const CurrentBranchCard = (props: CardProps) => {
<If condition={data.branchType === FlowType.MULTI_BRANCH}>
<div className="flex-col mt-2">
<div className="flex-h-center">
<span className="text-default-6 mr-2">{i18n.s('temporary merge', 'dop')}</span>
<span className="text-default-6 mr-2">{i18n.t('dop:temporary merge')}</span>
<Switch
checked={data.openTempMerge}
unCheckedChildren={i18n.t('off')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ const getValid = (policyData: BranchPolicyData, fullData: BranchPolicyData[]) =>
let t = '';
const _vArr = _v?.split(',') || [];
if (_vArr.length) {
if (compact(_vArr).length !== _vArr.length) t = i18n.s('can not exist a empty value', 'dop');
if (uniq(_vArr).length !== _vArr.length) t = i18n.s('there are duplicates', 'dop');
if (compact(_vArr).length !== _vArr.length) t = i18n.t('dop:can not exist a empty value');
if (uniq(_vArr).length !== _vArr.length) t = i18n.t('dop:there are duplicates');
}

if (!t && _v) {
Expand All @@ -204,14 +204,14 @@ const getValid = (policyData: BranchPolicyData, fullData: BranchPolicyData[]) =>

return {
sourceBranch: rules.sourceBranch(
i18n.s('source branch', 'dop'),
i18n.t('dop:source branch'),
policyData?.policy?.sourceBranch,
policyData.branchType === FlowType.MULTI_BRANCH,
),
// currentBranch: branchValid rules.currentBranch('当前分支', policyData?.policy?.currentBranch),
branch: rules.branch(i18n.t('dop:branch'), policyData?.branch),
tempBranch: policyData?.openTempMerge
? rules.tempBranch(i18n.s('temporary branch', 'dop'), policyData?.policy?.tempBranch)
? rules.tempBranch(i18n.t('dop:temporary branch'), policyData?.policy?.tempBranch)
: '',
mergeRequest: rules.mergeRequest(
i18n.t('dop:target branch'),
Expand Down
Loading

0 comments on commit a4de75a

Please sign in to comment.