UPDATE: I have renamed this class HGrammar to prevent any conflict.
This extension is a simple helper class which I use to make sure text generated by my application is natural.
Plurals - no need to put bracket(s) after your word(s). Lists - produce a nice, simple and clean list from an array. Vowels - Words beginning with a vowel are prefixed with a/an.
- Yii 1.0 or above
- Extract the release file under
protected/componentsor I actually use
// PLURALS echo HGrammar::plural($commentCount,'comment'); // Output: 'comment' if commentCount is 1, otherwise 'comments' // LISTS $people = array('John','Trevor','Qiang'); echo HGrammar::commaList($people); // Output: 'John, Trevor and Qiang'. See PHPDoc for Vowels function
Change Log ¶
July 1, 2010 ¶
- Initial release.
July 2, 2010 ¶
- Changed class name to HGrammar instead of CGrammar