This is a situation when the user is on a create_ad page then they want to
change the language by clicking the language button, which then redirects
them back to the exact same page that they are on.
Anyway I should also point out I got this working using the following:
{{if request.get_vars.get('_signature'):}}
{{=A('English', _href="/en/%s/%s/%s?_signature=%s" %
(request.controller, request.function, ("" if not request.args else
"/".join(request.args)), request.get_vars.get('_signature')),
_class="separator lan")}}
{{=A('中文', _href="/zh/%s/%s/%s?_signature=%s" %
(request.controller, request.function, ("" if not request.args else
"/".join(request.args)), request.get_vars.get('_signature')))}}
{{else:}}
{{=A('English', _href="/en/%s/%s/%s" % ((request.controller,
request.function, ("" if not request.args else "/".join(request.args)))),
_class="separator lan")}}
{{=A(T('中文'), _href="/zh/%s/%s/%s" % ((request.controller,
request.function, ("" if not request.args else "/".join(request.args)))))}}
{{pass}}
Very ugly code but it does it job. I also have a security password which
doesn't care about changing the language in the front of the URL which is a
lot more clean.
URL('members','securityunlock', vars=dict(_next=URL(request.controller,
request.function, args=request.args, vars=request.vars,
user_signature=True))))
If there was a way to take the last line of code and also allow for
pre-pend something to the beginning of the URL my code above would be a lot
cleaner.
On Mon, Mar 12, 2012 at 4:38 PM, pbreit <[email protected]> wrote:
> I still don't totally understand. Are users changing the language and
> submitting a form at the same time? Is this some sort of Ajax call or
> LOAD() thing?
>
> Putting the language in the URL is tricky since you may need to configure
> routes that write and re-rewrite the URL. Have you considered storing the
> language in a cookie?
>
--
--
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com