|
Project Information
Members
Featured
Downloads
Links
|
django-flagsThe django-flags helps writing internationalized applications based on "verbose" templates: In this situation, it is more efficient to maintain a set of templates per language than writing one set of templates with many trans tags. Last languages added: romanian What django-flags doesdjango-flags provides:
Here's an example of a flags form:
Test itdownload or check it out, then launch the project test with: python manage.py testserver That's all ! A screenshot of test page:
Using django-flags in your django projectsettings.pyadd the following template loaders first: TEMPLATE_LOADERS = (
'yourproject.flags.loaders.filesystem.load_template_source',
'yourproject.flags.loaders.app_directories.load_template_source',
...
)add the local middleware after the session middleware: MIDDLEWARE_CLASSES = (
...
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
...
)add the flags application: INSTALLED_APPS = (
...
'yourproject.flags',
)add flags application parameters; you can choose flags icons server: # see urls.py
FLAGS_I18N_PREFIX = '/lang/i18n/'
# flags served by local server
#FLAGS_URL = MEDIA_URL
# flags served by net server
FLAGS_URL = 'http://djangodev.free.fr/flags/'
# languages
ugettext = lambda s: s
LANGUAGES = (
('ar', ugettext('Arabic')),
('fr', ugettext('French')),
('en', ugettext('English')),
('es', ugettext('Spanish')),
('de', ugettext('German')),
('pl', ugettext('Polish')),
)urls.pyinclude flags.urls (the prefix must match settings.FLAGS_I18N_PREFIX): urlpatterns = patterns('',
# django-flags for internationalization
(r'^lang/', include('yourproject.flags.urls')),
...
)templatesInsert the following code to generate the flags form: {% load flags_lib %}{% flags_form %}
That's all. Help neededYou can help me this way:
|