@lingui/core
Advanced tools
Comparing version 4.0.0-next.2 to 4.0.0-next.3
@@ -231,2 +231,25 @@ 'use strict'; | ||
} | ||
/** | ||
* @param locales one locale or array of locales. | ||
* If array of locales is passed they would be used as fallback | ||
* locales for date and number formatting | ||
* @param messages compiled message catalog | ||
* @param notify Should emit `change` event for all subscribers. | ||
* This is useful for integration with frameworks as NextJS to avoid race-conditions during initialization. | ||
*/ | ||
loadAndActivate(locales, messages) { | ||
let notify = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
if (Array.isArray(locales)) { | ||
this._locale = locales[0]; | ||
this._locales = locales; | ||
} else { | ||
this._locale = locales; | ||
this._locales = null; | ||
} | ||
this._messages[this._locale] = messages; | ||
if (notify) { | ||
this.emit("change"); | ||
} | ||
} | ||
activate(locale, locales) { | ||
@@ -233,0 +256,0 @@ if (process.env.NODE_ENV !== "production") { |
@@ -231,2 +231,25 @@ 'use strict'; | ||
} | ||
/** | ||
* @param locales one locale or array of locales. | ||
* If array of locales is passed they would be used as fallback | ||
* locales for date and number formatting | ||
* @param messages compiled message catalog | ||
* @param notify Should emit `change` event for all subscribers. | ||
* This is useful for integration with frameworks as NextJS to avoid race-conditions during initialization. | ||
*/ | ||
loadAndActivate(locales, messages) { | ||
let notify = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
if (Array.isArray(locales)) { | ||
this._locale = locales[0]; | ||
this._locales = locales; | ||
} else { | ||
this._locale = locales; | ||
this._locales = null; | ||
} | ||
this._messages[this._locale] = messages; | ||
if (notify) { | ||
this.emit("change"); | ||
} | ||
} | ||
activate(locale, locales) { | ||
@@ -233,0 +256,0 @@ if (process.env.NODE_ENV !== "production") { |
@@ -229,2 +229,25 @@ import { compileMessage } from '@lingui/core/compile'; | ||
} | ||
/** | ||
* @param locales one locale or array of locales. | ||
* If array of locales is passed they would be used as fallback | ||
* locales for date and number formatting | ||
* @param messages compiled message catalog | ||
* @param notify Should emit `change` event for all subscribers. | ||
* This is useful for integration with frameworks as NextJS to avoid race-conditions during initialization. | ||
*/ | ||
loadAndActivate(locales, messages) { | ||
let notify = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
if (Array.isArray(locales)) { | ||
this._locale = locales[0]; | ||
this._locales = locales; | ||
} else { | ||
this._locale = locales; | ||
this._locales = null; | ||
} | ||
this._messages[this._locale] = messages; | ||
if (notify) { | ||
this.emit("change"); | ||
} | ||
} | ||
activate(locale, locales) { | ||
@@ -231,0 +254,0 @@ if (process.env.NODE_ENV !== "production") { |
@@ -87,2 +87,11 @@ declare class EventEmitter<Events extends { | ||
load(locale: Locale, messages: Messages): void; | ||
/** | ||
* @param locales one locale or array of locales. | ||
* If array of locales is passed they would be used as fallback | ||
* locales for date and number formatting | ||
* @param messages compiled message catalog | ||
* @param notify Should emit `change` event for all subscribers. | ||
* This is useful for integration with frameworks as NextJS to avoid race-conditions during initialization. | ||
*/ | ||
loadAndActivate(locales: Locale | Locales, messages: Messages, notify?: boolean): void; | ||
activate(locale: Locale, locales?: Locales): void; | ||
@@ -89,0 +98,0 @@ _(id: MessageDescriptor | string, values?: Values | undefined, { message, formats }?: MessageOptions | undefined): string; |
{ | ||
"name": "@lingui/core", | ||
"version": "4.0.0-next.2", | ||
"version": "4.0.0-next.3", | ||
"sideEffects": false, | ||
@@ -68,3 +68,3 @@ "description": "I18n tools for javascript", | ||
}, | ||
"gitHead": "556ab57e20c2ac9d384a22424c6a90c2ba0dd133" | ||
"gitHead": "29cad1bdcc781994ac4d496e5c4937795423d405" | ||
} |
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
111581
1124