format-message
Advanced tools
Comparing version 5.1.1 to 5.1.2
@@ -24,3 +24,3 @@ /* globals Intl */ | ||
var pattern = typeof msg === 'string' ? msg : msg.default | ||
var id = typeof msg === 'object' && msg.id || generateId(pattern) | ||
var id = (typeof msg === 'object' && msg.id) || generateId(pattern) | ||
var key = locale + ':' + id | ||
@@ -27,0 +27,0 @@ var format = cache[key] || |
{ | ||
"name": "format-message", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"description": "Internationalize text, numbers, and dates using ICU Message Format", | ||
@@ -25,4 +25,4 @@ "author": "Andy VanWagoner <thetalecrafter@gmail.com> (https://thetalecrafter.com/)", | ||
"format-message-formats": "^5.1.0", | ||
"format-message-interpret": "^5.1.0", | ||
"format-message-parse": "^5.1.0", | ||
"format-message-interpret": "^5.1.2", | ||
"format-message-parse": "^5.1.2", | ||
"lookup-closest-locale": "^5.1.0", | ||
@@ -29,0 +29,0 @@ "object-assign": "^4.0.1" |
@@ -240,9 +240,9 @@ # ![format-message][logo] | ||
{formatChildren( | ||
formatMessage('Drag & Drop {extensions} files here _or_ __Browse__', { | ||
formatMessage('Drag & Drop {extensions} files here <0>or</0> <1>Browse</1>', { | ||
extensions | ||
}), | ||
{ | ||
_: <span className="or" />, | ||
__: <span className="browse" /> | ||
} | ||
[ | ||
<span className="or" />, | ||
<span className="browse" /> | ||
] | ||
)} | ||
@@ -297,2 +297,21 @@ </div> | ||
### String placeholders with nested data | ||
```js | ||
formatMessage('Welcome, {people.wes.name}, {people.julie.name}, and {people.sharon.name}!', { | ||
people: { | ||
wes: { | ||
name: 'Wes Phillips' | ||
}, | ||
julie: { | ||
name: 'Julie Roberts' | ||
}, | ||
sharon: { | ||
name: 'Sharon Sanders' | ||
} | ||
} | ||
}) | ||
// "Welcome, Wes Phillips, Julie Roberts, and Sharon Sanders!" | ||
``` | ||
### Complex number, date, and time placeholders | ||
@@ -299,0 +318,0 @@ |
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
29317
385