summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Bauer <gb@hugo.westfalen.de>2005-10-03 10:15:11 +0000
committerGeorg Bauer <gb@hugo.westfalen.de>2005-10-03 10:15:11 +0000
commit4196ff0b174926edae60277f5a844f2463e08162 (patch)
tree855e3415ec2811e572cb2c960dc6107695a9a5e3
parented3f73674b4c0670c81917b7f0d66e83010e5c60 (diff)
i18n: added GET-support to language selection, added serbian translation file and added some convenience
stuff to the DjangoContext - all from a patch by nesh on the list. Thanks nesh! References #65. git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@768 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/conf/global_settings.py10
-rw-r--r--django/conf/locale/sr/LC_MESSAGES/django.mobin0 -> 5376 bytes
-rw-r--r--django/conf/locale/sr/LC_MESSAGES/django.po287
-rw-r--r--django/core/extensions.py6
-rw-r--r--django/utils/translation.py25
5 files changed, 327 insertions, 1 deletions
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index 449d25d01e..03567b98c4 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -28,6 +28,16 @@ TIME_ZONE = 'America/Chicago'
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
LANGUAGE_CODE = 'en-us'
+# Languages we provide translations for out of the base. The
+# language name should be the utf-8 encoded local name for the
+# language.
+LANGUAGES = (
+ ('en-us', 'English'),
+ ('de', 'Deutsch'),
+ ('it', 'Italiano'),
+ ('sr', 'Srpski'),
+)
+
# Not-necessarily-technical managers of the site. They get broken link
# notifications and other various e-mails.
MANAGERS = ADMINS
diff --git a/django/conf/locale/sr/LC_MESSAGES/django.mo b/django/conf/locale/sr/LC_MESSAGES/django.mo
new file mode 100644
index 0000000000..43d557be0b
--- /dev/null
+++ b/django/conf/locale/sr/LC_MESSAGES/django.mo
Binary files differ
diff --git a/django/conf/locale/sr/LC_MESSAGES/django.po b/django/conf/locale/sr/LC_MESSAGES/django.po
new file mode 100644
index 0000000000..805d2f5f66
--- /dev/null
+++ b/django/conf/locale/sr/LC_MESSAGES/django.po
@@ -0,0 +1,287 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-10-03 09:35+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+
+#: conf/admin_templates/404.html.py:1 conf/admin_templates/404.html.py:2
+msgid "Page not found"
+msgstr "Strana nije nađena"
+
+#: conf/admin_templates/404.html.py:3
+msgid "We're sorry, but the requested page could not be found."
+msgstr "Žao nam je, ali tražena strana ne postoji"
+
+#: conf/admin_templates/500.html.py:1
+msgid "Server error (500)"
+msgstr "Greška na serveru (500)"
+
+#: conf/admin_templates/500.html.py:2
+msgid "Server Error <em>(500)</em>"
+msgstr "Greška na serveru <em>(500)</em>"
+
+#: conf/admin_templates/500.html.py:3
+msgid ""
+"There's been an error. It's been reported to the site administrators via e-"
+"mail and should be fixed shortly. Thanks for your patience."
+msgstr ""
+"Dogodila se greša. Greška je prijavljena administratorima kroz e-"
+"mail i biće popravljena uskoro. Hvala na strpljenju."
+
+#: conf/admin_templates/admin_object_history.html.py:1
+#: conf/admin_templates/base.html.py:4
+#: conf/admin_templates/registration/logged_out.html.py:1
+#: conf/admin_templates/registration/password_change_done.html.py:1
+#: conf/admin_templates/registration/password_change_form.html.py:1
+#: conf/admin_templates/registration/password_reset_done.html.py:1
+#: conf/admin_templates/registration/password_reset_form.html.py:1
+msgid "Home"
+msgstr "Početna strana"
+
+#: conf/admin_templates/admin_object_history.html.py:2
+msgid "History"
+msgstr "Istorija"
+
+#: conf/admin_templates/admin_object_history.html.py:3
+msgid "Date/time"
+msgstr "Datum/vreme"
+
+#: conf/admin_templates/admin_object_history.html.py:4
+msgid "User"
+msgstr "Korisnik"
+
+#: conf/admin_templates/admin_object_history.html.py:5
+msgid "Action"
+msgstr "Akcija"
+
+#: conf/admin_templates/admin_object_history.html.py:6
+msgid ""
+"This object doesn't have a change history. It probably wasn't added via this "
+"admin site."
+msgstr ""
+"Ovaj objekt nema istoriju promena. Najverovatnije nije dodat kroz "
+"sajt administraciju."
+#: conf/admin_templates/base.html.py:1
+msgid "Welcome,"
+msgstr "Dobrodošli,"
+
+#: conf/admin_templates/base.html.py:2 conf/admin_templates/base.html.py:5
+msgid "Change password"
+msgstr "Izmena lozinke"
+
+#: conf/admin_templates/base.html.py:3 conf/admin_templates/base.html.py:5
+msgid "Log out"
+msgstr "Odjava"
+
+#: conf/admin_templates/base_site.html.py:1
+msgid "Django site admin"
+msgstr "Django administracija sajta"
+
+#: conf/admin_templates/base_site.html.py:2
+msgid "Django administration"
+msgstr "Django administracija"
+
+#: conf/admin_templates/changelist_generic.html.py:1
+#: conf/admin_templates/index.html.py:1
+msgid "Add"
+msgstr "Dodaj"
+
+#: conf/admin_templates/changelist_generic.html.py:2
+msgid "Click to change"
+msgstr "Kliknite za izmenu"
+
+#: conf/admin_templates/delete_confirmation_generic.html.py:1
+#, python-format
+msgid ""
+"Deleting the %(object_name)s '%(object)s' would result in deleting related "
+"objects, but your account doesn't have permission to delete the following "
+"types of objects:"
+msgstr ""
+"Brisanje %(object_name)s '%(object)s' bi obrisalo i pridružene "
+"objekte, ali vaš nalog nema prava da briše sledeće "
+"tipove objekata:"
+#: conf/admin_templates/delete_confirmation_generic.html.py:2
+#, python-format
+msgid ""
+"Are you sure you want to delete the %(object_name)s \"%(object)s\"? All of "
+"the following related items will be deleted:"
+msgstr ""
+"Da li ste sigurni da želite da obrišete %(object_name)s \"%(object)s\"? Biće obrisani i "
+"sledeći pridruženi objekti:"
+
+#: conf/admin_templates/delete_confirmation_generic.html.py:3
+msgid "Yes, I'm sure"
+msgstr "Da, sigurno"
+
+#: conf/admin_templates/index.html.py:2
+msgid "Change"
+msgstr "Izmena"
+
+#: conf/admin_templates/index.html.py:3
+msgid "You don't have permission to edit anything."
+msgstr "Nemate pravo da izmenite bilo šta"
+
+#: conf/admin_templates/index.html.py:4
+msgid "Recent Actions"
+msgstr "Skorije akcije"
+
+#: conf/admin_templates/index.html.py:5
+msgid "My Actions"
+msgstr "Moje akcije"
+
+#: conf/admin_templates/index.html.py:6
+msgid "None available"
+msgstr "Nema dostupnih"
+
+#: conf/admin_templates/login.html.py:1
+msgid "Username:"
+msgstr "Korisničko ime:"
+
+#: conf/admin_templates/login.html.py:2
+msgid "Password:"
+msgstr "Šifra:"
+
+#: conf/admin_templates/login.html.py:3
+msgid "Have you <a href=\"/password_reset/\">forgotten your password</a>?"
+msgstr "Da li ste <a href=\"/password_reset/\">zaboravili vašu šifru?</a>?"
+
+#: conf/admin_templates/login.html.py:4
+msgid "Log in"
+msgstr "Prijava"
+
+#: conf/admin_templates/registration/logged_out.html.py:2
+msgid "Thanks for spending some quality time with the Web site today."
+msgstr "Hvala na poseti"
+
+#: conf/admin_templates/registration/logged_out.html.py:3
+msgid "Log in again"
+msgstr "Ponovna prijava"
+
+#: conf/admin_templates/registration/password_change_done.html.py:2
+#: conf/admin_templates/registration/password_change_done.html.py:6
+#: conf/admin_templates/registration/password_change_form.html.py:2
+#: conf/admin_templates/registration/password_change_form.html.py:3
+#: conf/admin_templates/registration/password_change_form.html.py:4
+#: conf/admin_templates/registration/password_change_form.html.py:10
+msgid "Password change"
+msgstr "Izmena šifre"
+
+#: conf/admin_templates/registration/password_change_done.html.py:3
+#: conf/admin_templates/registration/password_change_done.html.py:4
+msgid "Password change successful"
+msgstr "Izmena šifre uspešna"
+
+#: conf/admin_templates/registration/password_change_done.html.py:5
+msgid "Your password was changed."
+msgstr "Vaša šifra je promenjena"
+
+#: conf/admin_templates/registration/password_change_form.html.py:5
+msgid ""
+"Please enter your old password, for security's sake, and then enter your new "
+"password twice so we can verify you typed it in correctly."
+msgstr ""
+"Zbog sigurnosti, unesite vašu staru šifru, posle toga unesite "
+"novu šifru dva puta, da bi mogli proveriti da li je uneta kako treba."
+
+#: conf/admin_templates/registration/password_change_form.html.py:6
+msgid "Old password:"
+msgstr "Stara šifra:"
+
+#: conf/admin_templates/registration/password_change_form.html.py:7
+msgid "New password:"
+msgstr "Nova šifra:"
+
+#: conf/admin_templates/registration/password_change_form.html.py:8
+msgid "Confirm password:"
+msgstr "Potvrdite šifru:"
+
+#: conf/admin_templates/registration/password_change_form.html.py:9
+msgid "Change my password"
+msgstr "Izmena šifre"
+
+#: conf/admin_templates/registration/password_reset_done.html.py:2
+#: conf/admin_templates/registration/password_reset_done.html.py:6
+#: conf/admin_templates/registration/password_reset_form.html.py:2
+#: conf/admin_templates/registration/password_reset_form.html.py:3
+#: conf/admin_templates/registration/password_reset_form.html.py:4
+#: conf/admin_templates/registration/password_reset_form.html.py:8
+#: conf/admin_templates/registration/password_reset_form.html.py:9
+msgid "Password reset"
+msgstr "Resetovanje šifre"
+
+#: conf/admin_templates/registration/password_reset_done.html.py:3
+#: conf/admin_templates/registration/password_reset_done.html.py:4
+msgid "Password reset successful"
+msgstr "Resetovanje šifre je bilo uspoešno"
+
+#: conf/admin_templates/registration/password_reset_done.html.py:5
+msgid ""
+"We've e-mailed a new password to the e-mail address you submitted. You "
+"should be receiving it shortly."
+msgstr ""
+"Šifra vam je poslata na e-mail adresu koju ste zadali. Trebalo bi "
+"da vam stigne uskoro."
+
+#: conf/admin_templates/registration/password_reset_email.html.py:1
+msgid "You're receiving this e-mail because you requested a password reset"
+msgstr "Primate ovaj e-mail zato što ste tražili resetovanje šifre"
+
+#: conf/admin_templates/registration/password_reset_email.html.py:2
+#, python-format
+msgid "for your user account at %(site_name)s"
+msgstr "za vaš nalog na %(site_name)s"
+
+#: conf/admin_templates/registration/password_reset_email.html.py:3
+#, python-format
+msgid "Your new password is: %(new_password)s"
+msgstr "Vaša nova šifra: %(new_password)s"
+
+#: conf/admin_templates/registration/password_reset_email.html.py:4
+msgid "Feel free to change this password by going to this page:"
+msgstr "Šifru možete promeniti na sledećoj strani:"
+
+#: conf/admin_templates/registration/password_reset_email.html.py:5
+msgid "Your username, in case you've forgotten:"
+msgstr "Vaše korisničko ime, u sličaju da ste zaboravili:"
+
+#: conf/admin_templates/registration/password_reset_email.html.py:6
+msgid "Thanks for using our site!"
+msgstr ""
+
+#: conf/admin_templates/registration/password_reset_email.html.py:7
+#, python-format
+msgid "The %(site_name)s team"
+msgstr "%(site_name)s tim"
+
+#: conf/admin_templates/registration/password_reset_form.html.py:5
+msgid ""
+"Forgotten your password? Enter your e-mail address below, and we'll reset "
+"your password and e-mail the new one to you."
+msgstr ""
+"Zaboravili ste šifru? Unesite e-mail adresu ispod i mi ćemo generisati novu "
+"šifru i poslati je vama preko e-mail-a."
+
+#: conf/admin_templates/registration/password_reset_form.html.py:6
+msgid "E-mail address:"
+msgstr "E-mail adresa:"
+
+#: conf/admin_templates/registration/password_reset_form.html.py:7
+msgid "Reset my password"
+msgstr "Resetuj šifru"
+
+#: core/validators.py:56
+msgid "This value must contain only letters, numbers and underscores."
+msgstr "Ovo polje može sadržati samo slova, brojeve i donju crtu (_)"
diff --git a/django/core/extensions.py b/django/core/extensions.py
index 6909ace33d..e9947f0c6e 100644
--- a/django/core/extensions.py
+++ b/django/core/extensions.py
@@ -34,6 +34,12 @@ class DjangoContext(Context):
self['user'] = request.user
self['messages'] = request.user.get_and_delete_messages()
self['perms'] = PermWrapper(request.user)
+ from django.conf import settings
+ self['LANGUAGES'] = settings.LANGUAGES
+ if hasattr(request, 'LANGUAGE_CODE'):
+ self['LANGUAGE_CODE'] = request.LANGUAGE_CODE
+ else:
+ self['LANGUAGE_CODE'] = settings.LANGUAGE_CODE
if DEBUG and request.META.get('REMOTE_ADDR') in INTERNAL_IPS:
self['debug'] = True
from django.core import db
diff --git a/django/utils/translation.py b/django/utils/translation.py
index b776023466..37acfe80a3 100644
--- a/django/utils/translation.py
+++ b/django/utils/translation.py
@@ -46,6 +46,9 @@ class DjangoTranslation(gettext_module.GNUTranslations):
def set_app_and_language(self, app, language):
self.__app = app
self.__language = language
+
+ def language(self):
+ return self.__language
def __repr__(self):
return "<DjangoTranslation app:%s lang:%s>" % (self.__app, self.__language)
@@ -120,6 +123,17 @@ def deactivate():
"""
del _active[currentThread()]
+def get_language():
+ """
+ This function returns the currently selected language.
+ """
+ t = _active.get(currentThread(), None)
+ if t is not None:
+ return t.language()
+ else:
+ from django.conf.settings import LANGUAGE_CODE
+ return LANGUAGE_CODE
+
def gettext(message):
"""
This function will be patched into the builtins module to
@@ -171,8 +185,17 @@ def get_language_from_request(request):
"""
global _accepted
+ if request.GET:
+ lang = request.GET.get('django_language', None)
+ if lang is not None:
+ if hasattr(request, 'session'):
+ request.session['django_language'] = lang
+ else:
+ request.set_cookie('django_language', lang)
+ return lang
+
if hasattr(request, 'session'):
- lang = getattr(request.session, 'django_language', None)
+ lang = request.session.get('django_language', None)
if lang is not None:
return lang