react-localization
Advanced tools
Comparing version 1.0.3 to 1.0.4
declare module 'react-localization' { | ||
type Formatted = number | string | JSX.Element; | ||
type FormatObject<U extends Formatted> = { [key: string]: U }; | ||
export interface GlobalStrings<T> { | ||
[language: string]: T; | ||
[language: string]: T; | ||
} | ||
export interface LocalizedStringsMethods { | ||
/** | ||
* Can be used from ouside the class to force a particular language | ||
* indipendently from the interface one | ||
* @param language | ||
*/ | ||
setLanguage(language: string): void; | ||
/** | ||
* The current language displayed (could differ from the interface language | ||
* if it has been forced manually and a matching translation has been found) | ||
*/ | ||
getLanguage(): string; | ||
/** | ||
* The current interface language (could differ from the language displayed) | ||
*/ | ||
getInterfaceLanguage(): string; | ||
/** | ||
* Format the passed string replacing the numbered placeholders | ||
* i.e. I'd like some {0} and {1}, or just {0} | ||
* Use example: | ||
* strings.formatString(strings.question, strings.bread, strings.butter) | ||
*/ | ||
formatString<T extends Formatted>(str: string, ...values: Array<T | FormatObject<T>>): Array<string | T>; | ||
/** | ||
* Return an array containing the available languages passed as props in the constructor | ||
*/ | ||
getAvailableLanguages(): string[]; | ||
/** | ||
* Return a string with the passed key in a different language | ||
* @param key | ||
* @param language | ||
*/ | ||
getString(key: string, language: string): string; | ||
/** | ||
* Replace the NamedLocalization object without reinstantiating the object | ||
* @param props | ||
*/ | ||
setContent(props: any): void; | ||
@@ -20,9 +56,9 @@ } | ||
export type LocalizedStrings<T> = LocalizedStringsMethods & T; | ||
interface LocalizedStringsFactory { | ||
new <T>(props: GlobalStrings<T>): LocalizedStrings<T>; | ||
} | ||
var LocalizedStrings: LocalizedStringsFactory; | ||
export default LocalizedStrings; | ||
} | ||
} |
{ | ||
"name": "react-localization", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Simple module to localize the React interface using the same syntax used in the ReactNativeLocalization module, use 'npm run build' before publishing", | ||
@@ -36,5 +36,5 @@ "scripts": { | ||
"dependencies": { | ||
"localized-strings": "0.0.6", | ||
"localized-strings": "^0.0.6", | ||
"react": "^16.0.0" | ||
} | ||
} |
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
13077
125
Updatedlocalized-strings@^0.0.6