Files
gsfdc/demo-dify/dify/web/i18n/__tests__/load-resource.spec.ts
T
wuzilongandCursor 6519682885 chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 13:59:25 +08:00

29 lines
861 B
TypeScript

import { loadI18nResource } from '../load-resource'
describe('locale resource loading', () => {
it.each([
['en_US', 'Save'],
['zh_Hans', '保存'],
['ja_JP', '保存'],
['ZH-hans', '保存'],
['en--US', 'Save'],
['unsupported', 'Save'],
])('loads usable translations for %s', async (locale, expected) => {
const resource = await loadI18nResource(locale, 'common')
expect(resource.default).toMatchObject({ 'operation.save': expected })
})
it.each([
['en-US', 'Cancel'],
['zh_Hans', '取消'],
['ja_JP', 'Cancel'],
['fr-FR', 'Cancel'],
['az-AZ', 'Cancel'],
])('loads Contacts translations with a usable fallback for %s', async (locale, expected) => {
const resource = await loadI18nResource(locale, 'contacts')
expect(resource.default).toMatchObject({ 'action.cancel': expected })
})
})