On Wed, Dec 14, 2011 at 3:13 PM, Demetrio Girardi < demetrio.gira...@gmail.com> wrote:
> My project has a bunch of text embedded deep within the html markup in > templates that I need to translate. The text, imo, belongs to templates > and it > has no place in the application logic. > > From what I understand, localization in templates is limited to variables, > That's not correct, where did you get that idea? > which is not useful to me. For example, I'll have a template like this: > > > <lots><of><markup><to><make><this><look><fancy> > > We are the greatest company in the world. yadda yadda. > > <a><lot><of><other><markup> > > {% actual useful stuff%} > > <etc>A lot of other useless text otherwise the page isn't professional > > enough </etc> > You use the trans template tag to mark plain strings in template code for translation, blocktrans if the strings have variables embedded in them. See ttps:// docs.djangoproject.com/en/1.3/topics/i18n/internationalization/#specifying-translation-strings-in-template-codefor details. E.g.: <lots><of><markup><to><make><this><look><fancy> {% trans "We are the greatest company in the world. yadda yadda." %} <a><lot><of><other><markup> {% actual useful stuff%} <etc> {% trans "A lot of other useless text otherwise the page isn't professional enough" %} </etc> Once all strings are marked, you use the makemessages command ( https://docs.djangoproject.com/en/1.3/topics/i18n/localization/#message-files) to generate message files, and that's what you hand to translators to translate. Karen -- http://tracey.org/kmt/ -- 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.