Thanks for your comprehensive reply. Now everything is clear to me.
On Mon, Mar 14, 2011 at 11:30 AM, Tom Evans <tevans...@googlemail.com>wrote: > On Mon, Mar 14, 2011 at 4:05 PM, Juan Gabriel Aldana Jaramillo > <aldanajarami...@gmail.com> wrote: > > 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? > > > > Please just reply to the group when replying to a mailing list - I'm > subscribed, I don't need to be cc'ed. > > There is no 'label' and 'translation'. The 'label' is the original > string, and typically is the english version of the translation. > > Here is a complete run-down of how it works: > > You put '{% trans "foo" %}' in your template. > You run "python manage.py makemessages -a" > This generates <app>/locale/<lang>/LC_MESSAGES/django.po > This is a po file - it contains translations > > The format looks like this: > > #: app/templates/foo.html:11 > msgid "foo" > msgstr "" > > You give this file to your translator, he fills in the msgstr portion > of the pofile. He can do this with a text editor, or an application > (poedit +others), or even a django app (django-rosetta). > > Eg, he may make this change: > > #: app/templates/foo.html:11 > msgid "foo" > msgstr "föö" > > The translator gives the file back, and you put it in the right place > in the locale directory. > You run "python manage.py compilemessages" > This turns po files into mo files - a binary, efficient way of > accessing the data. > Now, whenever django encounters the exact string "foo" in a > translation context (eg {% trans "foo" %} or _("foo") in a view), it > replaces it with the translation. > > 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.