[ckan-dev] i18n url rewriting

Toby Dacre toby.okfn at gmail.com
Tue Feb 14 10:23:31 UTC 2012


Hi,

http://trac.ckan.org/ticket/1653
I've created branch feature-1653-i18n_url_rewriting

This changes the locale to be specified in the url as /<language-code>/url
- if the default language is used the url does not get rewritten.

This change has the following implications:

1) Cache issues - We do redirects to browser requested languages when no
locale is present so a call to /home may return the default locale version
of that page or a redirect eg /fr/home. I spoke to David Raznick and he
said that disabling the caching for now is the best approach for now.

2) Language Selectors - these need to be rewriten as they can now create
direct urls via h.url(url_required, locale=local_required).  I have
corrected this in ckan layout_base.html and for ckanext-ecportal but am not
sure if/where this is also used - I'll fixup if directed where it is used.

3) Template Context - in lib.base.render() the template context passes the
default pylons.url() which we now override to handle the locale specific
urls.  To prevent this being used I have removed it so if it is used
templates will break ${url(...)} should be replaced with ${h.url(...)}.
again I've fixed up in core and ec-portal

4) Site in subdirectory - This should work but I don't have this setup so
testing has not been done - does anyone have this setup?

I've also simplified the querying of available locales

Let me know any feedback

Toby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120214/0dbf8f9e/attachment.html>


More information about the ckan-dev mailing list