Also, to have it super simple, you can do <default for="locale">en</ 
default>

Note that locale="${locale}" unconditionally uses that locale. If it  
doesn't exist, you'll get an exception. Either use a callback to  
determine if the locale exists, or change your regex to allow a list  
of alternatives, sth like (en|fr|ru|es)


David


Am 18.03.2008 um 01:36 schrieb Felix Gilcher:

> Hi Brian,
>
> you might want to have a look at the routing callback in the sample
> application - it will do exactly what you need, you might even copy
> that pretty much verbatim. It checks whether the matched snippet is a
> valid locale identifier for the application and sets a default when
> the route is generated. It even tries to read a cookie in case no
> locale is matched in the route.
>
> regards
>
> felix
>
> On Mar 18, 2008, at 1:30 AM, Brian W. Neu wrote:
>
>> Pre-Script:  Thanks to David and Mike for previous help offers
>>            ---------------------------------
>>
>> I just don't understand the routing enough at the moment to figure
>> this out.
>>
>> So en/English will be the default for this site, but if the locale is
>> missing from the URL, $ro->gen is still putting in a extra "/"
>> which is
>> breaking the links.
>>
>> Can I set "en" as a default somehow?
>>
>>
>> ROUTING.XML
>> <?xml version="1.0" encoding="UTF-8"?>
>> <configurations xmlns="http://agavi.org/agavi/1.0/config";>
>>        <configuration context="web">
>>                <routes>
>>                        <route
>> pattern="^/({locale:[a-z]{2}(_[A-Z]{2})?})" stop="false" imply="true"
>> cut="true" locale="${locale}">
>>                                <ignores>
>>                                        <ignore>locale</ignore>
>>                                </ignores>
>>                        </route>
>>                        <route name="company" pattern="^/Company"
>> module="%actions.default_module%" action="Company">
>>                            <route name=".executives"
>> pattern="^/Executives" action=".Executives" />
>>                            <route name=".contact" pattern="^/Contact"
>> action=".Contact" />
>> <!-- truncated -->
>>
>>
>> LINK GENERATION
>> <a href="<?php echo $ro->gen('company'); ?>"><?php echo
>> $tm->_('COMPANY','default.layout'); ?>
>>
>>
>>
>>
>>
>> _______________________________________________
>> users mailing list
>> [email protected]
>> http://lists.agavi.org/mailman/listinfo/users
>
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users
>


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to