Thanks for your response.

Now, If I have a text that will be translated ( {% trans "text_1" %}), Where
should I call the _("text_1") view to store the label and its translation?
According to the documentation, this view could be called inside the .py
file but I think that doing that I am breaking the template's encapsulation
because that means that the .py file must know the text that conforms the
template. isnt it?


On Mon, Mar 14, 2011 at 9:24 AM, Tom Evans <tevans...@googlemail.com> wrote:

> On Mon, Mar 14, 2011 at 1:27 PM, hassan <hsn.zam...@gmail.com> wrote:
> > take a look at
> http://docs.djangoproject.com/en/1.2/topics/i18n/internationalization/
> > it is clear,
> > but for short:
> >
> > 1 - in .py files:
> >    from django.utils.translation import ugettext as _
> >    and mark each text you want to traslate like this _("My string")
> >
> > 2 - in .html files:
> >    {% load i18n %}
> >    and mark with {% trans "My string" %}
> >
>
> Or:
>  {{ _("foo") }}
>
> You'll need to use this syntax to do things like filters:
>  {{ _("foo")|linebreaksbr }}
>
> Or:
>  {% blocktrans with foo as bar %}Some string with a {{ bar }}
> placeholder{% endblocktrans %}
>
> 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-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.

Reply via email to