[TYPO3-doc] Domain model for documentation

François Suter fsu-lists at cobweb.ch
Wed Aug 1 12:32:57 CEST 2012


Hi,

> Basically it's all in http://www.ietf.org/rfc/rfc4646.txt … but to simplify things a bit, you can take a shortcut an look at the Locale class in FLOW3.
>
> The regex we are using takes most cases of the standard into account:
>
> /^(?P<language>[a-zA-Z]{2,3})(?:[-_](?P<script>[a-zA-Z]{4}))?(?:[-_](?P<region>[a-zA-Z]{2}|[0-9]{3})){0,1}(?:[-_](?P<variant>(?:[a-zA-Z0-9]{5,8})|(?:[0-9][a-zA-Z0-9]{3})))?(?:[-_].+)*$/

I've just found that there's actually a LocaleIdentifierValidator, so 
that's all I need :-)

BTW any idea how long a fully qualified locale identifier can be? I had 
start with a naive 5-character length (assuming the form was xx_YY), but 
I see that it can be much longer. I've settled on 50 for now, is that 
safe enough?

Cheers

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-project-documentation mailing list