Re: Translating templates

2011-12-14 Thread Karen Tracey
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:
>
> > 
> > We are the greatest company in the world. yadda yadda.
> > 
> > {% actual useful stuff%}
> > A lot of other useless text otherwise the page isn't professional
> > enough 
>

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.:

 
{% trans "We are the greatest company in the world. yadda yadda." %}

{% actual useful stuff%}
 {% trans "A lot of other useless text otherwise the page isn't
professional
 enough" %} 

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.



Translating templates

2011-12-14 Thread Demetrio Girardi
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, 
which is not useful to me. For example, I'll have a template like this:

> 
> We are the greatest company in the world. yadda yadda.
> 
> {% actual useful stuff%}
> A lot of other useless text otherwise the page isn't professional
> enough 

I cannot simply pass the template file to the translators because they would 
be confused by the markup. Is there a "correct" way to handle localization of 
decorative text? 

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