@@ -578,2 +578,3 @@ // I18n.js | ||
| var translation; | ||
| var usedScope = scope; | ||
@@ -588,3 +589,4 @@ var optionsWithoutDefault = this.prepareOptions(options) | ||
| if (isSet(translationOption.scope)) { | ||
| translation = this.lookup(translationOption.scope, optionsWithoutDefault); | ||
| usedScope = translationOption.scope; | ||
| translation = this.lookup(usedScope, optionsWithoutDefault); | ||
| } else if (isSet(translationOption.message)) { | ||
@@ -610,3 +612,3 @@ translation = lazyEvaluate(translationOption.message, scope); | ||
| } else if (isObject(translation) && isSet(options.count)) { | ||
| translation = this.pluralize(options.count, scope, options); | ||
| translation = this.pluralize(options.count, usedScope, options); | ||
| } | ||
@@ -613,0 +615,0 @@ |
+15
-1
@@ -21,2 +21,15 @@ # Change Log | ||
| ## [3.1.0] - 2018-11-01 | ||
| ### Added | ||
| - [Ruby] Add option to allow setting a different I18n backend | ||
| (PR: https://github.com/fnando/i18n-js/pull/519) | ||
| ### Fixed | ||
| - [JS] Fix missing translation when pluralizing with default scopes | ||
| (PR: https://github.com/fnando/i18n-js/pull/516) | ||
| ## [3.0.11] - 2018-07-06 | ||
@@ -338,3 +351,4 @@ | ||
| [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.0.11...HEAD | ||
| [Unreleased]: https://github.com/fnando/i18n-js/compare/v3.1.0...HEAD | ||
| [3.1.0]: https://github.com/fnando/i18n-js/compare/v3.0.11...v3.1.0 | ||
| [3.0.11]: https://github.com/fnando/i18n-js/compare/v3.0.10...v3.0.11 | ||
@@ -341,0 +355,0 @@ [3.0.10]: https://github.com/fnando/i18n-js/compare/v3.0.9...v3.0.10 |
+1
-1
| { | ||
| "name": "i18n-js", | ||
| "version": "3.0.11", | ||
| "version": "3.1.0", | ||
| "description": "A javascript library similar to Ruby on Rails i18n gem", | ||
@@ -5,0 +5,0 @@ "author": "Nando Vieira", |
+17
-3
@@ -342,3 +342,8 @@ # I18n.js | ||
| ```javascript | ||
| I18n.t("hello", {name: "John Doe"}); | ||
| // You need the `translations` object setup first | ||
| I18n.translations["en"] = { | ||
| greeting: "Hello %{name}" | ||
| } | ||
| I18n.t("greeting", {name: "John Doe"}); | ||
| ``` | ||
@@ -580,10 +585,12 @@ You can set default values for missing scopes: | ||
| If you prefer, you can use the `I18n.strftime` function to format dates. | ||
| If you prefer, you can use the `I18n.toTime` and `I18n.strftime` functions to format dates. | ||
| ```javascript | ||
| var date = new Date(); | ||
| I18n.toTime("date.formats.short", "2009-09-18"); | ||
| I18n.toTime("date.formats.short", date); | ||
| I18n.strftime(date, "%d/%m/%Y"); | ||
| ``` | ||
| The accepted formats are: | ||
| The accepted formats for `I18n.strftime` are: | ||
@@ -818,3 +825,10 @@ %a - The abbreviated weekday name (Sun) | ||
| ### JS `I18n.toCurrency` & `I18n.toNumber` cannot handle large integers | ||
| The above methods use `toFixed` and it only supports 53 bit integers. | ||
| Ref: http://2ality.com/2012/07/large-integers.html | ||
| Feel free to find & discuss possible solution(s) at issue [#511](https://github.com/fnando/i18n-js/issues/511) | ||
| ## Maintainer | ||
@@ -821,0 +835,0 @@ |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
79105
1.24%928
0.22%887
1.6%