i18n-dialect
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -16,3 +16,4 @@ "use strict"; | ||
}; | ||
TranslationController.prototype.setLocale = function (localeName, onReady, onError) { | ||
TranslationController.prototype.setLocale = function (localeName, onReady, // called with new locale name when loading is finished | ||
onError) { | ||
var _this = this; | ||
@@ -19,0 +20,0 @@ this.translationGetter(localeName, function (name, contents) { |
{ | ||
"name": "i18n-dialect", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Internationalization support library", | ||
@@ -28,5 +28,5 @@ "main": "dist/index.js", | ||
"eslint": "3.13.1", | ||
"i18n-po-json": "1.0.4", | ||
"i18n-proto": "1.0.4", | ||
"i18n-stex": "1.0.8", | ||
"i18n-po-json": "1.0.5", | ||
"i18n-proto": "1.0.5", | ||
"i18n-stex": "1.0.9", | ||
"karma": "1.7.0", | ||
@@ -33,0 +33,0 @@ "karma-browserify": "^5.1.1", |
@@ -62,3 +62,3 @@ # i18n-dialect | ||
i18n-json-po uses github-flow to accept & merge fixes and improvements. Basic process is: | ||
i18n-dialect uses github-flow to accept & merge fixes and improvements. Basic process is: | ||
- Fork the repo. | ||
@@ -65,0 +65,0 @@ - Create a branch. |
import { | ||
Descriptor, | ||
PluralDescriptor, | ||
PoData, | ||
Meta | ||
PluralDescriptor | ||
} from './types'; | ||
import { I18NEntry } from 'i18n-proto'; | ||
import { I18NEntry, TranslationJson, TranslationMeta } from 'i18n-proto'; | ||
export class TranslationController { | ||
protected dictMeta: Meta | undefined; | ||
protected dictMeta: TranslationMeta | undefined; | ||
protected pluralSelect: (factor: number) => number | undefined; | ||
@@ -29,7 +27,7 @@ protected dictionary: { [key: string]: string[] } = {}; | ||
localeName: string, | ||
onReady: (name: string) => void, | ||
onReady: (name: string) => void, // called with new locale name when loading is finished | ||
onError?: (e: any) => void | ||
): void { // resolves with new locale name when loading is finished | ||
): void { | ||
this.translationGetter(localeName, (name: string, contents: string) => { | ||
let poData: PoData = JSON.parse(contents); // TODO: better json schema validation? | ||
let poData: TranslationJson = JSON.parse(contents); // TODO: better json schema validation? | ||
if (!poData.items || !poData.meta) { | ||
@@ -36,0 +34,0 @@ onError && onError('Invalid format of translation file'); |
@@ -8,3 +8,2 @@ export { | ||
import { Scalar } from 'i18n-stex/src/types'; | ||
export { Meta, PoData } from 'i18n-po-json/src/types'; | ||
@@ -11,0 +10,0 @@ export type SingleSimpleDescriptor = { |
@@ -5,5 +5,3 @@ import { TranslationController } from '../src/controller'; | ||
Descriptor, | ||
PluralDescriptor, | ||
PoData, | ||
Meta | ||
PluralDescriptor | ||
} from '../src/types'; | ||
@@ -10,0 +8,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
183728
1201