Sunday, September 5, 2010

Re: Where and how should I write translations [SOLVED]

I solved it by creating a new python file with:


# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _

translation_strings = [
_(u'string'),
_(u'another string'),
...
]

So easy :)

Martin


On Thu, 02 Sep 2010 13:33:36 +0200, Martin Tiršel <django@blackpage.eu>
wrote:

> Hello,
>
> I can not find in Django documentation a word about translating
> variables or strings with variables. I have:
>
> ...
> <legend>{% trans question_category %}</legend>
> ...
>
> django-admin.py makemessages creates .po but without a mention about
> this template line ({% trans "some text" %} is ok). It is clear, that I
> have somehow to specify translation strings in .po file, but when I do
> it manually, next django-admin.py makemessages overwrite the .po file.
>
> So, my question is, where and how should I write translation for strings
> in variables (or variable in a string)?
>
>
> Next, I have some strings in initial_data.json fixture, is there a way
> how to automatically extract it into .po file while running
> django-admin.py makemessages? Or it could extract it from database, it
> doesn't matter. Yes, I know, that I should change DB structure and not
> translate strings from DB this way, but I have my reasons why I am
> doing it so.
>
> 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment