diff --git a/README.md b/README.md index b109bf89..d9c77a59 100644 --- a/README.md +++ b/README.md @@ -103,26 +103,27 @@ let words = toWords.convert(0.572, { currency: true, ignoreZeroCurrency: true }) | currencyOptions | object | undefined | By default currency options are taken from the specified locale.
This option allows to specify different currency options while keeping the language details from the selected locale (e.g. convert to English text but use EUR as a currency). You can define different currencies for each call to `convert()` so it works also if you need to dynamically support multiple currencies.
*This works only when `currency = true`* | ## Supported Locale -| Country | Language | Locale | -| ------------- | ------------- | ------------- | -| UAE | English | en-AE | -| Bangladesh | English | en-BD | -| UK | English | en-GB | -| Ghana | English | en-GH | -| India | English | en-IN (default) | -| Myanmar | English | en-MM | -| Mauritius | English | en-MU | -| Nigeria | English | en-NG | -| Nepal | English | en-NP | -| USA | English | en-US | -| Iran | Persian | fa-IR | -| France | French | fr-FR | -| India | Gujarati | gu-IN | -| India | Hindi | hi-IN | -| India | Marathi | mr-IN | -| Suriname | Dutch | nl-SR | -| Brazil | Portuguese | pt-BR | -| Turkey | Turkish | tr-TR | +| Country | Language | Locale | +|------------|------------|-----------------| +| UAE | English | en-AE | +| Bangladesh | English | en-BD | +| UK | English | en-GB | +| Ghana | English | en-GH | +| India | English | en-IN (default) | +| Myanmar | English | en-MM | +| Mauritius | English | en-MU | +| Nigeria | English | en-NG | +| Nepal | English | en-NP | +| USA | English | en-US | +| Estonia | Estonian | ee-EE | +| Iran | Persian | fa-IR | +| France | French | fr-FR | +| India | Gujarati | gu-IN | +| India | Hindi | hi-IN | +| India | Marathi | mr-IN | +| Suriname | Dutch | nl-SR | +| Brazil | Portuguese | pt-BR | +| Turkey | Turkish | tr-TR | ## Inspiration for core logic diff --git a/src/ToWords.ts b/src/ToWords.ts index 69c65264..812e2d08 100644 --- a/src/ToWords.ts +++ b/src/ToWords.ts @@ -17,6 +17,7 @@ import mrIn from './locales/mr-IN'; import ptBR from './locales/pt-BR'; import trTr from './locales/tr-TR'; import nlSr from './locales/nl-SR'; +import eeEE from './locales/ee-EE'; export const DefaultConverterOptions: ConverterOptions = { currency: false, @@ -42,6 +43,8 @@ export class ToWords { public getLocaleClass(): ConstructorOf { /* eslint-disable @typescript-eslint/no-var-requires */ switch (this.options.localeCode) { + case 'ee-EE': + return eeEE; case 'en-AE': return enAe; case 'en-BD': diff --git a/src/locales/ee-EE.ts b/src/locales/ee-EE.ts new file mode 100644 index 00000000..9391f55f --- /dev/null +++ b/src/locales/ee-EE.ts @@ -0,0 +1,86 @@ +import { LocaleConfig, LocaleInterface } from '../types'; + +export default class Locale implements LocaleInterface { + public config: LocaleConfig = { + currency: { + name: 'Euro', + plural: 'Eurot', + symbol: '€', + fractionalUnit: { + name: 'Sent', + plural: 'Senti', + symbol: '¢', + }, + }, + texts: { + and: 'Ja', + minus: 'Miinus', + only: 'Ainult', + point: 'Koma', + }, + numberWordsMapping: [ + { number: 1000000000000000, value: 'Kvadriljon' }, + { number: 1000000000000, value: 'Triljon' }, + { number: 1000000000, value: 'Miljard' }, + { number: 1000000, value: 'Miljon' }, + { number: 1000, value: 'Tuhat' }, + { number: 900, value: 'Üheksasada' }, + { number: 800, value: 'Kaheksasada' }, + { number: 700, value: 'Seitsesada' }, + { number: 600, value: 'Kuussada' }, + { number: 500, value: 'Viissada' }, + { number: 400, value: 'Nelisada' }, + { number: 300, value: 'Kolmsada' }, + { number: 200, value: 'Kakssada' }, + { number: 100, value: 'Sada' }, + { number: 90, value: 'Üheksakümmend' }, + { number: 80, value: 'Kaheksakümmend' }, + { number: 70, value: 'Seitsekümmend' }, + { number: 60, value: 'Kuuskümmend' }, + { number: 50, value: 'Viiskümmend' }, + { number: 40, value: 'Nelikümmend' }, + { number: 30, value: 'Kolmkümmend' }, + { number: 20, value: 'Kakskümmend' }, + { number: 19, value: 'Üheksateist' }, + { number: 18, value: 'Kaheksateist' }, + { number: 17, value: 'Seitseteist' }, + { number: 16, value: 'Kuusteist' }, + { number: 15, value: 'Viisteist' }, + { number: 14, value: 'Neliteist' }, + { number: 13, value: 'Kolmteist' }, + { number: 12, value: 'Kaksteist' }, + { number: 11, value: 'Üksteist' }, + { number: 10, value: 'Kümme' }, + { number: 9, value: 'Üheksa' }, + { number: 8, value: 'Kaheksa' }, + { number: 7, value: 'Seitse' }, + { number: 6, value: 'Kuus' }, + { number: 5, value: 'Viis' }, + { number: 4, value: 'Neli' }, + { number: 3, value: 'Kolm' }, + { number: 2, value: 'Kaks' }, + { number: 1, value: 'Üks' }, + { number: 0, value: 'Null' }, + ], + ignoreOneForWords: [ + 'Sada', + 'Kakssada', + 'Kolmsada', + 'Nelisada', + 'Viissada', + 'Kuussada', + 'Seitsesada', + 'Kaheksasada', + 'Üheksasada', + ], + exactWordsMapping: [ + { + number: 100, + value: 'Ükssada', + }, + ], + pluralWords: ['Miljon', 'Miljard', 'Trillion', 'Kvadriljon'], + pluralMark: 'it', + onlyInFront: true, + }; +}