Hey,

Try this on for size:

Router::connect('/:language/:controller/:action/*'); (cake 1.2.x.x)
$router->connect('/:language/:controller/:action/*'); (cake 1.1.x.x)

In your controllers and views the language will be available in $this-
>params['language'].

The problem gets a bit tricky when you want to translate your
controller and action names.

On the other hand, if you don't need the language part in your URL's
you can try using the new i18n an l10n features in 1.2 (using the
locale).

Tell us a bit more about your requirements so that others can share
their solutions.

On May 6, 2:21 am, "pierre.k" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am looking for a solution to the following problem: basically, I
> want urls in form "/controller/action/params" as well as "/en/
> controller/action/params". The idea behind this is to allow for
> multiple languages ("/en/..." might as well be replaced with "/cs/..."
> and alike) and in ideal case, I would like the language identifier to
> be available as a global variable. This would allow me to use the
> variable in model (and also controller & view) classes, in the
> following fashion, for example:
>
> class Hotel extends AppModel {
>   var $hasOne = array("HotelTxt" => array("conditions" =>
> "lang={lang}"));
>
> }
>
> In other words, whenever an url like "/cs/*" or "/en/*" is
> encountered, I need to store the "cs"/"en" part into a global var and
> effectively go to url "*" instead. Can this be achieved via cakephp
> routing? Or should I approach to the problem in a completely different
> manner?
>
> Thanks for your ideas,
> Petr K.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to