<commit_before># VI18N

Simple number, currency, type and date formatters based on the [Internationalization API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).

## Requirements

* A [polyfill](https://github.com/andyearnshaw/Intl.js) when supporting [older browsers](http://caniuse.com/#feat=internationalization).
* Or use the Financial Times polyfill service at https://cdn.polyfill.io.

##Installation

Clone the project or download the zip. Include the file from the *dist* folder in you project and create one or more locales. Don't forget to include a polyfill when supporting older browsers!

##Examples

###Creating a locale
```javascript
define(['vi18n'], function(VI18N) {
  
  var nl = new VI18N(), // Default locale is Dutch with the Euro as currency
      uk = new VI18N('en-GB', 'GBP');
});
```

###Number formatting
```javascript
nl.formatNumber(12.50); // 12,50
uk.formatNumber(12.50); // 12.50
```

###Currency formatting
```javascript
nl.formatCurrency(12.50); // € 12,50
uk.formatCurrency(12.50); // £12.50

// In another currency
nl.formatCurrency(12.50, 'JPY'); // JP¥ 12,50
uk.formatCurrency(12.50, 'JPY'); // ¥12.50

// And without currency symbol
nl.formatCurrency(12.50, false); // 12,50
uk.formatCurrency(12.50, false); // 12.50
```

###Percent formatting
```javascript
nl.formatPercent(0.75); // 75%
uk.formatPercent(0.75); // 75%
```

###Date and time formatting
```javascript
var date = new Date();

nl.formatDate(date); // 2-9-2015
uk.formatDate(date); // 02/09/2015

nl.formatTime(date); // 12:38:09
uk.formatTime(date); // 12:38:09
```

###Months and days

```javascript

// Possible representation are "narrow", "short", "long" (default).

uk.getMonths()          // [ "January", "February", "March", etc. ]
uk.getMonths('short')   // [ "Jan", "Feb", "Mar", etc. ]
uk.getMonths('narrow')  // [ "J", "F", "M", etc. ]

uk.getDays()            // [ "Sunday", "Monday", "Tuesday", etc. ]
uk.getDays('short')     // [ "Sun", "Mon", "Tue", etc. ]
uk.getDays('narrow')    // [ "S", "M", "T", etc. ]
```

###Static methods
```javascript
// Get locale instances
var dutch = VI18N.get('nl-NL');

// Check for native browser support or the presence of a polyfill.
VI18N.isSupported();
```<commit_msg>Documentation<commit_after># VI18N

Simple number, currency, type and date formatters based on the [Internationalization API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl).

## Requirements

* A [polyfill](https://github.com/andyearnshaw/Intl.js) when supporting [older browsers](http://caniuse.com/#feat=internationalization).
* Or use the Financial Times polyfill service at https://cdn.polyfill.io.

##Installation

Clone the project or download the zip. Include the file from the *dist* folder in you project and create one or more locales. Don't forget to include a polyfill when supporting older browsers!

##Examples

###Creating a locale
```javascript
define(['vi18n'], function(VI18N) {
  
  var nl = new VI18N(), // Default locale is Dutch with the Euro as currency
      uk = new VI18N('en-GB', 'GBP');
});
```

###Number formatting
```javascript
nl.formatNumber(12.50); // 12,50
uk.formatNumber(12.50); // 12.50
```

###Currency formatting
```javascript
nl.formatCurrency(12.50); // € 12,50
uk.formatCurrency(12.50); // £12.50

// In another currency
nl.formatCurrency(12.50, 'JPY'); // JP¥ 12,50
uk.formatCurrency(12.50, 'JPY'); // ¥12.50

// Or without currency symbol
nl.formatCurrency(12.50, false); // 12,50
uk.formatCurrency(12.50, false); // 12.50
```

###Percent formatting
```javascript
nl.formatPercent(0.75); // 75%
uk.formatPercent(0.75); // 75%
```

###Date and time formatting
```javascript
var date = new Date();

nl.formatDate(date); // 2-9-2015
uk.formatDate(date); // 02/09/2015

nl.formatTime(date); // 12:38:09
uk.formatTime(date); // 12:38:09
```

###Months and days

```javascript

// Possible representations are "narrow", "short" or "long" (default).

uk.getMonths()          // [ "January", "February", "March", etc. ]
uk.getMonths('short')   // [ "Jan", "Feb", "Mar", etc. ]
uk.getMonths('narrow')  // [ "J", "F", "M", etc. ]

uk.getDays()            // [ "Sunday", "Monday", "Tuesday", etc. ]
uk.getDays('short')     // [ "Sun", "Mon", "Tue", etc. ]
uk.getDays('narrow')    // [ "S", "M", "T", etc. ]
```

###Static methods
```javascript
// Get locale instances
var dutch = VI18N.get('nl-NL');

// Check for native browser support or the presence of a polyfill.
VI18N.isSupported();
```
{'fraction_non_alphanumeric': 0.18962472406181016, 'fraction_numerical': 0.05033112582781457, 'mean_word_length': 3.9357298474945535, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1386121', 'n_tokens_mistral': 1733, 'n_tokens_neox': 1516, 'n_words': 419}