[Catalyst] [Absolute Beginner] Navigation Q Part II i18n and URIs
Ekki Plicht (DF4OR)
ep at plicht.de
Fri Aug 20 21:25:48 GMT 2010
still at the absolute beginner level, but having read some more tutorials and
manuals and played more with DispatchTest.
Two pre-requisites which I must fulfill in my webshop:
1.) I have to consider internationalisation (i18n) of my app. It has to serve
pages in 5 languages (today), probably more later. Language is depending on
browser header information or user choice.
2.) I must have 'speaking' URIs for better SEO. I.e. URIs like
/cars/volkswagen/sedan instead of /products?manufacturer=23&prodid=42. In
German that URI would probably be /fahrzeuge/volkswagen/limousinen. Other
(All examples are fictious.)
Now, where does that leave me with the controller and dispatch actions?
One idea comes to mind which is to use n different controllers, one for each
language (Controller::Cars, Controller::Fahrzeuge, Controller::Voitures etc.).
In each controller the same list of actions is repeated (yuck!), each action
sub has it's counterpart in each other language.
Currently we have 234 entries in our product selection tree (i.e. navigation
tree) grouped into 12 major categories and several subcategories, up to 5
WTF? Maintain 5 (or more) navig trees plus write 5 (or more) more or less
idetical controllers (one for each language) with ~234 action subs each. No
way! That's a maintenance nightmare.
That cannot be a viable solution... Where am I wrong in my thinking?
What I am envisioning is a central file where I (somehow, XML?, database?)
maintain a navigation tree (ok, 5 or more), mapping menu entries to URIs. Some
process then maps these entries to actions. But how?
Other ideas coming to my mind:
- Create actions on the fly, mapped from the Menu/URI table. Is this possible
with Catalyst? AFAIK Catalyst checks all controllers at startup and builds a
list of actions only once - at startup... right?
- Have one controller per language and write a central dispatcher action,
which does nothing more than use the lookup table mapping menus to URIs? To me
this has not the right feel, giving up all the nice dispatcher possibilities
- Put the navig tree in a separate view per language. Maintain n different
files when the tree changes. Still leaves me with the dispatcher issue.
- Maintain the navig tree somehow (XML, SQL) and write a small script which
produces the Conntrollers and actions from the data (plus a navig view for
Maybe I am just blind to see a radically different solution to my problem...
More information about the Catalyst