Skip to content

Commit

Permalink
Add language setting in options, so they can specify the language to …
Browse files Browse the repository at this point in the history
…use when translating currency (helps determine where to put the currency symbol).
  • Loading branch information
jpederson committed Apr 6, 2019
1 parent 22dbf8a commit 03c50ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions jquery.accrue.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
mode: "basic",
operation: "keyup",
currency: "USD",
language: "en",
default_values: {
amount: "7,500",
rate: "7%",
Expand Down Expand Up @@ -166,11 +167,11 @@
// This function is used to add thousand seperators to numerical ouput
// as a means of properly formatting money
function formatNumber( num, options ) {
var formatted = new Intl.NumberFormat('en-US', {
var formatted = new Intl.NumberFormat( options.language, {
style: 'currency',
currency: options.currency
}).format( num );
return formatted.replace('$$','$');
return formatted;
}

// GET FIELD
Expand Down
2 changes: 1 addition & 1 deletion jquery.accrue.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "accrue",
"version": "0.1.0",
"version": "0.1.1",
"repository": {
"type": "git",
"url": "git://github.com/jpederson/Accrue.js.git"
Expand Down

0 comments on commit 03c50ad

Please sign in to comment.