mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 11:07:32 +08:00
Merge pull request #26348 from dwaxweiler/i18next-ko
i18next-ko: initial release
This commit is contained in:
24
types/i18next-ko/i18next-ko-tests.ts
Normal file
24
types/i18next-ko/i18next-ko-tests.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as i18next from 'i18next';
|
||||
import * as i18nextko from 'i18next-ko';
|
||||
import * as ko from 'knockout';
|
||||
|
||||
const resourceStore = {
|
||||
en: {
|
||||
translation: {
|
||||
testTranslation: 'Test translation'
|
||||
}
|
||||
},
|
||||
|
||||
de: {
|
||||
translation: {
|
||||
testTranslation: 'Test-Übersetzung'
|
||||
}
|
||||
}
|
||||
};
|
||||
i18nextko.init(resourceStore, 'en', ko);
|
||||
|
||||
i18nextko.setLanguage('de');
|
||||
|
||||
i18nextko.i18n;
|
||||
|
||||
i18nextko.t('testTranslation');
|
||||
25
types/i18next-ko/index.d.ts
vendored
Normal file
25
types/i18next-ko/index.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Type definitions for i18next-ko 3.0
|
||||
// Project: https://github.com/leMaik/i18next-ko
|
||||
// Definitions by: Daniel Waxweiler <https://github.com/dwaxweiler>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout"/>
|
||||
|
||||
import * as i18next from 'i18next';
|
||||
|
||||
export const i18n: i18next.i18n;
|
||||
|
||||
export function init(resourceStore: i18nextkoResourceStore, language: string, ko: KnockoutStatic): void;
|
||||
|
||||
export function setLanguage(language: string): void;
|
||||
|
||||
export function t(key: string): KnockoutComputed<string>;
|
||||
|
||||
export interface i18nextkoResourceStore {
|
||||
[language: string]: {
|
||||
translation: {
|
||||
[key: string]: string
|
||||
}
|
||||
};
|
||||
}
|
||||
23
types/i18next-ko/tsconfig.json
Normal file
23
types/i18next-ko/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"i18next-ko-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/i18next-ko/tslint.json
Normal file
3
types/i18next-ko/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user