views:

87

answers:

2

Hi,

I run a site where it is important to have good and simple URLs that need to be localized.

Example for the english version: example.com/car/?type=fiat

Example for the Swedish version: example.se/bil/?typ=fiat (bil is car in swedish)

And ofcourse I would like to handle all of these URLs from the same codebase. What is the best way to handle this?

Should I set up several controllers (CarController, BilController) or is there a "cleaner" way to handle localized controller names?

BR Niklas

+2  A: 

Don't do that. Ever.

Microsoft, a really big, powerful and resourceful company tried that with Excel. In English versions of Excel, you use IF() in formulas. In the German version, it's WENN(). In French, it's QUAND(), I think. In Japan, it's probably ば(). Now imagine someone from Japan sends me an Excel sheet ... There are two options:

  1. "I'm sorry, I can't open this file"
  2. Translate all names on the fly

Doing #2 seems simple enough ... until you run into a word which uses the same letters but has a different meaning in two languages. Example "see". Means "look" in English and "lake" in German. Since you don't know all the languages in the world, you have no chance to figure out which collisions you will have before it is too late.

Also, how do you know which name to use? From the language in the browser? Or do you hate your international customers who occasionally use the Swedish main site? How do you handle Asian languages? Will the URL be server/%E6%AC%80%E6/?%AD%81%E6%AB=fiat?

Don't. Do. That. Ever.

Aaron Digulla
A: 

What about rewriting the URL depending on the domain? This way, the Zend framework will get only the English names, while the URL can use localized names.

OregonGhost
Yes, I was thinking something along these lines. Is there any standardized way to do this or do I have to roll my own?
Niklas