Can anyone think of a way around this "chicken and egg" scenario, or
another way to get the desired results? Basically I want on the fly
translations of content and controller names when a user changes
languages. Now I can have one or the other...

When translating controller names in response.menu's (I find it so
cool that this can be done!) with something like the following:

response.menu_language_settings = [
            [T('Language Settings'), False,
URL(request.application,T('language'),'index'), []],
]

If you change languages on the fly using a menu item like this:

response.menu_language = [
   ['Français', False, URL(r=request,vars=dict(_language='fr-ca')),
[]],
   ['English', False, URL(r=request,vars=dict(_language='en-ca')),
[]],
]

You will probably get a page not found error because (If you are
currently "in" the language controller) when you change languages the
first menu item is still pointing to the previous controller name
translation and therefore content (in the new language) will not be
available until after a page refresh (ie. menu.py get reread and then
your first menu item they points to the correct controller and content
(ie. the content in the current language;)

I am specifically looking for a way that preserves the "translated"
urls that this method allows for and the ability to flip back and
forth between languages.

Here is a test site using translated controller names and the
flatpages plugin. You will notice that we are currently 'forcing' a
reload by placing the language change menu item in the content area
rather that in the top right hand corner in order to work around the
problem.

http://voicesofaccess.org/

Anyone else who wants to try this should also be aware that controller
names may not contain accents other that these two items, it seem to
work very well and gives users access to translated URL's and content.

Any ideas are welcomed.

Thanks,

Chris

Reply via email to