mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-27 11:40:08 +08:00
Merge pull request #4561 from lucyhe/master
Add addResources to i18next and also export i18n in i18next-client module.
This commit is contained in:
@@ -665,6 +665,24 @@ describe('i18next', function () {
|
||||
|
||||
});
|
||||
|
||||
describe('adding resources after initialisation', function () {
|
||||
|
||||
var frResource = <IResourceStoreKey>{ 'simple_fr': 'ok_from_fr' };
|
||||
var enResource = <IResourceStoreKey>{ 'simple_en': 'ok_from_en' };
|
||||
|
||||
beforeEach(function (done) {
|
||||
i18n.init({ resStore: {} },
|
||||
function (t) { done(); });
|
||||
});
|
||||
|
||||
it('it should use resources for translation added after initialisation', function () {
|
||||
i18n.addResources('fr', 'translation', frResource);
|
||||
i18n.addResources('en', 'translation', enResource);
|
||||
expect(i18n.t('simple_fr', { lng: 'fr' })).to.be('ok_from_fr');
|
||||
expect(i18n.t('simple_en', { lng: 'en' })).to.be('ok_from_en');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
describe('translation functionality', function () {
|
||||
|
||||
|
||||
Vendored
+5
@@ -67,6 +67,7 @@ interface I18nextOptions {
|
||||
interface I18nextStatic {
|
||||
|
||||
addPostProcessor(name: string, fn: (value: any, key: string, options: any) => string): void;
|
||||
addResources(language: string, namespace: string, resources: IResourceStoreKey): void;
|
||||
detectLanguage(): string;
|
||||
functions: {
|
||||
extend(target: any, ...objs: any[]): Object;
|
||||
@@ -130,4 +131,8 @@ declare var i18n: I18nextStatic;
|
||||
|
||||
declare module 'i18next' {
|
||||
export = i18n;
|
||||
}
|
||||
|
||||
declare module 'i18next-client' {
|
||||
export = i18n;
|
||||
}
|
||||
Reference in New Issue
Block a user