import { createInstance } from 'i18next' import { describe, expect, it } from 'vitest' import en from '../locales/en.json' import zh from '../locales/zh.json' describe('automatic routing translations', () => { it('loads Chinese feature labels from the translation namespace', async () => { const i18n = createInstance() await i18n.init({ lng: 'zhCN', fallbackLng: 'en', resources: { zhCN: zh, en }, keySeparator: false, }) expect(i18n.t('Automatic grouping')).toBe('自动分组') expect(i18n.t('Automatic group settings')).toBe('自动分组设置') expect(i18n.t('Low cost first')).toBe('低价优先') expect(i18n.t('Fast response first')).toBe('高速优先') expect(i18n.t('Stability first')).toBe('稳定优先') expect(i18n.t('Allow recently degraded groups')).toBe( '允许使用最近降智的渠道' ) expect(i18n.t('Average charged / 1M tokens')).toBe('平均实扣 / 1M tokens') expect(i18n.t('Request and cache statistics: last 24 hours')).toBe( '请求与缓存统计:最近24小时' ) await i18n.changeLanguage('en') expect(i18n.t('Average charged / 1M tokens')).toBe( 'Average charged / 1M tokens' ) }) })