## i18n : object Functions to help support multiple currencies and countries. **Kind**: global namespace * [i18n](#i18n) : object * [.country()](#i18n.country) ⇒ string * [.currency()](#i18n.currency) ⇒ string * [.symbol()](#i18n.symbol) ⇒ string * [.decimals()](#i18n.decimals) ⇒ number * [.convertCurrency(amount, fromCurrency, [toCurrency])](#i18n.convertCurrency) ⇒ Promise.<number> * [.moneyToFixed(amount)](#i18n.moneyToFixed) ⇒ string * [.moneyString(amount)](#i18n.moneyString) ⇒ string * [.currencyMinorToMajor(amount)](#i18n.currencyMinorToMajor) ⇒ number * [.currencyMajorToMinor(amount)](#i18n.currencyMajorToMinor) ⇒ number ### i18n.country() ⇒ string Get the 2-character ISO country code that PostalPoint is running in. **Kind**: static method of [i18n](#i18n) **Returns**: string - "US", "CA", etc. ### i18n.currency() ⇒ string Get the 3-character currency code in use. **Kind**: static method of [i18n](#i18n) **Returns**: string - "usd", "cad", etc. ### i18n.symbol() ⇒ string Get the currency symbol. **Kind**: static method of [i18n](#i18n) **Returns**: string - "$", "€", "₤", etc ### i18n.decimals() ⇒ number Get the number of decimal places for the currency: for example, USD has 2 ($x.00), KRW has 0 (x), UYW has 4 (x.0000). **Kind**: static method of [i18n](#i18n) **Returns**: number - 0, 2, 3, or 4 ### i18n.convertCurrency(amount, fromCurrency, [toCurrency]) ⇒ Promise.<number> Convert an amount of money to a different currency. Conversion rate is retrieved from the internet and cached for 4 hours. **Kind**: static method of [i18n](#i18n) | Param | Type | Default | Description | | --- | --- | --- | --- | | amount | number | | Amount of money in the "wrong" currency | | fromCurrency | string | | The currency code for the "wrong" currency that needs conversion | | [toCurrency] | string | "getCurrencyCode()" | The "correct" currency we want the amount to be in. | ### i18n.moneyToFixed(amount) ⇒ string Returns the amount as a string formatted with the correct number of decimal places for the currency in use. **Kind**: static method of [i18n](#i18n) **Returns**: string - "1.23", "1.2345", etc | Param | Type | | --- | --- | | amount | number | ### i18n.moneyString(amount) ⇒ string Returns the amount as a string, with the correct decimal places, and the local currency symbol. **Kind**: static method of [i18n](#i18n) **Returns**: string - "$1.23", etc | Param | Type | | --- | --- | | amount | number | ### i18n.currencyMinorToMajor(amount) ⇒ number Convert an amount in cents to dollars (or the local equivalent currency units). **Kind**: static method of [i18n](#i18n) **Returns**: number - Dollars, etc | Param | Type | Description | | --- | --- | --- | | amount | number | Cents, etc | ### i18n.currencyMajorToMinor(amount) ⇒ number Convert an amount in dollars to cents (or the local equivalent currency units). **Kind**: static method of [i18n](#i18n) **Returns**: number - Cents, etc | Param | Type | Description | | --- | --- | --- | | amount | number | Dollars, etc |