lingui-i18n
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -29,4 +29,4 @@ 'use strict'; | ||
constructor(language = '', messages = {}) { | ||
this._language = language; | ||
this._messages = messages; | ||
this.activate(language); | ||
@@ -58,3 +58,9 @@ this.t = (0, _t2.default)(this); | ||
activate(language) { | ||
if (language) this._language = language; | ||
if (!language) return; | ||
if (!(language in _plurals2.default)) { | ||
throw new Error(`Unknown locale "${language}".`); | ||
} | ||
this._language = language; | ||
} | ||
@@ -61,0 +67,0 @@ |
@@ -10,7 +10,7 @@ 'use strict'; | ||
const plural = i18n => (_ref) => { | ||
let value = _ref.value; | ||
var _ref$offset = _ref.offset; | ||
let offset = _ref$offset === undefined ? 0 : _ref$offset, | ||
other = _ref.other, | ||
let { | ||
value, | ||
offset = 0, | ||
other | ||
} = _ref, | ||
pluralForms = _objectWithoutProperties(_ref, ['value', 'offset', 'other']); | ||
@@ -23,7 +23,7 @@ | ||
const selectOrdinal = i18n => (_ref2) => { | ||
let value = _ref2.value; | ||
var _ref2$offset = _ref2.offset; | ||
let offset = _ref2$offset === undefined ? 0 : _ref2$offset, | ||
other = _ref2.other, | ||
let { | ||
value, | ||
offset = 0, | ||
other | ||
} = _ref2, | ||
pluralForms = _objectWithoutProperties(_ref2, ['value', 'offset', 'other']); | ||
@@ -36,4 +36,6 @@ | ||
function select(_ref3) { | ||
let value = _ref3.value, | ||
other = _ref3.other, | ||
let { | ||
value, | ||
other | ||
} = _ref3, | ||
selectForms = _objectWithoutProperties(_ref3, ['value', 'other']); | ||
@@ -40,0 +42,0 @@ |
@@ -13,5 +13,3 @@ 'use strict'; | ||
if (!Array.isArray(strings)) { | ||
const id = strings.id, | ||
params = strings.params; | ||
const { id, params } = strings; | ||
return i18n.translate({ id, params }); | ||
@@ -18,0 +16,0 @@ } |
{ | ||
"name": "lingui-i18n", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "I18n tools for javascript", | ||
@@ -26,6 +26,6 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"babel-cli": "^6.22.2", | ||
"babel-cli": "^6.23.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.22.0", | ||
"babel-polyfill": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
"babel-polyfill": "^6.23.0", | ||
"babel-preset-env": "^1.1.8", | ||
@@ -32,0 +32,0 @@ "rimraf": "^2.5.4" |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
43977
446
0