The Intl package makes localization easier by extending the static Utility classes and automatically loading the correct format patterns, inflection rules, and validation patterns. With this awesome feature, no manual implementation is required.
The Titon\Intl\Utility\Format class extends Titon\Utility\Format and provides automatic localization of format patterns for the following methods:
date()- Loads thedatepattern.datetime()- Loads thedatetimepattern.phone()- Loads thephonepattern.relativeTime()- Loads message strings from the "common" domain, "format" catalog.ssn()- Loads thessnpattern.time()- Loads thetimepattern.
Titon\Intl\Utility\Format::relativeTime($date); // 1 week agoThe Titon\Intl\Utility\Inflect class extends Titon\Utility\Inflect and provides automatic localization and enforcement of inflection rules for the following methods:
ordinal()- Loads theordinalrule.plural()- Loads theplural,irregular, anduninflectedrules.singular()- Loads thesingular,irregular, anduninflectedrules.transliterate()- Loads thetransliterationrule.
Titon\Intl\Utility\Inflect::plural('quiz'); // quizzesThe Titon\Intl\Utility\Number class extends Titon\Utility\Number and provides automatic localization of number configurations for the following methods:
currency()- Loads thenumberandcurrencyformat patterns.percentage()- Loads thenumberformat pattern.
Titon\Intl\Utility\Number::currency(-1000); // ($1,000)The Titon\Intl\Utility\Validate class extends Titon\Utility\Validate and provides automatic localization of validation patterns for the following methods:
currency()- Loads thecurrencypattern.phone()- Loads thephonepattern.postalCode()- Loads thepostal_codepattern.ssn()- Loads thessnpattern.
Titon\Intl\Utility\Validate::postalCode('abc123'); // false