[ckan-dev] i18n url rewriting

Toby Dacre toby.okfn at gmail.com
Tue Feb 14 11:39:30 UTC 2012


On 14 February 2012 11:24, David Read <david.read at okfn.org> wrote:

>
>
> On 14 February 2012 11:12, Toby Dacre <toby.okfn at gmail.com> wrote:
>
>>
>>
>> On 14 February 2012 10:55, David Read <david.read at okfn.org> wrote:
>>
>>>
>>>
>>> On 14 February 2012 10:23, Toby Dacre <toby.okfn at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> http://trac.ckan.org/ticket/1653
>>>> I've created branch feature-1653-i18n_url_rewriting
>>>>
>>>
<snip>


>>>> we use the language in the url if specified
>> if none is given eg / we negotiate with the browser  'Accept-Language'
>> then we use the default in config
>>
>
> Got it - cheers for explaining!
>
> Having tried automatic browser language detection with CKAN a couple of
> months ago, we moved away from it. The discussion on this list confirmed it
> was problematic for a large chunk of users (browsers v. often setup wrong)
> and I suspect other organisations running CKAN as well (they tend to want
> it in their language by default, whatever your browser says). If we do
> anything with this header, my suggestion is just to suggest it to the user:
> http://trac.ckan.org/ticket/1452
>
>
It's easy to sort this behaviour if we reach consensus we can even have it
based on config settings if we have multiple needs.
config.locale_use_browser_requested or some such but the less options the
better imho
we don't use cookies to store the language as it's not needed with this
implementation.



> BTW are you still proposing something to do with caching?
>
>
I'd be keen to look at it at some point david raznick was saying he wants
to look at external caching like varnish so it depends on the approach we
take.  I've done quite a bit of caching stuff before but usually much
closer to the code ie in the application.

Toby

Dave
>
>
>>
>>> BTW is the home page now at /home rather than / ? Why's that?
>>>
>>
>> no change and in fact /home doesn't work I just mis-read the routing just
>> / isn't much of a url to see when explaining the changes
>>
>>
>>>
>>>
>>>> 2) Language Selectors - these need to be rewritten 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.
>>>>
>>>
>>> You're talking about the links in the footer of the template which are
>>> used to change language? And are you wondering if there are any other ways
>>> in which a user might switch the language? The answer to that is no.
>>>
>>
>> yes those are the ones
>>
>>>
>>>
>>>>
>>>> 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
>>>>
>>>
>>> I think it would be useful to document this with the various forms of
>>> url and url_for. Perhaps here is the best place?:
>>> http://docs.ckan.org/en/latest/theming.html#retheming-the-site-with-templates
>>>
>>
>> I'll look at doing that.  I also want to clean the template_context as it
>> 'leaks' lots of stuff and I'd like to see it being more explicit.
>>
>>
>>>
>>>
>>>> 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?
>>>>
>>>
>>> Yes, you just need to run CKAN on Apache and add a sub-directory to this
>>> line in your Apache config. e.g.:
>>>
>>>         WSGIScriptAlias /sub/dir /home/dread/etc/ckan-pylons.py
>>>
>>> Now CKAN's mounted at: http://localhost/sub/dir
>>> For more info on this and running on Apache see
>>> http://wiki.ckan.org/Deployment
>>>
>>> thanks I'll look at setting this up and testing that part
>>
>> Toby
>>
>>>
>>> David
>>>
>>> I've also simplified the querying of available locales
>>>>
>>>> Let me know any feedback
>>>>
>>>> Toby
>>>>
>>>> _______________________________________________
>>>> ckan-dev mailing list
>>>> ckan-dev at lists.okfn.org
>>>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120214/9bd89bc5/attachment-0001.html>


More information about the ckan-dev mailing list