Router: addRoute that matches all locales
- caught-in-a-nette
- Member | 19
Hi
Currently I have
[<locale=en [a-z]{2,3}>[-<dialect [A-Za-z0-9]*>[-<country [A-Za-z0-9]{2,3}>]]/]<presenter>/<action>[/<id>]
,
as first parameter within $router->addRoute().
that matches presenter...
(S),
'en/presenter…(EN), `en-us/presenter...'(US), `zh-hant-tw/presenter...
(TW),
etc. (Where locale is any 2 or 3 alphabetical characters and
dialect is any alphanumerical characters and country is any
2 or 3 alphabetical characters, separated by hyphens.)
[Side note: this won't match en-us-posix, if that is really correct? But would match en-posix-us.]
And that seems to cover all locale bases. However is it possible to set say with US into locale=en, country=us and with TW set locale=zh, dialect=hant, country=tw? Doing such would be the regex that says accept dialect only if has a following country(url contains 2 hyphens) – otherwise employ locale and country only.