List Info

Thread: gettext is not defined - admin site




gettext is not defined - admin site
country flaguser name
United States
2007-11-05 14:00:57
I use Django 0.96 in a SuSE with Python 2.3.3.

I'm getting this JavaScript error: "gettext is not
defined" when I try
to edit an object with date field in the admin site. I have
seen that
occurs when calendar.js is trying to populate the month
names in the
correct language. I use language_code = es_ES and
default_charset =
utf-8 and i have configurated apache to use utf-8 as default
charset.
I also have found with FireBug that really the error is a
Django
error:

UnicodeEncodeError at /convenios/admin/jsi18n/
'ascii' codec can't encode character
u'xe9' in
position 23:

For this reason jsi18n doesn't load and i can't use
gettext.

Otherwise, in an Ubuntu installation of Django, with same
lang code,
and Python 2.5.1, all works fine.

Any idea?

Thanks a lot!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: gettext is not defined - admin site
country flaguser name
United States
2007-11-06 11:36:05
Some advances in my investigation about this error.

The problem seems to be in the characters codification. I
don't know
if django or maybe apache are codifying badly the special
characteres
in spanish needed for translations. The same error happened
when I try
to translate title and branding in templates of the Admin
Site. I had
to delete every "trans" from templates y put the
text directly,
without possibility of translation. I remenbered that
recently and I
decided to do the same in calendar.js and
DateTimeShorctus.js, getting
disappear all gettext calls and using directly spanish text
for
months, days and Today link.

It's a solution for the application I'm doing, 'cause it
doesn't have
to be translated, but I think it's not a good solution, and
I'm still
wondering waht is the origin of the problema. Exactly the
same app
works fine in the same django version but over Ubuntu 7.04
with python
2.5 instead of SuSE 9.X with python 2.3, where I found the
problem.

Any idea about this issue?

(Sorry if my english is not so good)


On 5 nov, 21:00, ygneo <antonio.bar...gmail.com> wrote:
> I use Django 0.96 in a SuSE with Python 2.3.3.
>
> I'm getting this JavaScript error: "gettext is not
defined" when I try
> to edit an object with date field in the admin site. I
have seen that
> occurs when calendar.js is trying to populate the month
names in the
> correct language. I use language_code = es_ES and
default_charset =
> utf-8 and i have configurated apache to use utf-8 as
default charset.
> I also have found with FireBug that really the error is
a Django
> error:
>
> UnicodeEncodeError at /convenios/admin/jsi18n/
> &#39;ascii&#39; codec can&#39;t encode
character u&#39;xe9&#39; in
> position 23:
>
> For this reason jsi18n doesn't load and i can't use
gettext.
>
> Otherwise, in an Ubuntu installation of Django, with
same lang code,
> and Python 2.5.1, all works fine.
>
> Any idea?
>
> Thanks a lot!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: gettext is not defined - admin site
country flaguser name
Australia
2007-11-06 20:22:52
On Mon, 2007-11-05 at 12:00 -0800, ygneo wrote:
> I use Django 0.96 in a SuSE with Python 2.3.3.
> 
> I'm getting this JavaScript error: "gettext is not
defined" when I try
> to edit an object with date field in the admin site. I
have seen that
> occurs when calendar.js is trying to populate the month
names in the
> correct language. I use language_code = es_ES and
default_charset =
> utf-8 and i have configurated apache to use utf-8 as
default charset.
> I also have found with FireBug that really the error is
a Django
> error:
> 
> UnicodeEncodeError at /convenios/admin/jsi18n/
> &#39;ascii&#39; codec can&#39;t encode
character u&#39;xe9&#39; in
> position 23:
> 
> For this reason jsi18n doesn't load and i can't use
gettext.
> 
> Otherwise, in an Ubuntu installation of Django, with
same lang code,
> and Python 2.5.1, all works fine.

Using non-ASCII characters with Django 0.96 is unfortunately
not
completely solid. Sometimes things work, sometimes they
don't. It's why
we had to put all the work into making things use unicode
internally.
Translations are an area that are particularly vulnerable to
problems,
since ASCII strings end up being changed to non-ASCII.

There's a not a lot we can do about this except recommend
that you
upgrade to use subversion trunk (which will require a bit of
porting of
your code). I realise that might not be the easiest
solution, but, as I
said, it wasn't possible to fix all the problems without a
major change,
so at some point we had to make that change.

Regards,
Malcolm

-- 
The sooner you fall behind, the more time you'll have to
catch up. 
http://www.pointy-s
tick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )