Re: Translation problem !

2016-12-09 Thread Tim Graham
Sure, if translations are contributed by the community. Turkish is 
currently at 2%. The language is typically added to docs.djangoproject.com 
when the translations for the intro materials are completed.

https://www.transifex.com/django/django-docs/

On Friday, December 9, 2016 at 7:05:38 AM UTC-5, Özkan Nöron wrote:
>
> *Will there be a Turkish translation for Django? It becomes difficult to 
> learn a new language and programming language. Thanks.*
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ac6c8b7b-e6c4-4bfc-9715-c075d7edb12c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Translation problem !

2016-12-09 Thread Özkan Nöron
*Will there be a Turkish translation for Django? It becomes difficult to 
learn a new language and programming language. Thanks.*

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6af43660-dafe-4fe5-8013-7ded9f86cefa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Translation problem with percent sign

2011-11-05 Thread Martin Tiršel
On Fri, 04 Nov 2011 15:54:04 +0100, Martin J. Laubach  
 wrote:


  Just remove the line with "python-format" from your translation since  
it

isn't a format string after all.

mjl



Thanks, this is working. But after makemessages It comes again so I have  
to fix this line every time.


Martin

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Translation problem with percent sign

2011-11-04 Thread Martin J. Laubach
  Just remove the line with "python-format" from your translation since it 
isn't a format string after all.

mjl

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/T_0dGHybS8YJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Translation problem with percent sign

2011-11-04 Thread Martin Tiršel

Hello,

I am using Django 1.2.5.


* template:

{% trans 'If you cancel queued construction, you will get 75% of resources  
back' %}



* django-admin.py makemessages -l sk produces:

#: templates/core/buildings/construction.html:65
#, python-format
msgid "If you cancel queued construction, you will get 75% of resources  
back"

msgstr ""

I open the .po file in poedit program and add translation "Zrušením budovy  
v stavebnom rade sa ti vráti 75% surovín" what produces:


1375 #: templates/core/buildings/construction.html:65
1376 #, python-format
1377 msgid "If you cancel queued construction, you will get 75% of  
resources back"

1378 msgstr "Zrušením budovy v stavebnom rade sa ti vráti 75% surovín"

And poedit (or django compilemessages) shows me an error  
"...po:1378:format specification in 'msgid' nad 'msgstr' for argument a  
are not the same". When I add 75%% in my translated string doesn't work  
either, I need to manually edit the msgid string and change % for %%, so  
it looks so:


1375 #: templates/core/buildings/construction.html:65
1376 #, python-format
1377 msgid "If you cancel queued construction, you will get 75%% of  
resources back"

1378 msgstr "Zrušením budovy v stavebnom rade sa ti vráti 75%% surovín"

This will compile. But no translation occurs because it seems that {%  
trans %} can not handle percent sign. Is it so or I am doing something  
wrong?



I could split the string into two translation string like this:

{% trans 'If you cancel queued construction, you will get' %} 75% {% trans  
'of resources back' %}


but this seems a little bit ugly. Or I could use HTML entity % or  
perhaps use {% blocktrans %} and instead of % use some variable like {{  
PERCENT_SIGN }}. But all of this is a little bit complicated so I first  
need to know if I am not doing something bad or perhaps there is a bug in  
Django.


Thanks,
Martin

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



JavaScript translation problem

2011-09-04 Thread galgal


Hi I have a problem with JS translation in Django. I did everything like is 
said in documentation, so: I made .po then .mo files (django.mo, 
djangojs.mo). Translated files are in path: *myapp/locale/pl/LC_MESSAGES/* 
and *myapp/locale/en/LC_MESSAGES/* *Translations in .html and .py files work 
OK.* The only problem is that JS translation always displays original 
phrase, not translated. main urls.py:

urlpatterns += patterns('', (r'^jsi18n/$', 
'django.views.i18n.javascript_catalog',{}), )

template file in header (as first JS part):



All my js files are in path /myapp/site_media/js/ and the only .mo files are 
in path which I wrote before. I use gettext() in JS strings.

What did I do wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/mAC48MURo50J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unicode translation problem

2011-04-22 Thread Kenny Meyer
On Fri, Apr 22, 2011 at 4:22 PM, John Maines  wrote:
> Hello,
>
> I am going through the Django Tutorials on the Django home page. All
> has gone fine, except one thing:
>
> When building the admin page, I can't get the unicode translator to
> work. It is supposed to change "Poll: Poll object" to readable text.
> It just doesn't work. I am using PostgreSQL set for UTF8 encoding.
> Running on Windows.
>
> Any ideas? Thank you.

The problem you are trying to solve is not clear to me. Reformulate
your question, please.

> Here are the instructions that fail:
>
> "Wait a minute.  is, utterly, an unhelpful
> representation of this object. Let's fix that by editing the polls
> model (in the polls/models.py file) and adding a __unicode__() method
> to both Poll and Choice:"

Check out what the __unicode__() method is all about:
http://docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#unicode

For general information of Unicode support in Django you may find here:
http://docs.djangoproject.com/en/dev/ref/unicode/

>
> class Poll(models.Model):
>    # ...
>    def __unicode__(self):
>        return self.question
>
> class Choice(models.Model):
>    # ...
>    def __unicode__(self):
>        return self.choice
>
> --
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Unicode translation problem

2011-04-22 Thread Shawn Milochik
What does "it just doesn't work" mean? What errors are you getting?
What is it doing or not doing?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Unicode translation problem

2011-04-22 Thread John Maines
Hello,

I am going through the Django Tutorials on the Django home page. All
has gone fine, except one thing:

When building the admin page, I can't get the unicode translator to
work. It is supposed to change "Poll: Poll object" to readable text.
It just doesn't work. I am using PostgreSQL set for UTF8 encoding.
Running on Windows.

Any ideas? Thank you.

Here are the instructions that fail:

"Wait a minute.  is, utterly, an unhelpful
representation of this object. Let's fix that by editing the polls
model (in the polls/models.py file) and adding a __unicode__() method
to both Poll and Choice:"

class Poll(models.Model):
# ...
def __unicode__(self):
return self.question

class Choice(models.Model):
# ...
def __unicode__(self):
return self.choice

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



templates translation problem

2010-07-13 Thread turbidus
I have site with text written in Russian.
Now I want to translate it to English.
I've upgraded templates with  trans tag like that {% trans "Всем
привет" %}.
Then I run makemessages, translated what I want, compilemessages.

And now, the translation for the string "Всем привет" is never shown.
Templates encoding is UTF-8.
I've tried and loaded translation directly from python shell - it is
loaded and present in translation object.

What am I doing wrong?

Cheers,
Nick

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



Re: Translation problem

2010-07-01 Thread Daniel
Of course my_mail() is more complicated than my example. But I am not
touching "subject" elsewhere as in the posted lines (I am only passing
it to EmailMessage). Thus, I did not consider the rest of my_mail() to
be important.

Is there a way to check at a certain point if the the proxy object has
already been translated without interfering in the translation
process?

Thanks,
Daniel

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



Re: Translation problem

2010-07-01 Thread Tom Evans
On Thu, Jul 1, 2010 at 2:33 PM, Daniel Baron  wrote:
> Hi all,
>
> I have a problem getting the correct translation using gettext in the
> following situation:
>
> I have a view which calls a custom function to send an email. This functions
> takes three arguments
> - subject of the email (string)
> - the language of the email
> - the template to render the content of the email:
>
> e.g: my_mail(ugettext_lazy('This is the subject'), 'es', 'invitation')
>
> Now, my_mail looks basically like this:
>
> def my_mail(subject, lang, tpl):
>  translation.activate(lang)
>  content = render_to_string()
>  email = EmailMessage(subject, content, from_addr, to_addr)
>  email.send()
>
> Now my problem is, that the content of the email is always sent in the
> desired language given by the "lang" variable. While the subject of the
> email is always sent in the language of the user calling the view.
>
> What am I doing wrong? And how can I tell my function to translate the
> subject correctly? I thought that is exactly what ugettext_lazy is for, but
> obviously I misunderstood the concept.
>
> Thanks,
> Daniel
>

I'm guessing my_mail doesn't look exactly like that. ugettext_lazy is
translated to a unicode string when certain operations happen on it,
one of those must be happening. I have a mail function that looks very
similar to that, and it works correctly.

Cheers

Tom

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



Translation problem

2010-07-01 Thread Daniel Baron

Hi all,

I have a problem getting the correct translation using gettext in the 
following situation:


I have a view which calls a custom function to send an email. This 
functions takes three arguments

- subject of the email (string)
- the language of the email
- the template to render the content of the email:

e.g: my_mail(ugettext_lazy('This is the subject'), 'es', 'invitation')

Now, my_mail looks basically like this:

def my_mail(subject, lang, tpl):
  translation.activate(lang)
  content = render_to_string()
  email = EmailMessage(subject, content, from_addr, to_addr)
  email.send()

Now my problem is, that the content of the email is always sent in the 
desired language given by the "lang" variable. While the subject of the 
email is always sent in the language of the user calling the view.


What am I doing wrong? And how can I tell my function to translate the 
subject correctly? I thought that is exactly what ugettext_lazy is for, 
but obviously I misunderstood the concept.


Thanks,
Daniel

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



Re: Translation problem

2008-05-01 Thread Mauro


On May 1, 4:36 pm, Mauro <[EMAIL PROTECTED]> wrote:
> Thank you Gaetan,
>
> I tried to add a BOM to the .po file but I got an error when compiling
> the messages. (kind of expected)
> Then I tried to add it at the beginning of my template file but keep
> getting the sameDjangoUnicodeDecodeError.
>
> When you mention "save your source file with a BOM" which file do you
> refer to?
> I am using Linux BTW.

One interesting thing I forgot to mention.
If I use ugettext instead of ugettext_lazy, it works fine.
Translations shows perfectly, but I can not dynamically switch the
language because the form gets translated only once when running
django. so I *need* ugettext_lazy.
It sounds like a bug .. but I am not sure..

//mauro//

--~--~-~--~~~---~--~~
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: Translation problem

2008-05-01 Thread Mauro

Thank you Gaetan,

I tried to add a BOM to the .po file but I got an error when compiling
the messages. (kind of expected)
Then I tried to add it at the beginning of my template file but keep
getting the same DjangoUnicodeDecodeError .

When you mention "save your source file with a BOM" which file do you
refer to?
I am using Linux BTW.

Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  82. response = callback(request, *callback_args,
**callback_kwargs)
File "/home/mauro/qpe_site/main/engines/main_engine.py" in board_post
  329. context_data={'form':form.as_table()}
File "/usr/lib/python2.5/site-packages/django/newforms/forms.py" in
as_table
  169. return self._html_output(u'%(label)s%
(errors)s%(field)s%(help_text)s', u'%s', '', u'%s', False)
File "/usr/lib/python2.5/site-packages/django/newforms/forms.py" in
_html_output
  138. label = escape(force_unicode(bf.label))
File "/usr/lib/python2.5/site-packages/django/utils/encoding.py" in
force_unicode
  60. raise DjangoUnicodeDecodeError(s, *e.args)

Exception Type: DjangoUnicodeDecodeError at /board/post
Exception Value: 'ascii' codec can't decode byte 0xe8 in position 0:
ordinal not in range(128). You passed in
 ()

Any other tip ? I've been stack for days here :(

Thank you,

//mauro//

On Apr 30, 10:33 pm, gcorneau <[EMAIL PROTECTED]> wrote:
> Yes: make sure you save your source file with a BOM. At least, that
> worked for me (I develop under Windows).
>
> I hope this helps,
> Gaetan
>
> On 30 avr, 10:06, Mauro <[EMAIL PROTECTED]> wrote:
>
> > On Apr 11, 6:43 am, gcorneau <[EMAIL PROTECTED]> wrote:
>
> > > # -*- coding: utf-8 -*-
> > > from django import newforms as forms
> > > from django.conf import settings
> > > from django.utils.translation importugettext_lazyas _
> > > from apparto.building import models
>
> > > class BuildingForm(forms.Form):
> > > #~ contact = forms.ChoiceField()
>
> > > civic_number = forms.IntegerField(label=_('Numéro'))
> > > # Other fields omitted...
>
> > > When I navigate to this form, I get the following:
>
> > >DjangoUnicodeDecodeErrorat /apparto/account/addbuilding/
> > > 'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in
> > > range(128). You passed in  > > 0x0180D170> ()
> > > Request Method: GET
> > > Request URL:http://127.0.0.1/apparto/account/addbuilding/
> > > Exception Type:DjangoUnicodeDecodeError
> > > Exception Value:'ascii' codec can't decode byte 0xe9 in position 
> > > 3:
> > > ordinal not in range(128). You passed in
> > >  ( > > 'django.utils.functional.__proxy__'>)
> > > Exception Location: C:\Python25\Lib\site-packages\django\django\utils
> > > \encoding.py in force_unicode, line 60
> > > Python Executable:  C:\Python25\python.exe
> > > Python Version: 2.5.1
>
> > > Unicode error hint
>
> > > The string that could not be encoded/decoded was: Num?ro
>
> > > I made sure all my templates had {% load i18n %}
>
> > > I tried to reverse the French and English strings in the .po file and
> > > recompiled: no error when I switch languages.
>
> > > Did I simply forget something obvious?
>
> > I am having the exact same problem but with Japanese text, any
> > resolution? help?, tip?
>
> > //mauro//
--~--~-~--~~~---~--~~
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: Translation problem

2008-04-30 Thread gcorneau

Yes: make sure you save your source file with a BOM. At least, that
worked for me (I develop under Windows).

I hope this helps,
Gaetan

On 30 avr, 10:06, Mauro <[EMAIL PROTECTED]> wrote:
> On Apr 11, 6:43 am, gcorneau <[EMAIL PROTECTED]> wrote:
>
> > # -*- coding: utf-8 -*-
> > from django import newforms as forms
> > from django.conf import settings
> > from django.utils.translation import ugettext_lazy as _
> > from apparto.building import models
>
> > class BuildingForm(forms.Form):
> >     #~ contact = forms.ChoiceField()
>
> >     civic_number = forms.IntegerField(label=_('Numéro'))
> >     # Other fields omitted...
>
> > When I navigate to this form, I get the following:
>
> > DjangoUnicodeDecodeError at /apparto/account/addbuilding/
> > 'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in
> > range(128). You passed in  > 0x0180D170> ()
> > Request Method:         GET
> > Request URL:    http://127.0.0.1/apparto/account/addbuilding/
> > Exception Type:         DjangoUnicodeDecodeError
> > Exception Value:        'ascii' codec can't decode byte 0xe9 in position 3:
> > ordinal not in range(128). You passed in
> >  ( > 'django.utils.functional.__proxy__'>)
> > Exception Location:     C:\Python25\Lib\site-packages\django\django\utils
> > \encoding.py in force_unicode, line 60
> > Python Executable:      C:\Python25\python.exe
> > Python Version:         2.5.1
>
> > Unicode error hint
>
> > The string that could not be encoded/decoded was: Num?ro
>
> > I made sure all my templates had {% load i18n %}
>
> > I tried to reverse the French and English strings in the .po file and
> > recompiled: no error when I switch languages.
>
> > Did I simply forget something obvious?
>
> I am having the exact same problem but with Japanese text, any
> resolution? help?, tip?
>
> //mauro//
--~--~-~--~~~---~--~~
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: Translation problem

2008-04-30 Thread Mauro

On Apr 11, 6:43 am, gcorneau <[EMAIL PROTECTED]> wrote:

> # -*- coding: utf-8 -*-
> from django import newforms as forms
> from django.conf import settings
> from django.utils.translation import ugettext_lazy as _
> from apparto.building import models
>
> class BuildingForm(forms.Form):
> #~ contact = forms.ChoiceField()
>
> civic_number = forms.IntegerField(label=_('Numéro'))
> # Other fields omitted...
>
> When I navigate to this form, I get the following:
>
> DjangoUnicodeDecodeError at /apparto/account/addbuilding/
> 'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in
> range(128). You passed in  0x0180D170> ()
> Request Method: GET
> Request URL:http://127.0.0.1/apparto/account/addbuilding/
> Exception Type: DjangoUnicodeDecodeError
> Exception Value:'ascii' codec can't decode byte 0xe9 in position 3:
> ordinal not in range(128). You passed in
>  ( 'django.utils.functional.__proxy__'>)
> Exception Location: C:\Python25\Lib\site-packages\django\django\utils
> \encoding.py in force_unicode, line 60
> Python Executable:  C:\Python25\python.exe
> Python Version: 2.5.1
>
> Unicode error hint
>
> The string that could not be encoded/decoded was: Num?ro
>
> I made sure all my templates had {% load i18n %}
>
> I tried to reverse the French and English strings in the .po file and
> recompiled: no error when I switch languages.
>
> Did I simply forget something obvious?

I am having the exact same problem but with Japanese text, any
resolution? help?, tip?

//mauro//




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Translation problem

2008-04-10 Thread gcorneau

Hi,

I'm translating an application from French to English and everything
was going smoothly until I began work on a particular form. The code
looks like this:

# -*- coding: utf-8 -*-
from django import newforms as forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from apparto.building import models

class BuildingForm(forms.Form):
#~ contact = forms.ChoiceField()

civic_number = forms.IntegerField(label=_('Numéro'))
# Other fields omitted...

When I navigate to this form, I get the following:

DjangoUnicodeDecodeError at /apparto/account/addbuilding/
'ascii' codec can't decode byte 0xe9 in position 3: ordinal not in
range(128). You passed in  ()
Request Method: GET
Request URL:http://127.0.0.1/apparto/account/addbuilding/
Exception Type: DjangoUnicodeDecodeError
Exception Value:'ascii' codec can't decode byte 0xe9 in position 3:
ordinal not in range(128). You passed in
 ()
Exception Location: C:\Python25\Lib\site-packages\django\django\utils
\encoding.py in force_unicode, line 60
Python Executable:  C:\Python25\python.exe
Python Version: 2.5.1


Unicode error hint

The string that could not be encoded/decoded was: Num?ro

I made sure all my templates had {% load i18n %}

I tried to reverse the French and English strings in the .po file and
recompiled: no error when I switch languages.

Did I simply forget something obvious?

I'm a Django noob, any help would be appreciated,
-G-
--~--~-~--~~~---~--~~
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: Translation problem in newforms

2007-04-12 Thread ann


if you have no hosting,I suggest you apply for a free forum.
http://www.forumgogo.comMore powerful than the phpbb
Trait:
100% free and no pop-ups. Unlimited Bandwidth, Unlimited Storage,
Unlimited users, unlimited threads, unlimited topics.Fast, Friendly
Tech Support.You have total control over your ...
http://support.forumgogo.com

On 4月12日, 下午11时16分, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I have the following form:
>
> from django import newforms as forms
>
> class ContactForm(forms.Form):
> to  = forms.ChoiceField(label=_('To'), choices=CONTACTS)
> sender  = forms.EmailField(label=_('Email'))
> subject = forms.CharField(label=_('Subject'), max_length=50)
> message = forms.CharField(label=_('Message'),
> widget=forms.Textarea)
>
> I made the french translation for the labels, but when I display the
> form in a template, they always use the language as defined with
> LANGUAGE_CODE in settings.py.  Changing from 'en' to 'fr' and back
> again changed the label titles, but using the setlang view, they
> weren't translated.
>
> Should that be considered a bug?
>
> I'm using 0.96


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
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: Translation problem in newforms

2007-04-12 Thread [EMAIL PROTECTED]

So basically, it's like the difference between range() and xrange().
Thanks Niels, that helped a lot.

On Apr 12, 3:42 pm, "Niels" <[EMAIL PROTECTED]> wrote:
> Your understanding is basically correct. Gettext_lazy returns an
> object that will be stored inside the form class definition. The
> actual translation then occurs when that object is evaluated as a
> string. And there is quite some magic going on behind the scenes:
>
> >>> from django.utils.translation import gettext_lazy as _
> >>> lazystr = _("Home")
> >>> lazystr.__class__
>
> >>> lazystr.__promise__
>
> >>> lazystr._proxyfunc
>
> >>> lazystr._proxyfunc.__module__
>
> 'django.utils.translation'
>
> >>> lazystr._proxyargs
> ('Home',)
> >>> from django.utils.translation import activate
> >>> activate('fr')
> >>> str(lazystr)
> 'Accueil'
> >>> activate('en')
> >>> str(lazystr)
> 'Home'
>
> On Apr 12, 7:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > That worked, thanks very much.  I'm not quite clear on the difference
> > between gettext and gettext_lazy however.  As I understand it, gettext
> > will translate the string when the Python file is loaded (imported)
> > and gettext_lazy will translate the string when the template is
> > rendered.  Is that it?
>
> > Vincent.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
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: Translation problem in newforms

2007-04-12 Thread Niels

Your understanding is basically correct. Gettext_lazy returns an
object that will be stored inside the form class definition. The
actual translation then occurs when that object is evaluated as a
string. And there is quite some magic going on behind the scenes:

>>> from django.utils.translation import gettext_lazy as _
>>> lazystr = _("Home")
>>> lazystr.__class__

>>> lazystr.__promise__

>>> lazystr._proxyfunc

>>> lazystr._proxyfunc.__module__
'django.utils.translation'
>>> lazystr._proxyargs
('Home',)
>>> from django.utils.translation import activate
>>> activate('fr')
>>> str(lazystr)
'Accueil'
>>> activate('en')
>>> str(lazystr)
'Home'
>>>

On Apr 12, 7:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> That worked, thanks very much.  I'm not quite clear on the difference
> between gettext and gettext_lazy however.  As I understand it, gettext
> will translate the string when the Python file is loaded (imported)
> and gettext_lazy will translate the string when the template is
> rendered.  Is that it?
>
> Vincent.
>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
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: Translation problem in newforms

2007-04-12 Thread [EMAIL PROTECTED]

That worked, thanks very much.  I'm not quite clear on the difference
between gettext and gettext_lazy however.  As I understand it, gettext
will translate the string when the Python file is loaded (imported)
and gettext_lazy will translate the string when the template is
rendered.  Is that it?

Vincent.

On Apr 12, 12:44 pm, "Niels" <[EMAIL PROTECTED]> wrote:
> Hi. I think you need the to add following import statement after
> importing newforms as well:
>
> from django.utils.translation import gettext_lazy as _
>
> On Apr 12, 5:16 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > I have the following form:
>
> > from django import newforms as forms
>
> > class ContactForm(forms.Form):
> > to  = forms.ChoiceField(label=_('To'), choices=CONTACTS)
> > sender  = forms.EmailField(label=_('Email'))
> > subject = forms.CharField(label=_('Subject'), max_length=50)
> > message = forms.CharField(label=_('Message'),
> > widget=forms.Textarea)
>
> > I made the french translation for the labels, but when I display the
> > form in a template, they always use the language as defined with
> > LANGUAGE_CODE in settings.py.  Changing from 'en' to 'fr' and back
> > again changed the label titles, but using the setlang view, they
> > weren't translated.
>
> > Should that be considered a bug?
>
> > I'm using 0.96


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
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: Translation problem in newforms

2007-04-12 Thread Niels

Hi. I think you need the to add following import statement after
importing newforms as well:

from django.utils.translation import gettext_lazy as _


On Apr 12, 5:16 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I have the following form:
>
> from django import newforms as forms
>
> class ContactForm(forms.Form):
> to  = forms.ChoiceField(label=_('To'), choices=CONTACTS)
> sender  = forms.EmailField(label=_('Email'))
> subject = forms.CharField(label=_('Subject'), max_length=50)
> message = forms.CharField(label=_('Message'),
> widget=forms.Textarea)
>
> I made the french translation for the labels, but when I display the
> form in a template, they always use the language as defined with
> LANGUAGE_CODE in settings.py.  Changing from 'en' to 'fr' and back
> again changed the label titles, but using the setlang view, they
> weren't translated.
>
> Should that be considered a bug?
>
> I'm using 0.96


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
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
-~--~~~~--~~--~--~---



Translation problem in newforms

2007-04-12 Thread [EMAIL PROTECTED]

I have the following form:

from django import newforms as forms

class ContactForm(forms.Form):
to  = forms.ChoiceField(label=_('To'), choices=CONTACTS)
sender  = forms.EmailField(label=_('Email'))
subject = forms.CharField(label=_('Subject'), max_length=50)
message = forms.CharField(label=_('Message'),
widget=forms.Textarea)

I made the french translation for the labels, but when I display the
form in a template, they always use the language as defined with
LANGUAGE_CODE in settings.py.  Changing from 'en' to 'fr' and back
again changed the label titles, but using the setlang view, they
weren't translated.

Should that be considered a bug?

I'm using 0.96


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [EMAIL PROTECTED]
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
-~--~~~~--~~--~--~---