Skip to content

Commit

Permalink
Merge pull request #6 from ashokdevatwal/feature/hindi
Browse files Browse the repository at this point in the history
Added Hindi to the List of supported languages
  • Loading branch information
rmunate authored Aug 15, 2023
2 parents f5cfc8e + dff8d59 commit a44f7a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Convert Numbers to Words in Laravel

Easily convert numbers to words in Laravel using this library, which leverages the native `PHP INTL` extension to perform conversion effortlessly. With this library, you can convert numbers to words in various languages and also obtain the value in currency format according to the selected language. Supported languages include English, Spanish, Portuguese, French, Italian, Romanian, and with the contribution of [Siros Fakhri](https://github.com/sirosfakhri), Persian (Farsi) support has been added.
Easily convert numbers to words in Laravel using this library, which leverages the native `PHP INTL` extension to perform conversion effortlessly. With this library, you can convert numbers to words in various languages and also obtain the value in currency format according to the selected language. Supported languages include English, Spanish, Portuguese, French, Italian, Romanian, Hindi and with the contribution of [Siros Fakhri](https://github.com/sirosfakhri), Persian (Farsi) support has been added.

⚙️ This library is compatible with Laravel versions 8.0 and higher ⚙️

Expand Down Expand Up @@ -46,6 +46,7 @@ SpellNumber::getAllLocales();
// 4 => "it" (Italian)
// 5 => "ro" (Romanian)
// 6 => "fa" (Farsi)
// 7 => "hi" (India)
// ]
```

Expand All @@ -62,6 +63,9 @@ SpellNumber::value(100)->locale('fa')->toLetters();

SpellNumber::value(100)->locale('en')->toLetters();
// "One Hundred"

SpellNumber::value(100)->locale('hi')->toLetters();
// "एक सौ"
```

#### Convert Floating-Point Numbers
Expand All @@ -71,6 +75,9 @@ If needed, you can pass a floating-point number as an argument to convert it to
```php
SpellNumber::value(123456789.12)->locale('es')->toLetters();
// "Ciento Veintitrés Millones Cuatrocientos Cincuenta Y Seis Mil Setecientos Ochenta Y Nueve Con Doce"

SpellNumber::value(123456789.12)->locale('hi')->toLetters();
// "बारह करोड़ चौंतीस लाख छप्पन हज़ार सात सौ नवासी और बारह"
```

#### Convert to Currency Format
Expand All @@ -86,6 +93,12 @@ SpellNumber::value(100.12)->locale('es')->currency('Pesos')->fraction('centavos'

SpellNumber::value(100)->locale('fa')->currency('تومان')->toMoney();
// "صد تومان"

SpellNumber::value(100.12)->locale('hi')->currency('रूपये')->fraction('पैसे')->toMoney();
// "एक सौ रूपये और बारह पैसे"

SpellNumber::value(100)->locale('hi')->currency('रूपये')->toMoney();
// "एक सौ रूपये"
```

#### Other Initializer Methods
Expand All @@ -106,7 +119,8 @@ SpellNumber::float('12345.23')->locale('es')->toLetters();
- Email: [email protected]

## Contributors
[Siros Fakhri](https://github.com/sirosfakhri) (Farsi Language)
- [Siros Fakhri](https://github.com/sirosfakhri) (Farsi Language)
- [Ashok Devatwal](https://github.com/ashokdevatwal) (Hindi Language)

## License

Expand Down
2 changes: 2 additions & 0 deletions src/Langs/Langs.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final class Langs
'it', // Italian from Italy
'ro', // Romanian from Romania
'fa', // Farsi from Iran
'hi', // Hindi from India
];

/**
Expand All @@ -34,6 +35,7 @@ final class Langs
'it' => 'con', // Italian from Italy: "con"
'ro' => 'cu', // Romanian from Romania: "cu"
'fa' => 'ممیز', // Farsi from Iran: "ممیز"
'hi' => 'और', // Hindi from India: "और"
];

/**
Expand Down

0 comments on commit a44f7a9

Please sign in to comment.