Skip to content

Commit

Permalink
feat(locale): add estonian (ee-EE) language support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihhail Rehokainen committed Jun 16, 2023
1 parent e96ca2f commit df44a3f
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 20 deletions.
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/>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.<br/>*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
Expand Down
3 changes: 3 additions & 0 deletions src/ToWords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -42,6 +43,8 @@ export class ToWords {
public getLocaleClass(): ConstructorOf<LocaleInterface> {
/* eslint-disable @typescript-eslint/no-var-requires */
switch (this.options.localeCode) {
case 'ee-EE':
return eeEE;
case 'en-AE':
return enAe;
case 'en-BD':
Expand Down
86 changes: 86 additions & 0 deletions src/locales/ee-EE.ts
Original file line number Diff line number Diff line change
@@ -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,
};
}

0 comments on commit df44a3f

Please sign in to comment.