Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Localizing PHP Applications "The Right Way", Part 4
Nov 21, 2011 @ 16:58:31

In the latest installment of their "Localizing PHP Applications 'The Right Way'" tutorial series (part four), they show off a feature of gettext that makes it simpler to deal with singular versus plural versions of your translations.

In Part 3 you learned some of the more important aspects of real-world localizing your application, such as using a default fallback locale and separating messages into multiple domain files depending on their usage. In this part I’ll show you what is arguably the most powerful feature of gettext – handling plural forms. The plural forms feature of gettext you enable you to localize your application perfectly and professionally.

The simple example they give is the difference between things like "1 file" versus "2 files". English is simpler than some other languages but gettext has special handling you can add to your translation files to help. A rule placed at the top of your file defines where to start the singular vs plural switch.

tagged: localize application plural singular

Link:

Tim Koschuetzki's Blog:
CakePHP Pluralize Helper
Nov 05, 2007 @ 19:48:00

Tim Koschuetzki has another CakePHP tip to share on his blog today - a helper that lets you pluralize a word easily.

Here is a small helper file for the CakePHP framework that will help you turn a subject into the pluralized form depending on a parameter.

His example shows how to use the tool, pluralizing the word "article". The Helper uses CakePHP's Inflector class to base the transition on ("so that special cases like "baby/babies" are taken care of as well").

tagged: cakephp framework helper pluralize plural inflector cakephp framework helper pluralize plural inflector

Link:

Tim Koschuetzki's Blog:
CakePHP Pluralize Helper
Nov 05, 2007 @ 19:48:00

Tim Koschuetzki has another CakePHP tip to share on his blog today - a helper that lets you pluralize a word easily.

Here is a small helper file for the CakePHP framework that will help you turn a subject into the pluralized form depending on a parameter.

His example shows how to use the tool, pluralizing the word "article". The Helper uses CakePHP's Inflector class to base the transition on ("so that special cases like "baby/babies" are taken care of as well").

tagged: cakephp framework helper pluralize plural inflector cakephp framework helper pluralize plural inflector

Link:


Trending Topics: