"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/typescript/init.test.ts" between
i18next-20.3.3.tar.gz and i18next-20.3.4.tar.gz

About: i18next is an internationalization framework for browser or any other javascript environment.

init.test.ts  (i18next-20.3.3):init.test.ts  (i18next-20.3.4)
skipping to change at line 53 skipping to change at line 53
}, },
// not necessary but check a non-inferred arg for paranoia's sake // not necessary but check a non-inferred arg for paranoia's sake
(err, t: TFunction) => { (err, t: TFunction) => {
// init set content // init set content
updateContent(); updateContent();
}, },
); );
i18next.init( i18next.init(
{ {
ns: ['common', 'moduleA', 'moduleB'], ns: ['common', 'moduleA', 'moduleB'] as const,
defaultNS: 'moduleA', defaultNS: 'moduleA',
}, },
(err, t) => { (err, t) => {
t('myKey'); // key in moduleA namespace (defined default) t('myKey'); // key in moduleA namespace (defined default)
t('common:myKey'); // key in common namespace t('common:myKey'); // key in common namespace
}, },
); );
i18next.loadNamespaces('anotherNamespace', (err, t) => { i18next.loadNamespaces('anotherNamespace', (err, t) => {
/* ... */ /* ... */
skipping to change at line 246 skipping to change at line 246
/* resources have been loaded */ /* resources have been loaded */
}); });
i18next.loadLanguages(['de', 'fr'], (err, t) => { i18next.loadLanguages(['de', 'fr'], (err, t) => {
/* resources have been loaded */ /* resources have been loaded */
}); });
// reload all // reload all
i18next.reloadResources(); i18next.reloadResources();
// reload languages // reload languages
i18next.reloadResources(['de', 'fr']); i18next.reloadResources(['de', 'fr'] as const);
// reload namespaces for all languages // reload namespaces for all languages
i18next.reloadResources(null, ['ns1', 'ns2']); i18next.reloadResources(null, ['ns1', 'ns2']);
// reload namespaces in languages // reload namespaces in languages
i18next.reloadResources(['de', 'fr'], ['ns1', 'ns2']); i18next.reloadResources(['de', 'fr'], ['ns1', 'ns2']);
// for current language // for current language
i18next.dir(); i18next.dir();
// for another language // for another language
i18next.dir('en-US'); // -> "ltr"; i18next.dir('en-US'); // -> "ltr";
i18next.dir('ar'); // -> "rtl"; i18next.dir('ar'); // -> "rtl";
const newInstance = i18next.createInstance( const newInstance = i18next.createInstance(
{ {
fallbackLng: 'en', fallbackLng: 'en',
ns: ['file1', 'file2'], ns: ['file1', 'file2'] as const,
defaultNS: 'file1', defaultNS: 'file1',
debug: true, debug: true,
}, },
(err, t) => { (err, t) => {
if (err) { if (err) {
console.log('something went wrong loading', err); console.log('something went wrong loading', err);
return; return;
} }
t('key'); // -> same as i18next.t t('key'); // -> same as i18next.t
}, },
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)