Skip to content

Commit b86a89c

Browse files
committed
Update readme
1 parent a8f6e91 commit b86a89c

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

README.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,47 @@ Inflection _extension_ for Yii2. Support for English / Russian languages to infl
66
[![License](https://poser.pugx.org/wapmorgan/yii2-inflection/license)](https://packagist.org/packages/wapmorgan/yii2-inflection)
77

88
1. [Features](#features)
9-
- [Cases](#cases)
10-
- [Currencies](#cases)
9+
- [Cases](#cases)
10+
- [Currencies](#cases)
1111
2. [How does it work](#how-does-it-work)
1212
3. [Installation](#installation)
1313

1414
## Features
1515
1. **Pluralize word with number**:
1616
- `en`: `Yii::$app->inflection->pluralize(2, 'item')` => `2 items`
1717
- `ru`: `Yii::$app->inflection->pluralize(2, 'элемент')` => `2 элемента`
18-
18+
1919
2. **Inflect names to relational cases (applicable in Russian only)**:
2020
- `ru`: `Yii::$app->inflection->inflectName('Иванов Петр', wapmorgan\yii2inflector\Inflector::DATIVE)` => `Иванову Петру`
2121
- _Description of all supported cases are in [Cases](#cases) section._
22-
22+
2323
3. **Inflect geographical names to relational cases (applicable in Russian only)**:
2424
- `ru`: `Yii::$app->inflection->inflectGeoName('Санкт-Петербург', , wapmorgan\yii2inflector\Inflector::GENITIVE)` => `Санкт-Петербурга`
25-
25+
2626
4. **Generate cardinal numerals**:
27-
- (_WIP_) `en`: `Yii::$app->inflection->cardinalize(2)` => 'two'
27+
- (_WIP_) `en`: `Yii::$app->inflection->cardinalize(2)` => 'two'
2828
- `ru`: `Yii::$app->inflection->cardinalize(2)` => 'два'
2929

3030
5. **Generate ordinal numerals**:
3131
- `en`: `Yii::$app->inflection->ordinalize(2)` => '2nd'
3232
- `ru`: `Yii::$app->inflection->ordinalize(2)` => '2-й'
33-
33+
3434
And full form:
35-
35+
3636
- (_WIP_) `en`: `Yii::$app->inflection->ordinalize(2, wapmorgan\yii2inflection\Inflector::FULL)` => 'second'
3737
- `ru`: `Yii::$app->inflection->ordinalize(2, wapmorgan\yii2inflection\Inflector::FULL)` => 'второй'
3838

3939
6. **Money to words**:
4040
- (_WIP_) `en`: `Yii::$app->inflection->monetize(wapmorgan\yii2inflection\Inflector::DOLLAR, 122.04)` => 'one hundred twenty-two dollars four cents'
4141
- `ru`: `Yii::$app->inflection->monetize(wapmorgan\yii2inflection\Inflector::DOLLAR, 122.04)` => 'сто двадцать два доллара четыре цента'
4242
- _Description of all supported currencies are in [Currencies](#currencies) section._
43-
43+
4444
7. **Data range to words**:
4545
- (_WIP_) `en`: `Yii::$app->inflection->textizeTimeRange(new DateInterval('P2Y'))` => '2 years'
4646
- `ru`: `Yii::$app->inflection->textizeTimeRange(new DateInterval('P2Y'))` => '2 года'
47-
47+
4848
_WIP_ means Work-in-progress i.e this feature is not supported now, but planned to be implemented.
49-
49+
5050
### Cases
5151

5252
| Case | Russian |
@@ -110,12 +110,14 @@ It uses built-in inflector for English (`yii\helpers\Inflector`) and [Morphos](h
110110
];
111111
```
112112
- Optional service parameters:
113-
- `language` - default language for inflection. Currently supported langs is `ru` (Russian) and `en` (English). If you passed unsupported or unknown language, an Exception will be throwed during service initializion. By default, it uses **language** parameter of current application.
114-
113+
- `language` - default language for inflection. Currently supported langs is `ru` (Russian) and `en` (English). If you passed unsupported or unknown language, an Exception will be throwed during service initializion. By default, it uses **language** parameter of current application.
114+
- `defaultCurrency` - default currency when converting money to words. If set, call `monetize(float value)` without currency: `Yii::$app->inflection->monetize(123.45)` => `сто двадцать три рубля сорок пять копеек`
115+
116+
115117
3. Call any methods described above in a controller / command / view.
116118
```php
117119
$word = 'новость';
118-
120+
119121
echo Yii::$app->inflection->pluralize(rand(2, 139), $word).PHP_EOL;
120122
echo Yii::$app->inflection->pluralize(rand(9, 69), $word).PHP_EOL;
121123
```

0 commit comments

Comments
 (0)