Merge pull request #26348 from dwaxweiler/i18next-ko

i18next-ko: initial release
This commit is contained in:
Nathan Shively-Sanders
2018-06-20 10:44:39 -07:00
committed by GitHub
4 changed files with 75 additions and 0 deletions

View 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
View 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
}
};
}

View 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"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}