Nebojša Đorđević
unread,Jul 23, 2005, 6:32:05 AM7/23/05Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-d...@googlegroups.com
I moved localization into separate class.
Where I can upload/attach this? In ticket or I can post here?
To enable localization support simply include following in *Request
class __init__ method:
self.locale = locale.Locale(self)
to change locale use: request.locale = 'locale'
to get current locale use: request.locale - is there any way to pass
this to template?
For template.py change regexp to:
# gettext tags
GETTEXT_START = '_("'
GETTEXT_END = '")'
tag_re = re.compile('(%s.*?%s|%s.*?%s|%s.*?%s)' % \
(re.escape(BLOCK_TAG_START),
re.escape(BLOCK_TAG_END),
re.escape(VARIABLE_TAG_START),
re.escape(VARIABLE_TAG_END),
re.escape(GETTEXT_START),
re.escape(GETTEXT_END)))
and in create_token add before last else:
# gettext support
elif token_string.startswith(GETTEXT_START):
return Token(TOKEN_TEXT,
_(token_string[len(GETTEXT_START):-len(GETTEXT_END)].strip()))
this enable use _("") as a gettext tag in html templates
I localized admin interface and admin templates and all works great.
Probably I'll add some type of admin interface for working with
translation files later (when form tutorial comes up :) ).
--
Đorđević Nebojša
Studio Quattro - Niš - SCG