views:

123

answers:

1

I review docs but I am lost... some problem with it:

{% load i18n %}
{% blocktrans %}
{{ wpis.entry.lastChangeDate|timesince }}
{% endblocktrans %}

Raise:

`KeyError: u'wpis.entry.lastChangeDate | timesince'`

Of course, without blocktrans all works fine.

So, what is simples way to translate few words? (I am interesting polish lang, minutes -> minut, hours -> godzin, etc) I will be thankful for clear example.

EDIT: in my .po file i have now:

#: templates/part.html:37 
#, python-format 
msgid "" 
"\n" 
"%(lastChangeDate)s\n" 
msgstr ""

and i don't see anything about var in docs... now i would do:

msgid "hours" 
msgstr "godzin"

etc and bind it to my var (above example don't work...)

+2  A: 
{% load i18n %}
{% blocktrans with wpis.entry.lastChangeDate|timesince as lastChangeDate %}
{{ lastChangeDate }}
{% endblocktrans %}

See http://docs.djangoproject.com/en/dev/topics/i18n/#in-template-code for more info.

David
Thx for answer, but in that case where i should put polish words?
Rin
Sorry, I updated the snippet with a better way to do this.
David
But i still have only english words, in setting.py lang is "pl"
Rin
It sounds like you don't have internationalization setup properly. Do you have the locale middlware installed, and have you created your language files? See http://docs.djangoproject.com/en/dev/topics/i18n/
David
in my .po file i have now: #: templates/part.html:37#, python-formatmsgid """\n""%(lastChangeDate)s\n"msgstr ""and i don't see anything about var in docs... now i would do: msgid "hours"msgstr "godzin"etc and bind it to my var
Rin