JodaOrg/joda-time — pull request #166 by gswierczynski (2014-08-12 00:43:00+00:00)
Title: Add regular expression based localization to PeriodFormatterBuilder

Add regular expression based localization to PeriodFormatterBuilder and PeriodFormat. Add Polish locale to PeriodFormat. Add tests.

Some of the languages have more complicated rules regarding suffixes than 1->singular "not 1"->plural. The current implementation and current set of available properties in messages_.properties files does not allow to provide proper localization for languages like that.

For example in Polish (
"1 year, 2 years, 5 years, 12 years, 15 years, 21 years, 22 years, 25 years"
translates to
"1 rok, 2 lata, 5 lat, 12 lat, 15 lat, 21 lat, 22 lata, 25 lat").
Notice 3 different suffixes.

Rather than implementing logic that describes the rules for that one particular language, regular expessions are used to match value to suffix. The above can be solved with:
PeriodFormat.regex.separator=%
PeriodFormat.years.regex=^1$%[0-9]*(?