// The shared i18next options (src/options.js) on i18next itself. Guards what i18next 27 // changed (plan step 2.99c): empty texts, fallback language, language code casing, plurals. import assert from 'node:assert/strict' import { test } from 'node:test' import i18next from 'i18next' import { BASE_OPTIONS } from '../src/options.js' const make = (lng, resources) => { const i18n = i18next.createInstance() i18n.init({ ...BASE_OPTIONS, lng, resources, ns: ['common'], defaultNS: 'common' }) return i18n } const RES = { en: { common: { empty: '', onlyEn: 'Only English', times_one: '{{count}} time', times_other: '{{count}} times' } }, el: { common: { empty: '', times_one: '{{count}} φορά', times_other: '{{count}} φορές' } }, } test('an empty text stays empty (i18next 27 alone would show the key)', () => { assert.equal(make('en', RES).t('empty'), '') }) test('a key Greek lacks falls back to English', () => { assert.equal(make('el', RES).t('onlyEn'), 'Only English') }) test('language code casing and plurals', () => { assert.equal(make('EN', RES).language, 'en') assert.equal(make('en', RES).t('times', { count: 1 }), '1 time') assert.equal(make('el', RES).t('times', { count: 3 }), '3 φορές') })