jason westover | d248362 | 2025-08-18 09:26:41 -0500 | [diff] [blame^] | 1 | // How to run this test in isolation: |
| 2 | // npm run test:unit -- i18n.locale-alias.spec.js |
| 3 | |
| 4 | describe('i18n locale aliases', () => { |
| 5 | test('resolves pageLogin.language for en (alias to en-US)', async () => { |
| 6 | const { createI18nInstance } = await import('@/i18n'); |
| 7 | const base = require('@/locales/en-US.json'); |
| 8 | const loadBase = () => ({ 'en-US': base.default || base }); |
| 9 | const i18n = createI18nInstance(undefined, 'en', undefined, loadBase); |
| 10 | expect(i18n.global.t('pageLogin.language')).toBe('Language'); |
| 11 | }); |
| 12 | |
| 13 | test('resolves pageLogin.language for en-US', async () => { |
| 14 | const { createI18nInstance } = await import('@/i18n'); |
| 15 | const base = require('@/locales/en-US.json'); |
| 16 | const loadBase = () => ({ 'en-US': base.default || base }); |
| 17 | const i18n = createI18nInstance(undefined, 'en-US', undefined, loadBase); |
| 18 | expect(i18n.global.t('pageLogin.language')).toBe('Language'); |
| 19 | }); |
| 20 | |
| 21 | test('resolves pageLogin.language for ka (alias to ka-GE)', async () => { |
| 22 | const { createI18nInstance } = await import('@/i18n'); |
| 23 | const base = require('@/locales/ka-GE.json'); |
| 24 | const loadBase = () => ({ 'ka-GE': base.default || base }); |
| 25 | const i18n = createI18nInstance(undefined, 'ka', undefined, loadBase); |
| 26 | expect(i18n.global.t('pageLogin.language')).toBe('ენა'); |
| 27 | }); |
| 28 | |
| 29 | test('resolves pageLogin.language for ka-GE', async () => { |
| 30 | const { createI18nInstance } = await import('@/i18n'); |
| 31 | const base = require('@/locales/ka-GE.json'); |
| 32 | const loadBase = () => ({ 'ka-GE': base.default || base }); |
| 33 | const i18n = createI18nInstance(undefined, 'ka-GE', undefined, loadBase); |
| 34 | expect(i18n.global.t('pageLogin.language')).toBe('ენა'); |
| 35 | }); |
| 36 | }); |