Improved Inflector singular() and plural() functions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Improved Inflector singular() and plural() functions (/showthread.php?tid=30047) |
Improved Inflector singular() and plural() functions - El Forum - 04-30-2010 [eluser]milkboy[/eluser] Hi all, I made a port of the CakePHP Inflector class, as the CI helper is a bit limited. Contains only two files MY_inflector_helper.php and a inflector.php config file containing the rules (so it is easy to extend and all the rules only get loaded if needed) I do not have a lot experience posting stuff, so any feedback welcome. PS: Am I correct in thinking there is no problem with copyright here, as I clearly stated what the base of my code is and acknowledged copyright. If I have broken any rules or done anything I shouldn't have, please let me know. Improved Inflector singular() and plural() functions - El Forum - 05-01-2010 [eluser]Tominator[/eluser] Why is this one better then CI's? (Why should I use it?) Tom. Improved Inflector singular() and plural() functions - El Forum - 05-01-2010 [eluser]milkboy[/eluser] The CI helper just checks a few of the most common rules. This one checks many more. Additionally as all the rules are included in a config file, they can easily be extended. If you notice a word is not being processed correctly, just add it to the config file. If anybody can't figure out how to implement or amend this script, just let me know (but should be logical with very basic CI knowledge). As a final point, as the rules are in a config file, this could be used as a starting point to create rules to work with other languages. Here are some words (singular form|plural form), CI does not process correctly: quiz|quizzes ox|oxen mouse|mice matrix|matrices index|indices person|people man|men child|children tomato|tomatoes alias|aliases crisis|crises tax|taxes analysis|analyses atlas|atlases loaf|loaves octopus|octopuses equipment|equipment information|information media|media Portuguese|Portuguese rice|rice tuna|tuna Improved Inflector singular() and plural() functions - El Forum - 11-28-2010 [eluser]Nicolas Connault[/eluser] Actually if you are going to use the proper plural for Latin words like index, you should also use the proper plural for Greek words like octopus: octopodes Improved Inflector singular() and plural() functions - El Forum - 05-11-2012 [eluser]murphy2006[/eluser] Where can I find this download? Improved Inflector singular() and plural() functions - El Forum - 05-11-2012 [eluser]jmadsen[/eluser] Very nice! I'm a big fan of people porting/sharing libraries from other frameworks & apps, and yours seems well thought out Improved Inflector singular() and plural() functions - El Forum - 05-11-2012 [eluser]Unknown[/eluser] Seems like the file is not available for download anymore? |