any-translate
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -14,3 +14,3 @@ 'use strict'; | ||
Translate | ||
} from 'any-translate/i/interfaces'*/ | ||
} from 'any-translate'*/ | ||
@@ -24,3 +24,2 @@ | ||
var tokens /*: TranslateArgs*/ = {}; | ||
var keys /*: Array<string>*/ = Object.keys(params); | ||
@@ -27,0 +26,0 @@ for (var i = 0, l = keys.length; i < l; i++) { |
@@ -16,4 +16,5 @@ 'use strict'; | ||
TokenizedTranslate, | ||
TranslateArgs | ||
} from 'any-translate/i/interfaces'*/ | ||
TranslateArgs, | ||
HasTranslation | ||
} from 'any-translate'*/ | ||
function createTranslate(bf /*: Translator*/) /*: TokenizedTranslate*/ { | ||
@@ -27,3 +28,3 @@ function translate(message /*: string*/, params /*: TranslateArgs*/) /*: string*/ { | ||
function createHasTranslation(bf /*: Translator*/) /*: (message: string) => boolean*/ { | ||
function createHasTranslation(bf /*: Translator*/) /*: HasTranslation*/ { | ||
return function hasTranslation(message /*: string*/) /*: boolean*/ { | ||
@@ -30,0 +31,0 @@ return bf.has(message); |
/* @flow */ | ||
import type { | ||
Translator, | ||
TokenizedTranslate, | ||
Translate | ||
} from 'any-translate/i/interfaces' | ||
declare module 'any-translate' { | ||
declare type TokenSubject = string|Function|Object; | ||
declare type TokenizerParams = {[id: string]: TokenSubject}; | ||
declare type TranslateArgs = {[id: string]: string}; | ||
declare type Translate = ( | ||
message: string, | ||
params: TranslateArgs | ||
) => string; | ||
declare module 'any-translate' { | ||
declare type TokenizedTranslate = ( | ||
message: string, | ||
params: TokenizerParams | ||
) => Array<TokenSubject>|string; | ||
declare type NeedTranslate = (locale: string, message: string) => void; | ||
declare interface Translator { | ||
add(phrases: Object): void; | ||
translate(message: string, params: TranslateArgs): string; | ||
has(message: string): boolean; | ||
} | ||
declare type CreateTranslator = ( | ||
locale: string, | ||
phrases: Object, | ||
needTranslate?: NeedTranslate | ||
) => Translator; | ||
declare type HasTranslation = (message: string) => boolean; | ||
declare function createMapTokens(t: Translate): TokenizedTranslate; | ||
declare function createTranslate(bf: Translator): TokenizedTranslate; | ||
declare function createHasTranslation(bf: Translator): (message: string) => boolean | ||
declare function createHasTranslation(bf: Translator): HasTranslation | ||
} |
{ | ||
"name": "any-translate", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Decorator for any i18n library", | ||
@@ -47,4 +47,3 @@ "publishConfig": { | ||
"flow-typed", | ||
"dist", | ||
"i" | ||
"dist" | ||
], | ||
@@ -51,0 +50,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
13686
11
119