Skip to content

Commit

Permalink
fix: i18n code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 authored and kris-liu-smile committed Jul 20, 2022
1 parent ef84779 commit 077dfd2
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 36 deletions.
12 changes: 0 additions & 12 deletions apps/storefront/src/locales/en-US/finish.ts

This file was deleted.

2 changes: 0 additions & 2 deletions apps/storefront/src/locales/en-US/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import users from './users'
import global from './global'
import finish from './finish'

export const en = {
...global,
...users,
...finish,
}
14 changes: 14 additions & 0 deletions apps/storefront/src/locales/en-US/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,18 @@ export default {
'intl.user.register.label.zipCode': 'Zip Code',

'intl.user.register.tips.registerLogo': 'register Logo',

// complete page
'intl.user.register.RegisterComplete.title': 'Complete Registration',
'intl.user.register.RegisterComplete.passwordMatchPrompt': 'Your passwords do not match.',
'intl.user.register.RegisterComplete.email': 'email',
'intl.user.register.RegisterComplete.confirmPassword': 'Confirm Password',

// finish page
'intl.user.register.RegisterFinish.autoApproved.tip': 'Thank you for creating your account at {storeName}. Your company account application has been approved.',
'intl.user.register.RegisterFinish.notAutoApproved.tip': 'Your company account application has been received. Please allow 24 hours for account approval and activation.',
'intl.user.register.RegisterFinish.bcSuccess.tip': 'Thank you for creating your account at {storeName}.',

// register components
'intl.user.register.RegisteredSingleCheckBox.label': 'Email marketing newsletter',
}
12 changes: 0 additions & 12 deletions apps/storefront/src/locales/zh-CN/finish.ts

This file was deleted.

2 changes: 0 additions & 2 deletions apps/storefront/src/locales/zh-CN/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import users from './users'
import global from './global'
import finish from './finish'

export const zh = {
...global,
...users,
...finish,
}
14 changes: 14 additions & 0 deletions apps/storefront/src/locales/zh-CN/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,18 @@ export default {
'intl.user.register.label.zipCode': '邮编',

'intl.user.register.tips.registerLogo': '注册Logo',

// complete page
'intl.user.register.RegisterComplete.title': '完成注册',
'intl.user.register.RegisterComplete.passwordMatchPrompt': '您的密码不匹配。',
'intl.user.register.RegisterComplete.email': '电子邮件',
'intl.user.register.RegisterComplete.confirmPassword': '确认密码',

// finish page
'intl.user.register.RegisterFinish.autoApproved.tip': '感谢您在 {storeName} 创建帐户。 您的公司帐户申请已获批准。',
'intl.user.register.RegisterFinish.notAutoApproved.tip': '您的公司账户申请已收到。 请等待 24 小时来批准和激活帐户。',
'intl.user.register.RegisterFinish.bcSuccess.tip': '感谢您在 {storeName} 创建帐户。',

// register components
'intl.user.register.RegisteredSingleCheckBox.label': '电子邮件营销通讯',
}
8 changes: 4 additions & 4 deletions apps/storefront/src/pages/registered/RegisterComplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function RegisterComplete(props: RegisterCompleteProps) {
if (list && list.length) {
const emailFileds = list.find((item: RegisterFileds) => item.name === emailName) || {}
emailItem = { ...emailFileds }
emailItem.label = `${b3Lang('intl.completePage.email')}`
emailItem.label = `${b3Lang('intl.user.register.RegisterComplete.email')}`
emailItem.name = 'email'
emailItem.disabled = true
newPasswordInformation.push(emailItem)
Expand All @@ -69,7 +69,7 @@ export default function RegisterComplete(props: RegisterCompleteProps) {
newPasswordInformation.push({
default: '',
required: true,
label: b3Lang('intl.completePage.confirmPassword'),
label: b3Lang('intl.user.register.RegisterComplete.confirmPassword'),
name: 'ConfirmPassword',
id: 'Confirm Password',
fieldType: 'password',
Expand Down Expand Up @@ -252,7 +252,7 @@ export default function RegisterComplete(props: RegisterCompleteProps) {
const handleCompleted = (event: MouseEvent) => {
handleSubmit(async (completeData: CustomFieldItems) => {
if (completeData.password !== completeData.ConfirmPassword) {
setErrorMessage(b3Lang('intl.completePage.passwordMatchPrompt'))
setErrorMessage(b3Lang('intl.user.register.RegisterComplete.passwordMatchPrompt'))
return
}
try {
Expand Down Expand Up @@ -331,7 +331,7 @@ export default function RegisterComplete(props: RegisterCompleteProps) {
)
}
<Box>
<InformationFourLabels>{b3Lang('intl.completePage.title')}</InformationFourLabels>
<InformationFourLabels>{b3Lang('intl.user.register.RegisterComplete.title')}</InformationFourLabels>
{
personalInfo && (
<B3CustomForm
Expand Down
6 changes: 3 additions & 3 deletions apps/storefront/src/pages/registered/RegisteredFinish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export default function RegisteredFinish(props: { activeStep: any; handleFinish:
return (
isAutoApproval ? (
<StyleTipContainer>
{b3Lang('intl.finishPage.autoApproved.tip', { storeName })}
{b3Lang('intl.user.register.RegisterFinish.autoApproved.tip', { storeName })}
</StyleTipContainer>
) : (
<StyleTipContainer>
{b3Lang('intl.finishPage.notAutoApproved.tip')}
{b3Lang('intl.user.register.RegisterFinish.notAutoApproved.tip')}
</StyleTipContainer>
)
)
Expand All @@ -39,7 +39,7 @@ export default function RegisteredFinish(props: { activeStep: any; handleFinish:
if (accountType === '2') {
return (
<StyleTipContainer>
{b3Lang('intl.finishPage.bcSuccess.tip', { storeName })}
{b3Lang('intl.user.register.RegisterFinish.bcSuccess.tip', { storeName })}
</StyleTipContainer>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
FormGroup,
} from '@mui/material'

import { useB3Lang } from '@b3/lang'

const RegisteredSigleCheckBox = memo((props: any) => {
const b3Lang = useB3Lang()
const { isChecked, onChange } = props
return (
<FormControl component="fieldset">
Expand All @@ -18,7 +21,7 @@ const RegisteredSigleCheckBox = memo((props: any) => {
checked={isChecked}
onChange={onChange}
control={<Checkbox />}
label="Email marketing newsletter"
label={b3Lang('intl.user.register.RegisteredSingleCheckBox.label')}
labelPlacement="end"
/>
</FormGroup>
Expand Down

0 comments on commit 077dfd2

Please sign in to comment.