Permalink
Browse files

Merged i18n branch into the trunk! Fixes #65, and perhaps some others…

…. NB: this means that the i18n branch is now obsolete and will be made read-only.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1068 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
jacobian committed Nov 4, 2005
1 parent cb45fd0 commit 5cf8f684237ab5addaf3549b2347c3adf107c0a7
Showing with 12,449 additions and 186 deletions.
  1. +24 −0 django/bin/compile-messages.py
  2. +9 −0 django/bin/django-admin.py
  3. +89 −0 django/bin/make-messages.py
  4. +19 −0 django/conf/global_settings.py
  5. BIN django/conf/locale/cs/LC_MESSAGES/django.mo
  6. +978 −0 django/conf/locale/cs/LC_MESSAGES/django.po
  7. BIN django/conf/locale/de/LC_MESSAGES/django.mo
  8. +984 −0 django/conf/locale/de/LC_MESSAGES/django.po
  9. BIN django/conf/locale/en/LC_MESSAGES/django.mo
  10. +927 −0 django/conf/locale/en/LC_MESSAGES/django.po
  11. BIN django/conf/locale/es/LC_MESSAGES/django.mo
  12. +959 −0 django/conf/locale/es/LC_MESSAGES/django.po
  13. BIN django/conf/locale/fr/LC_MESSAGES/django.mo
  14. +995 −0 django/conf/locale/fr/LC_MESSAGES/django.po
  15. BIN django/conf/locale/gl/LC_MESSAGES/django.mo
  16. +955 −0 django/conf/locale/gl/LC_MESSAGES/django.po
  17. BIN django/conf/locale/it/LC_MESSAGES/django.mo
  18. +981 −0 django/conf/locale/it/LC_MESSAGES/django.po
  19. BIN django/conf/locale/pt_BR/LC_MESSAGES/django.mo
  20. +981 −0 django/conf/locale/pt_BR/LC_MESSAGES/django.po
  21. BIN django/conf/locale/ru/LC_MESSAGES/django.mo
  22. +956 −0 django/conf/locale/ru/LC_MESSAGES/django.po
  23. BIN django/conf/locale/sr/LC_MESSAGES/django.mo
  24. +981 −0 django/conf/locale/sr/LC_MESSAGES/django.po
  25. BIN django/conf/locale/zh_CN/LC_MESSAGES/django.mo
  26. +951 −0 django/conf/locale/zh_CN/LC_MESSAGES/django.po
  27. +7 −0 django/conf/settings.py
  28. +5 −0 django/conf/urls/i18n.py
  29. +8 −6 django/contrib/admin/models/admin.py
  30. +4 −3 django/contrib/admin/templates/admin/404.html
  31. +5 −4 django/contrib/admin/templates/admin/500.html
  32. +4 −3 django/contrib/admin/templates/admin/base.html
  33. +3 −2 django/contrib/admin/templates/admin/base_site.html
  34. +4 −3 django/contrib/admin/templates/admin/delete_confirmation.html
  35. +7 −6 django/contrib/admin/templates/admin/index.html
  36. +5 −4 django/contrib/admin/templates/admin/login.html
  37. +7 −6 django/contrib/admin/templates/admin/object_history.html
  38. +4 −3 django/contrib/admin/templates/registration/logged_out.html
  39. +5 −4 django/contrib/admin/templates/registration/password_change_done.html
  40. +9 −8 django/contrib/admin/templates/registration/password_change_form.html
  41. +5 −4 django/contrib/admin/templates/registration/password_reset_done.html
  42. +8 −7 django/contrib/admin/templates/registration/password_reset_email.html
  43. +6 −5 django/contrib/admin/templates/registration/password_reset_form.html
  44. +6 −0 django/core/extensions.py
  45. +16 −3 django/core/meta/fields.py
  46. +147 −3 django/core/template/__init__.py
  47. +3 −0 django/core/template/defaulttags.py
  48. +64 −61 django/core/validators.py
  49. +24 −0 django/middleware/locale.py
  50. +26 −19 django/models/auth.py
  51. +34 −22 django/models/core.py
  52. +217 −0 django/templatetags/i18n.py
  53. +9 −7 django/utils/dates.py
  54. +61 −0 django/utils/functional.py
  55. +1 −1 django/utils/text.py
  56. +447 −0 django/utils/translation.py
  57. +22 −0 django/views/i18n.py
  58. +5 −2 docs/settings.txt
  59. +438 −0 docs/translation.txt
  60. +44 −0 tests/othertests/templates.py
@@ -0,0 +1,24 @@
#!/usr/bin/python
import os
import sys
import getopt
basedir = None
if os.path.isdir(os.path.join('conf', 'locale')):
basedir = os.path.abspath(os.path.join('conf', 'locale'))
elif os.path.isdir('locale'):
basedir = os.path.abspath('locale')
else:
print "this script should be run from the django svn tree or your project or app tree"
sys.exit(1)
for (dirpath, dirnames, filenames) in os.walk(basedir):
for file in filenames:
if file.endswith('.po'):
sys.stderr.write('processing file %s in %s\n' % (file, dirpath))
pf = os.path.splitext(os.path.join(dirpath, file))[0]
cmd = 'msgfmt -o %s.mo %s.po' % (pf, pf)
os.system(cmd)
@@ -3,6 +3,14 @@
from optparse import OptionParser
import os, sys
# switch to english, because django-admin creates database content
# like permissions, and those shouldn't contain any translations
try:
from django.utils import translation
translation.activate('en-us')
except:
pass
ACTION_MAPPING = {
'adminindex': management.get_admin_index,
'createsuperuser': management.createsuperuser,
@@ -129,3 +137,4 @@ def main():
if __name__ == "__main__":
main()
@@ -0,0 +1,89 @@
#!/usr/bin/python
import re
import os
import sys
import getopt
from django.utils.translation import templateize
localedir = None
if os.path.isdir(os.path.join('conf', 'locale')):
localedir = os.path.abspath(os.path.join('conf', 'locale'))
elif os.path.isdir('locale'):
localedir = os.path.abspath('locale')
else:
print "this script should be run from the django svn tree or your project or app tree"
sys.exit(1)
(opts, args) = getopt.getopt(sys.argv[1:], 'l:d:va')
lang = None
domain = 'django'
verbose = False
all = False
for o, v in opts:
if o == '-l':
lang = v
elif o == '-d':
domain = v
elif o == '-v':
verbose = True
elif o == '-a':
all = True
if (lang is None and not all) or domain is None:
print "usage: make-messages.py -l <language>"
print " or: make-messages.py -a"
sys.exit(1)
languages = []
if lang is not None:
languages.append(lang)
elif all:
languages = [el for el in os.listdir(localedir) if not el.startswith('.')]
for lang in languages:
print "processing language", lang
basedir = os.path.join(localedir, lang, 'LC_MESSAGES')
if not os.path.isdir(basedir):
os.makedirs(basedir)
pofile = os.path.join(basedir, '%s.po' % domain)
potfile = os.path.join(basedir, '%s.pot' % domain)
if os.path.exists(potfile):
os.unlink(potfile)
for (dirpath, dirnames, filenames) in os.walk("."):
for file in filenames:
if file.endswith('.py') or file.endswith('.html'):
thefile = file
if file.endswith('.html'):
src = open(os.path.join(dirpath, file), "rb").read()
open(os.path.join(dirpath, '%s.py' % file), "wb").write(templateize(src))
thefile = '%s.py' % file
if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
cmd = 'xgettext %s -d %s -L Python --keyword=gettext_noop --keyword=gettext_lazy --keyword=ngettext_lazy -o - "%s"' % (
os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile))
msgs = os.popen(cmd, 'r').read()
if thefile != file:
old = '#: '+os.path.join(dirpath, thefile)[2:]
new = '#: '+os.path.join(dirpath, file)[2:]
msgs = msgs.replace(old, new)
if msgs:
open(potfile, 'ab').write(msgs)
if thefile != file:
os.unlink(os.path.join(dirpath, thefile))
msgs = os.popen('msguniq %s' % potfile, 'r').read()
open(potfile, 'w').write(msgs)
if os.path.exists(pofile):
msgs = os.popen('msgmerge %s %s' % (pofile, potfile), 'r').read()
open(pofile, 'wb').write(msgs)
os.unlink(potfile)
@@ -1,6 +1,8 @@
# Default Django settings. Override these with settings in the module
# pointed-to by the DJANGO_SETTINGS_MODULE environment variable.
from django.utils.translation import gettext_lazy as _
####################
# CORE #
####################
@@ -28,6 +30,23 @@
# 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 = (
('cs', _('Czech')),
('de', _('German')),
('en', _('English')),
('es', _('Spanish')),
('fr', _('French')),
('gl', _('Galician')),
('it', _('Italian')),
('pt-br', _('Brazilian')),
('ru', _('Russian')),
('sr', _('Serbian')),
('zh-cn', _('Traditional Chinese')),
)
# Not-necessarily-technical managers of the site. They get broken link
# notifications and other various e-mails.
MANAGERS = ADMINS
Binary file not shown.
Oops, something went wrong.

0 comments on commit 5cf8f68

Please sign in to comment.