UNPKG

@enact/i18n

Version:

Internationalization support for Enact using iLib

59 lines (58 loc) 1.83 kB
"use strict"; require("../../src/glue.js"); var _locale = require("../locale"); var validate = function validate(expected) { return function (actual) { expect(actual ? 'non-latin' : 'latin').toBe(expected); }; }; describe('locale', function () { test('should treat "en-US" as latin locale', function () { (0, _locale.isNonLatinLocale)('en-US', { sync: true, onLoad: validate('latin') }); }); test('should treat "ja-JP" as non-latin locale', function () { (0, _locale.isNonLatinLocale)('ja-JP', { sync: true, onLoad: validate('non-latin') }); }); test('should treat "en-US" as non-latin locale with language override', function () { (0, _locale.isNonLatinLocale)('en-US', { sync: true, nonLatinLanguageOverrides: ['en'], onLoad: validate('non-latin') }); }); test('should treat "en-US" as non-latin locale with locale override', function () { (0, _locale.isNonLatinLocale)('en-US', { sync: true, nonLatinLanguageOverrides: ['en-US'], onLoad: validate('non-latin') }); }); test('should treat "ja-JP" as latin locale with language override', function () { (0, _locale.isNonLatinLocale)('ja-JP', { sync: true, latinLanguageOverrides: ['ja'], onLoad: validate('latin') }); }); test('should treat "ja-JP" as latin locale with locale override', function () { (0, _locale.isNonLatinLocale)('ja-JP', { sync: true, latinLanguageOverrides: ['ja-JP'], onLoad: validate('latin') }); }); test('should treat "en-US" as latin locale with irrelevant override', function () { (0, _locale.isNonLatinLocale)('en-US', { sync: true, latinLanguageOverrides: ['ja'], nonLatinLanguageOverrides: ['es-US'], onLoad: validate('latin') }); }); });