Re: Unexpected date translation

2007-10-03 Thread Dirk Eschler

On Mittwoch, 3. Oktober 2007, Malcolm Tredinnick wrote:
> On Wed, 2007-10-03 at 15:37 +0200, Dirk Eschler wrote:
> > Hi,
> >
> > i'm using a date based generic on a multi-language website. When the
> > online language is set to German, {{ date|date:"M"|lower }} returns a
> > localized value - "mär" instead of "mar" that is. This breaks the link i
> > intend to build. Can the localisation be turned of somehow in this case?
>
> Not directly, no. The date filter is locale-aware and designed for
> created human readable strings.
>
> You would need to write your own filter that does the same thing but
> after first calling django.utils.translation.deactivate() (or maybe call
> activate('en') so that the result isn't dependent on your settings
> file). Remember to retrieve the current locale with get_language() first
> and set it back afterwards or you may get some weird side-effects.

Thanks for your help Malcolm. I will give it a try.

Best Regards,
Dirk Eschler

-- 
Dirk Eschler 
http://www.krusader.org

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Unexpected date translation

2007-10-03 Thread Malcolm Tredinnick

On Wed, 2007-10-03 at 15:37 +0200, Dirk Eschler wrote:
> Hi,
> 
> i'm using a date based generic on a multi-language website. When the online 
> language is set to German, {{ date|date:"M"|lower }} returns a localized 
> value - "mär" instead of "mar" that is. This breaks the link i intend to 
> build. Can the localisation be turned of somehow in this case? 

Not directly, no. The date filter is locale-aware and designed for
created human readable strings.

You would need to write your own filter that does the same thing but
after first calling django.utils.translation.deactivate() (or maybe call
activate('en') so that the result isn't dependent on your settings
file). Remember to retrieve the current locale with get_language() first
and set it back afterwards or you may get some weird side-effects.

Regards,
Malcolm



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Unexpected date translation

2007-10-03 Thread Dirk Eschler

Hi,

i'm using a date based generic on a multi-language website. When the online 
language is set to German, {{ date|date:"M"|lower }} returns a localized 
value - "mär" instead of "mar" that is. This breaks the link i intend to 
build. Can the localisation be turned of somehow in this case? 

Best Regards,
Dirk Eschler

-- 
Dirk Eschler 
http://www.krusader.org

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---