Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fluent

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluent - npm Package Compare versions

Comparing version 0.10.0 to 0.11.0

10

CHANGELOG.md
# Changelog
## fluent 0.11.0 (February 15, 2019)
- Add the `allowOverrides` option to `FluentBundle.addResource`. (#332)
`FluentBundle.addResource` and `FluentBundle.addMessages` now both accept
an `options` object as the last argument. The `allowOverrides` option may
be used to control whether it's allowed to override existing mesages or
terms with new values. The default is `false`.
## fluent 0.10.0 (December 13, 2018)

@@ -4,0 +14,0 @@

43

compat.js

@@ -1,2 +0,2 @@

/* fluent@0.10.0 */
/* fluent@0.11.0 */
(function (global, factory) {

@@ -1255,2 +1255,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

* marks (FSI, PDI) for bidi interpolations.
* Default: true
*

@@ -1327,6 +1328,19 @@ * - `transform` - a function used to transform string parts of patterns.

*
* bundle.addMessages('bar = Bar');
* bundle.addMessages('bar = Newbar', { allowOverrides: true });
* bundle.getMessage('bar');
*
* // Returns a raw representation of the 'bar' message: Newbar.
*
* Parsed entities should be formatted with the `format` method in case they
* contain logic (references, select expressions etc.).
*
* Available options:
*
* - `allowOverrides` - boolean specifying whether it's allowed to override
* an existing message or term with a new value.
* Default: false
*
* @param {string} source - Text resource with translations.
* @param {Object} [options]
* @returns {Array<Error>}

@@ -1336,5 +1350,5 @@ */

addMessages(source) {
addMessages(source, options) {
const res = FluentResource.fromString(source);
return this.addResource(res);
return this.addResource(res, options);
}

@@ -1353,6 +1367,21 @@ /**

*
* let res = FluentResource.fromString("bar = Bar");
* bundle.addResource(res);
* res = FluentResource.fromString("bar = Newbar");
* bundle.addResource(res, { allowOverrides: true });
* bundle.getMessage('bar');
*
* // Returns a raw representation of the 'bar' message: Newbar.
*
* Parsed entities should be formatted with the `format` method in case they
* contain logic (references, select expressions etc.).
*
* Available options:
*
* - `allowOverrides` - boolean specifying whether it's allowed to override
* an existing message or term with a new value.
* Default: false
*
* @param {FluentResource} res - FluentResource object.
* @param {Object} [options]
* @returns {Array<Error>}

@@ -1363,2 +1392,6 @@ */

addResource(res) {
let _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref2$allowOverrides = _ref2.allowOverrides,
allowOverrides = _ref2$allowOverrides === void 0 ? false : _ref2$allowOverrides;
const errors = [];

@@ -1378,3 +1411,3 @@ var _iteratorNormalCompletion = true;

// and cannot be retrieved from FluentBundle.
if (this._terms.has(id)) {
if (allowOverrides === false && this._terms.has(id)) {
errors.push(`Attempt to override an existing term: "${id}"`);

@@ -1386,3 +1419,3 @@ continue;

} else {
if (this._messages.has(id)) {
if (allowOverrides === false && this._messages.has(id)) {
errors.push(`Attempt to override an existing message: "${id}"`);

@@ -1389,0 +1422,0 @@ continue;

@@ -1,2 +0,2 @@

/* fluent@0.10.0 */
/* fluent@0.11.0 */
(function (global, factory) {

@@ -998,2 +998,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

* marks (FSI, PDI) for bidi interpolations.
* Default: true
*

@@ -1065,11 +1066,24 @@ * - `transform` - a function used to transform string parts of patterns.

*
* bundle.addMessages('bar = Bar');
* bundle.addMessages('bar = Newbar', { allowOverrides: true });
* bundle.getMessage('bar');
*
* // Returns a raw representation of the 'bar' message: Newbar.
*
* Parsed entities should be formatted with the `format` method in case they
* contain logic (references, select expressions etc.).
*
* Available options:
*
* - `allowOverrides` - boolean specifying whether it's allowed to override
* an existing message or term with a new value.
* Default: false
*
* @param {string} source - Text resource with translations.
* @param {Object} [options]
* @returns {Array<Error>}
*/
addMessages(source) {
addMessages(source, options) {
const res = FluentResource.fromString(source);
return this.addResource(res);
return this.addResource(res, options);
}

@@ -1089,9 +1103,26 @@

*
* let res = FluentResource.fromString("bar = Bar");
* bundle.addResource(res);
* res = FluentResource.fromString("bar = Newbar");
* bundle.addResource(res, { allowOverrides: true });
* bundle.getMessage('bar');
*
* // Returns a raw representation of the 'bar' message: Newbar.
*
* Parsed entities should be formatted with the `format` method in case they
* contain logic (references, select expressions etc.).
*
* Available options:
*
* - `allowOverrides` - boolean specifying whether it's allowed to override
* an existing message or term with a new value.
* Default: false
*
* @param {FluentResource} res - FluentResource object.
* @param {Object} [options]
* @returns {Array<Error>}
*/
addResource(res) {
addResource(res, {
allowOverrides = false
} = {}) {
const errors = [];

@@ -1103,3 +1134,3 @@

// and cannot be retrieved from FluentBundle.
if (this._terms.has(id)) {
if (allowOverrides === false && this._terms.has(id)) {
errors.push(`Attempt to override an existing term: "${id}"`);

@@ -1110,3 +1141,3 @@ continue;

} else {
if (this._messages.has(id)) {
if (allowOverrides === false && this._messages.has(id)) {
errors.push(`Attempt to override an existing message: "${id}"`);

@@ -1113,0 +1144,0 @@ continue;

2

package.json
{
"name": "fluent",
"description": "Localization library for expressive translations.",
"version": "0.10.0",
"version": "0.11.0",
"homepage": "http://projectfluent.org",

@@ -6,0 +6,0 @@ "author": "Mozilla <l10n-drivers@mozilla.org>",

@@ -45,2 +45,3 @@ import resolve from "./resolver.js";

* marks (FSI, PDI) for bidi interpolations.
* Default: true
*

@@ -112,11 +113,24 @@ * - `transform` - a function used to transform string parts of patterns.

*
* bundle.addMessages('bar = Bar');
* bundle.addMessages('bar = Newbar', { allowOverrides: true });
* bundle.getMessage('bar');
*
* // Returns a raw representation of the 'bar' message: Newbar.
*
* Parsed entities should be formatted with the `format` method in case they
* contain logic (references, select expressions etc.).
*
* Available options:
*
* - `allowOverrides` - boolean specifying whether it's allowed to override
* an existing message or term with a new value.
* Default: false
*
* @param {string} source - Text resource with translations.
* @param {Object} [options]
* @returns {Array<Error>}
*/
addMessages(source) {
addMessages(source, options) {
const res = FluentResource.fromString(source);
return this.addResource(res);
return this.addResource(res, options);
}

@@ -136,9 +150,26 @@

*
* let res = FluentResource.fromString("bar = Bar");
* bundle.addResource(res);
* res = FluentResource.fromString("bar = Newbar");
* bundle.addResource(res, { allowOverrides: true });
* bundle.getMessage('bar');
*
* // Returns a raw representation of the 'bar' message: Newbar.
*
* Parsed entities should be formatted with the `format` method in case they
* contain logic (references, select expressions etc.).
*
* Available options:
*
* - `allowOverrides` - boolean specifying whether it's allowed to override
* an existing message or term with a new value.
* Default: false
*
* @param {FluentResource} res - FluentResource object.
* @param {Object} [options]
* @returns {Array<Error>}
*/
addResource(res) {
addResource(res, {
allowOverrides = false
} = {}) {
const errors = [];

@@ -150,3 +181,3 @@

// and cannot be retrieved from FluentBundle.
if (this._terms.has(id)) {
if (allowOverrides === false && this._terms.has(id)) {
errors.push(`Attempt to override an existing term: "${id}"`);

@@ -157,3 +188,3 @@ continue;

} else {
if (this._messages.has(id)) {
if (allowOverrides === false && this._messages.has(id)) {
errors.push(`Attempt to override an existing message: "${id}"`);

@@ -160,0 +191,0 @@ continue;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc