cgrammar Simple helper for natural, grammatically correct langage (plurals etc)

  1. Documentation
  2. Change Log

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.

Resources

Documentation

Requirements
  • Yii 1.0 or above
Installation
  • Extract the release file under protected/components or I actually use protected/helpers
Usage

Examples:

// 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
3 0
2 followers
282 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Tags:
Developed by: Alex Muir
Created on: Jul 1, 2010
Last updated: 13 years ago

Downloads

show all