Closed felixzapata closed 8 years ago
Hmm, the demo defines a USD currency, and passes it down to the format.js
library, which does the actual translation. Maybe there's a problem there?
It is possible. I'm not sure. To check the correct value I tested with the stantard API (It is what the library does underhood). If you try this in the console:
var number = 10;
// request a currency format
console.log(new Intl.NumberFormat('fr-FR', { style: 'currency', currency: 'USD' }).format(number));
// → 10,00 $US
I will try to investigate what is the problem.
After another quick test, the library FormatJS works fine:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="dist/intl-messageformat.min.js"></script>
<script>
(function() {
var msg = new IntlMessageFormat('The price is: {price, number, USD}', 'fr-FR', {
number: {
USD: {
style : 'currency',
currency: 'USD'
}
}
});
var output = msg.format({price: 10});
console.log(output); // => The price is: 10,00 $US
})();
</script>
</head>
<body></body>
</html>
I will take a look and try to discover why is failing in the component.
@notwaldorf I've found the problem. I will make a PR.
Description
The demo in french should show the currency according the localize.
According with the
Intl.NumberFormat
specification, you can set the language to format the currency, but you only can set the options of the format, not the locales attribute.Expected outcome
La vente commence le Jan 1, 1970 à 1:00 AM. Tout est à 10,00 $US
Actual outcome
La vente commence le Jan 1, 1970 à 1:00 AM. Tout est à $10.00.
Steps to reproduce