react-intl-universal
Advanced tools
Comparing version 2.11.5 to 2.12.0
@@ -307,2 +307,21 @@ /* | ||
/** | ||
* Change current locale | ||
* @param {string} newLocale Current locale such as 'en-US' | ||
*/ | ||
}, { | ||
key: "changeCurrentLocale", | ||
value: function changeCurrentLocale(newLocale) { | ||
if (!this.options.locales || !this.options.locales[newLocale]) { | ||
var errorMsg = "react-intl-universal locales data \"" + newLocale + "\" not exists."; | ||
if (!this.options.locales) { | ||
errorMsg += 'You should call init function first.'; | ||
} | ||
this.options.warningHandler(errorMsg); | ||
return; | ||
} | ||
this.options.currentLocale = newLocale; | ||
} | ||
/** | ||
* Initialize properties and load CLDR locale data according to currentLocale | ||
@@ -451,2 +470,3 @@ * @param {Object} options | ||
var determineLocale = defaultInstance.determineLocale.bind(defaultInstance); | ||
var changeCurrentLocale = defaultInstance.changeCurrentLocale.bind(defaultInstance); | ||
var init = defaultInstance.init.bind(defaultInstance); | ||
@@ -461,2 +481,2 @@ var getInitOptions = defaultInstance.getInitOptions.bind(defaultInstance); | ||
export { ReactIntlUniversal, get, getHTML, formatMessage, formatHTMLMessage, determineLocale, init, getInitOptions, load, getLocaleFromCookie, getLocaleFromLocalStorage, getLocaleFromURL, getDescendantProp, getLocaleFromBrowser };export default defaultInstance; | ||
export { ReactIntlUniversal, get, getHTML, formatMessage, formatHTMLMessage, determineLocale, changeCurrentLocale, init, getInitOptions, load, getLocaleFromCookie, getLocaleFromLocalStorage, getLocaleFromURL, getDescendantProp, getLocaleFromBrowser };export default defaultInstance; |
@@ -313,2 +313,21 @@ /* | ||
/** | ||
* Change current locale | ||
* @param {string} newLocale Current locale such as 'en-US' | ||
*/ | ||
}, { | ||
key: "changeCurrentLocale", | ||
value: function changeCurrentLocale(newLocale) { | ||
if (!this.options.locales || !this.options.locales[newLocale]) { | ||
var errorMsg = "react-intl-universal locales data \"" + newLocale + "\" not exists."; | ||
if (!this.options.locales) { | ||
errorMsg += 'You should call init function first.'; | ||
} | ||
this.options.warningHandler(errorMsg); | ||
return; | ||
} | ||
this.options.currentLocale = newLocale; | ||
} | ||
/** | ||
* Initialize properties and load CLDR locale data according to currentLocale | ||
@@ -457,2 +476,3 @@ * @param {Object} options | ||
var determineLocale = defaultInstance.determineLocale.bind(defaultInstance); | ||
var changeCurrentLocale = defaultInstance.changeCurrentLocale.bind(defaultInstance); | ||
var init = defaultInstance.init.bind(defaultInstance); | ||
@@ -473,2 +493,3 @@ var getInitOptions = defaultInstance.getInitOptions.bind(defaultInstance); | ||
exports.determineLocale = determineLocale; | ||
exports.changeCurrentLocale = changeCurrentLocale; | ||
exports.init = init; | ||
@@ -475,0 +496,0 @@ exports.getInitOptions = getInitOptions; |
{ | ||
"name": "react-intl-universal", | ||
"version": "2.11.5", | ||
"version": "2.12.0", | ||
"description": "Internationalize React apps. Not only for React component but also for Vanilla JS.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -291,2 +291,8 @@ # react-intl-universal | ||
/** | ||
* Change current locale | ||
* @param {string} newLocale Current locale such as 'en-US' | ||
*/ | ||
changeCurrentLocale(newLocale) | ||
/** | ||
* Get the inital options | ||
@@ -293,0 +299,0 @@ * @returns {Object} options includes currentLocale and locales |
declare module "react-intl-universal" { | ||
/** | ||
* Change current locale | ||
* @param {string} newLocale Current locale such as 'en-US' | ||
*/ | ||
export function changeCurrentLocale(newLocale: string): void; | ||
/** | ||
* Helper: determine user's locale via URL, cookie, and browser's language. | ||
@@ -4,0 +10,0 @@ * You may not need this API, if you have other rules to determine user's locale. |
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
59897
930
449