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

@ -76,7 +76,7 @@ const CrawledResultItem = ({
onClick={onPreview}
className="system-xs-medium-uppercase right-2 top-2 hidden px-1.5 group-hover:absolute group-hover:block"
>
{t('datasetCreation.stepOne.website.preview')}
{t('stepOne.website.preview', { ns: 'datasetCreation' })}
</Button>
)}
</div>

View File

@ -7,7 +7,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 CrawledResultProps = {
className?: string
@ -66,6 +66,7 @@ const CrawledResult = ({
<div className={cn('flex flex-col gap-y-2', className)}>
<div className="system-sm-medium pt-2 text-text-primary">
{t(`${I18N_PREFIX}.scrapTimeInfo`, {
ns: 'datasetCreation',
total: list.length,
time: usedTime.toFixed(1),
})}
@ -76,7 +77,7 @@ const CrawledResult = ({
<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' })}
/>
</div>
)}

View File

@ -66,7 +66,7 @@ const Crawling = ({
return (
<div className={cn('mt-2 flex flex-col gap-y-2 pt-2', className)}>
<div className="system-sm-medium text-text-primary">
{t('datasetCreation.stepOne.website.totalPageScraped')}
{t('stepOne.website.totalPageScraped', { ns: 'datasetCreation' })}
{' '}
{crawledNum}
/

View File

@ -13,7 +13,7 @@ import { useConfigurations, useInitialData } from '@/app/components/rag-pipeline
import { CrawlStep } from '@/models/datasets'
import { cn } from '@/utils/classnames'
const I18N_PREFIX = 'datasetCreation.stepOne.website'
const I18N_PREFIX = 'stepOne.website'
type OptionsProps = {
variables: RAGPipelineVariables
@ -89,7 +89,7 @@ const Options = ({
onClick={foldToggle}
>
<span className="system-sm-semibold-uppercase text-text-secondary">
{t(`${I18N_PREFIX}.options`)}
{t(`${I18N_PREFIX}.options`, { ns: 'datasetCreation' })}
</span>
<ArrowDownRoundFill className={cn('h-4 w-4 shrink-0 text-text-quaternary', fold && '-rotate-90')} />
</div>
@ -102,7 +102,7 @@ const Options = ({
spinnerClassName="!ml-0"
>
<RiPlayLargeLine className="size-4" />
<span className="px-0.5">{!isRunning ? t(`${I18N_PREFIX}.run`) : t(`${I18N_PREFIX}.running`)}</span>
<span className="px-0.5">{!isRunning ? t(`${I18N_PREFIX}.run`, { ns: 'datasetCreation' }) : t(`${I18N_PREFIX}.running`, { ns: 'datasetCreation' })}</span>
</Button>
</div>
{!fold && (