refactor(i18n): use JSON with flattened key and namespace (#30114)

Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Stephen Zhou
2025-12-29 14:52:32 +08:00
committed by GitHub
parent 09be869f58
commit 6d0e36479b
2552 changed files with 111159 additions and 142972 deletions

View File

@ -54,7 +54,7 @@ const CrawledResultItem: FC<Props> = ({
onClick={onPreview}
className="right-0 top-0 hidden h-6 px-1.5 text-xs font-medium uppercase group-hover:absolute group-hover:block"
>
{t('datasetCreation.stepOne.website.preview')}
{t('stepOne.website.preview', { ns: 'datasetCreation' })}
</Button>
</div>
</div>

View File

@ -8,7 +8,7 @@ import { cn } from '@/utils/classnames'
import CheckboxWithLabel from './checkbox-with-label'
import CrawledResultItem from './crawled-result-item'
const I18N_PREFIX = 'datasetCreation.stepOne.website'
const I18N_PREFIX = 'stepOne.website'
type Props = {
className?: string
@ -63,12 +63,13 @@ const CrawledResult: FC<Props> = ({
<CheckboxWithLabel
isChecked={isCheckAll}
onChange={handleCheckedAll}
label={isCheckAll ? t(`${I18N_PREFIX}.resetAll`) : t(`${I18N_PREFIX}.selectAll`)}
label={isCheckAll ? t(`${I18N_PREFIX}.resetAll`, { ns: 'datasetCreation' }) : t(`${I18N_PREFIX}.selectAll`, { ns: 'datasetCreation' })}
labelClassName="system-[13px] leading-[16px] font-medium text-text-secondary"
testId="select-all"
/>
<div className="text-xs text-text-tertiary">
{t(`${I18N_PREFIX}.scrapTimeInfo`, {
ns: 'datasetCreation',
total: list.length,
time: usedTime.toFixed(1),
})}

View File

@ -22,7 +22,7 @@ const Crawling: FC<Props> = ({
<div className="flex h-[34px] items-center border-y-[0.5px] border-divider-regular px-4
text-xs text-text-tertiary shadow-xs shadow-shadow-shadow-3"
>
{t('datasetCreation.stepOne.website.totalPageScraped')}
{t('stepOne.website.totalPageScraped', { ns: 'datasetCreation' })}
{' '}
{crawledNum}
/

View File

@ -8,7 +8,7 @@ import { useTranslation } from 'react-i18next'
import { ChevronRight } from '@/app/components/base/icons/src/vender/line/arrows'
import { cn } from '@/utils/classnames'
const I18N_PREFIX = 'datasetCreation.stepOne.website'
const I18N_PREFIX = 'stepOne.website'
type Props = {
className?: string
@ -40,7 +40,7 @@ const OptionsWrap: FC<Props> = ({
>
<div className="flex grow items-center">
<RiEqualizer2Line className="mr-1 h-4 w-4 text-text-secondary" />
<span className="text-[13px] font-semibold uppercase leading-[16px] text-text-secondary">{t(`${I18N_PREFIX}.options`)}</span>
<span className="text-[13px] font-semibold uppercase leading-[16px] text-text-secondary">{t(`${I18N_PREFIX}.options`, { ns: 'datasetCreation' })}</span>
</div>
<ChevronRight className={cn(!fold && 'rotate-90', 'h-4 w-4 shrink-0 text-text-tertiary')} />
</div>

View File

@ -7,7 +7,7 @@ import Button from '@/app/components/base/button'
import { useDocLink } from '@/context/i18n'
import Input from './input'
const I18N_PREFIX = 'datasetCreation.stepOne.website'
const I18N_PREFIX = 'stepOne.website'
type Props = {
isRunning: boolean
@ -43,7 +43,7 @@ const UrlInput: FC<Props> = ({
loading={isRunning}
spinnerClassName="!ml-0"
>
{!isRunning ? t(`${I18N_PREFIX}.run`) : ''}
{!isRunning ? t(`${I18N_PREFIX}.run`, { ns: 'datasetCreation' }) : ''}
</Button>
</div>
)