1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

i18n: again cleaned up make-messages.py - now the line numbers for templates will be correct.

git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@801 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Georg Bauer 2005-10-08 00:01:25 +00:00
parent 2442ceaa3f
commit 4fc6d40d00
2 changed files with 96 additions and 85 deletions

View File

@ -37,9 +37,28 @@ basedir = os.path.join(basedir, lang, 'LC_MESSAGES')
if not os.path.isdir(basedir): if not os.path.isdir(basedir):
os.makedirs(basedir) os.makedirs(basedir)
tpl_i18n_re = re.compile(r'{%\s+i18n\s+.*?%}') dot_re = re.compile('\S')
tpl_value_re = re.compile(r'{{\s*_\(.*?\)\s*}}') def blank(src):
tpl_tag_re = re.compile(r"""{%.*_\((?:".*?")|(?:'.*?')\).*%}""") return dot_re.sub('p', src)
def templateize(src):
o = []
going = 1
while going:
start = src.find('{')
if start >= 0 and src[start+1] in ('{', '%'):
o.append(blank(src[:start]))
end = src.find(src[start+1] == '{' and '}' or '%', start)
if end >= 0:
o.append(src[start:end+2])
src = src[end+2:]
else:
o.append(blank(src[start:]))
going = 0
else:
o.append(blank(src))
going = 0
return ''.join(o)
pofile = os.path.join(basedir, '%s.po' % domain) pofile = os.path.join(basedir, '%s.po' % domain)
potfile = os.path.join(basedir, '%s.pot' % domain) potfile = os.path.join(basedir, '%s.pot' % domain)
@ -53,19 +72,16 @@ for (dirpath, dirnames, filenames) in os.walk("."):
thefile = file thefile = file
if file.endswith('.html'): if file.endswith('.html'):
src = open(os.path.join(dirpath, file), "rb").read() src = open(os.path.join(dirpath, file), "rb").read()
lst = [] open(os.path.join(dirpath, '%s.py' % file), "wb").write(templateize(src))
for match in tpl_i18n_re.findall(src):
lst.append(match)
for match in tpl_value_re.findall(src):
lst.append(match)
for match in tpl_tag_re.findall(src):
lst.append(match)
open(os.path.join(dirpath, '%s.py' % file), "wb").write('\n'.join(lst))
thefile = '%s.py' % file thefile = '%s.py' % file
if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath)) if verbose: sys.stdout.write('processing file %s in %s\n' % (file, dirpath))
cmd = 'xgettext %s -d %s -L Python -o - "%s"' % ( cmd = 'xgettext %s -d %s -L Python -o - "%s"' % (
os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile)) os.path.exists(potfile) and '--omit-header' or '', domain, os.path.join(dirpath, thefile))
msgs = os.popen(cmd, 'r').read() 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: if msgs:
open(potfile, 'ab').write(msgs) open(potfile, 'ab').write(msgs)
if thefile != file: if thefile != file:

View File

@ -8,40 +8,40 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Django 1.0\n" "Project-Id-Version: Django 1.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2005-10-08 00:07+0200\n" "POT-Creation-Date: 2005-10-08 00:51+0200\n"
"PO-Revision-Date: 2005-10-08 00:03+0200\n" "PO-Revision-Date: 2005-10-08 00:03+0200\n"
"Last-Translator: Georg Bauer <gb@bofh.ms>\n" "Last-Translator: Georg Bauer <gb@bofh.ms>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=iso-8859-1\n" "Content-Type: text/plain; charset=iso-8859-1\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: conf/admin_templates/admin_object_history.html.py:1 #: conf/admin_templates/admin_object_history.html:4
#: conf/admin_templates/base.html.py:4 #: conf/admin_templates/base.html:28
#: conf/admin_templates/registration/password_change_done.html.py:1 #: conf/admin_templates/registration/password_change_done.html:3
#: conf/admin_templates/registration/password_reset_form.html.py:1 #: conf/admin_templates/registration/password_reset_form.html:3
#: conf/admin_templates/registration/logged_out.html.py:1 #: conf/admin_templates/registration/logged_out.html:3
#: conf/admin_templates/registration/password_reset_done.html.py:1 #: conf/admin_templates/registration/password_reset_done.html:3
#: conf/admin_templates/registration/password_change_form.html.py:1 #: conf/admin_templates/registration/password_change_form.html:3
msgid "Home" msgid "Home"
msgstr "Start" msgstr "Start"
#: conf/admin_templates/admin_object_history.html.py:2 #: conf/admin_templates/admin_object_history.html:4
msgid "History" msgid "History"
msgstr "Geschichte" msgstr "Geschichte"
#: conf/admin_templates/admin_object_history.html.py:3 #: conf/admin_templates/admin_object_history.html:17
msgid "Date/time" msgid "Date/time"
msgstr "Datum/Zeit" msgstr "Datum/Zeit"
#: conf/admin_templates/admin_object_history.html.py:4 #: conf/admin_templates/admin_object_history.html:18
msgid "User" msgid "User"
msgstr "Benutzer" msgstr "Benutzer"
#: conf/admin_templates/admin_object_history.html.py:5 #: conf/admin_templates/admin_object_history.html:19
msgid "Action" msgid "Action"
msgstr "Aktion" msgstr "Aktion"
#: conf/admin_templates/admin_object_history.html.py:6 #: conf/admin_templates/admin_object_history.html:35
msgid "" msgid ""
"This object doesn't have a change history. It probably wasn't added via this " "This object doesn't have a change history. It probably wasn't added via this "
"admin site." "admin site."
@ -49,52 +49,52 @@ msgstr ""
"Dieses Objekt hat keine Änderungsgeschichte. Es wurde möglicherweise nicht " "Dieses Objekt hat keine Änderungsgeschichte. Es wurde möglicherweise nicht "
"über diese Verwaltungsseiten angelegt." "über diese Verwaltungsseiten angelegt."
#: conf/admin_templates/changelist_generic.html.py:1 #: conf/admin_templates/changelist_generic.html:8
#: conf/admin_templates/index.html.py:1 #: conf/admin_templates/index.html:26
msgid "Add" msgid "Add"
msgstr "Zufügen" msgstr "Zufügen"
#: conf/admin_templates/changelist_generic.html.py:2 #: conf/admin_templates/changelist_generic.html:26
msgid "Click to change" msgid "Click to change"
msgstr "Zur Änderung klicken" msgstr "Zur Änderung klicken"
#: conf/admin_templates/base_site.html.py:1 #: conf/admin_templates/base_site.html:3
msgid "Django site admin" msgid "Django site admin"
msgstr "Django Systemverwaltung" msgstr "Django Systemverwaltung"
#: conf/admin_templates/base_site.html.py:2 #: conf/admin_templates/base_site.html:6
msgid "Django administration" msgid "Django administration"
msgstr "Django Verwaltung" msgstr "Django Verwaltung"
#: conf/admin_templates/index.html.py:2 #: conf/admin_templates/index.html:32
msgid "Change" msgid "Change"
msgstr "Ändern" msgstr "Ändern"
#: conf/admin_templates/index.html.py:3 #: conf/admin_templates/index.html:42
msgid "You don't have permission to edit anything." msgid "You don't have permission to edit anything."
msgstr "Sie haben keine Berechtigung irgendwas zu ändern." msgstr "Sie haben keine Berechtigung irgendwas zu ändern."
#: conf/admin_templates/index.html.py:4 #: conf/admin_templates/index.html:50
msgid "Recent Actions" msgid "Recent Actions"
msgstr "Kürzliche Aktionen" msgstr "Kürzliche Aktionen"
#: conf/admin_templates/index.html.py:5 #: conf/admin_templates/index.html:51
msgid "My Actions" msgid "My Actions"
msgstr "Meine Aktionen" msgstr "Meine Aktionen"
#: conf/admin_templates/index.html.py:6 #: conf/admin_templates/index.html:55
msgid "None available" msgid "None available"
msgstr "Keine vorhanden" msgstr "Keine vorhanden"
#: conf/admin_templates/500.html.py:1 #: conf/admin_templates/500.html:5
msgid "Server error (500)" msgid "Server error (500)"
msgstr "Serverfehler (500)" msgstr "Serverfehler (500)"
#: conf/admin_templates/500.html.py:2 #: conf/admin_templates/500.html:8
msgid "Server Error <em>(500)</em>" msgid "Server Error <em>(500)</em>"
msgstr "Serverfehler <em>(500)</em>" msgstr "Serverfehler <em>(500)</em>"
#: conf/admin_templates/500.html.py:3 #: conf/admin_templates/500.html:9
msgid "" msgid ""
"There's been an error. It's been reported to the site administrators via e-" "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." "mail and should be fixed shortly. Thanks for your patience."
@ -103,16 +103,16 @@ msgstr ""
"eMail weitergegeben und sollte bald behoben sein. Vielen Dank für Ihr " "eMail weitergegeben und sollte bald behoben sein. Vielen Dank für Ihr "
"Verständnis." "Verständnis."
#: conf/admin_templates/404.html.py:1 conf/admin_templates/404.html.py:2 #: conf/admin_templates/404.html:3 conf/admin_templates/404.html.py:7
msgid "Page not found" msgid "Page not found"
msgstr "Seite nicht gefunden" msgstr "Seite nicht gefunden"
#: conf/admin_templates/404.html.py:3 #: conf/admin_templates/404.html:9
msgid "We're sorry, but the requested page could not be found." msgid "We're sorry, but the requested page could not be found."
msgstr "" msgstr ""
"Es tut uns leid, aber die angeforderte Seite kann nicht gefunden werden." "Es tut uns leid, aber die angeforderte Seite kann nicht gefunden werden."
#: conf/admin_templates/delete_confirmation_generic.html.py:1 #: conf/admin_templates/delete_confirmation_generic.html:6
#, python-format #, python-format
msgid "" msgid ""
"Deleting the %(object_name)s '%(object)s' would result in deleting related " "Deleting the %(object_name)s '%(object)s' would result in deleting related "
@ -123,7 +123,7 @@ msgstr ""
"abhängigen Daten zur Folge, aber Sie haben nicht die nötigen Rechte um die " "abhängigen Daten zur Folge, aber Sie haben nicht die nötigen Rechte um die "
"folgenden abhängigen Daten zu löschen:" "folgenden abhängigen Daten zu löschen:"
#: conf/admin_templates/delete_confirmation_generic.html.py:2 #: conf/admin_templates/delete_confirmation_generic.html:13
#, python-format #, python-format
msgid "" msgid ""
"Are you sure you want to delete the %(object_name)s \"%(object)s\"? All of " "Are you sure you want to delete the %(object_name)s \"%(object)s\"? All of "
@ -132,67 +132,62 @@ msgstr ""
"Sind Sie sicher, das Sie %(object_name)s \"%(object)s\" löschen wollen? Es " "Sind Sie sicher, das Sie %(object_name)s \"%(object)s\" löschen wollen? Es "
"werden zusätzlich die folgenden abhängigen Daten mit gelöscht:" "werden zusätzlich die folgenden abhängigen Daten mit gelöscht:"
#: conf/admin_templates/delete_confirmation_generic.html.py:3 #: conf/admin_templates/delete_confirmation_generic.html:17
msgid "Yes, I'm sure" msgid "Yes, I'm sure"
msgstr "Ja, ich bin sicher" msgstr "Ja, ich bin sicher"
#: conf/admin_templates/login.html.py:1 #: conf/admin_templates/login.html:14
msgid "Username:" msgid "Username:"
msgstr "Benutzername:" msgstr "Benutzername:"
#: conf/admin_templates/login.html.py:2 #: conf/admin_templates/login.html:17
msgid "Password:" msgid "Password:"
msgstr "Passwort:" msgstr "Passwort:"
#: conf/admin_templates/login.html.py:3 #: conf/admin_templates/login.html:19
msgid "Have you <a href=\"/password_reset/\">forgotten your password</a>?" msgid "Have you <a href=\"/password_reset/\">forgotten your password</a>?"
msgstr "Haben Sie <a href=\"/password_reset/\">ihr Passwort vergessen</a>?" msgstr "Haben Sie <a href=\"/password_reset/\">ihr Passwort vergessen</a>?"
#: conf/admin_templates/login.html.py:4 #: conf/admin_templates/login.html:23
msgid "Log in" msgid "Log in"
msgstr "Anmelden" msgstr "Anmelden"
#: conf/admin_templates/base.html.py:1 #: conf/admin_templates/base.html:22
msgid "Welcome," msgid "Welcome,"
msgstr "Willkommen," msgstr "Willkommen,"
#: conf/admin_templates/base.html.py:2 conf/admin_templates/base.html.py:5 #: conf/admin_templates/base.html:22
msgid "Change password" msgid "Change password"
msgstr "Passwort ändern" msgstr "Passwort ändern"
#: conf/admin_templates/base.html.py:3 conf/admin_templates/base.html.py:5 #: conf/admin_templates/base.html:22
msgid "Log out" msgid "Log out"
msgstr "Abmelden" msgstr "Abmelden"
#: conf/admin_templates/registration/password_change_done.html.py:2 #: conf/admin_templates/registration/password_change_done.html:3
#: conf/admin_templates/registration/password_change_done.html.py:6 #: conf/admin_templates/registration/password_change_form.html:3
#: conf/admin_templates/registration/password_change_form.html.py:2 #: conf/admin_templates/registration/password_change_form.html:5
#: conf/admin_templates/registration/password_change_form.html.py:3 #: conf/admin_templates/registration/password_change_form.html:9
#: conf/admin_templates/registration/password_change_form.html.py:4
#: conf/admin_templates/registration/password_change_form.html.py:10
msgid "Password change" msgid "Password change"
msgstr "Kennwort ändern" msgstr "Kennwort ändern"
#: conf/admin_templates/registration/password_change_done.html.py:3 #: conf/admin_templates/registration/password_change_done.html:5
#: conf/admin_templates/registration/password_change_done.html.py:4 #: conf/admin_templates/registration/password_change_done.html:9
msgid "Password change successful" msgid "Password change successful"
msgstr "Erfolgreiche Kennwortänderung" msgstr "Erfolgreiche Kennwortänderung"
#: conf/admin_templates/registration/password_change_done.html.py:5 #: conf/admin_templates/registration/password_change_done.html:11
msgid "Your password was changed." msgid "Your password was changed."
msgstr "Ihr Kennwort wurde geändert." msgstr "Ihr Kennwort wurde geändert."
#: conf/admin_templates/registration/password_reset_form.html.py:2 #: conf/admin_templates/registration/password_reset_form.html:3
#: conf/admin_templates/registration/password_reset_form.html.py:3 #: conf/admin_templates/registration/password_reset_form.html:5
#: conf/admin_templates/registration/password_reset_form.html.py:4 #: conf/admin_templates/registration/password_reset_form.html:9
#: conf/admin_templates/registration/password_reset_form.html.py:8 #: conf/admin_templates/registration/password_reset_done.html:3
#: conf/admin_templates/registration/password_reset_form.html.py:9
#: conf/admin_templates/registration/password_reset_done.html.py:2
#: conf/admin_templates/registration/password_reset_done.html.py:6
msgid "Password reset" msgid "Password reset"
msgstr "Kennwort zurücksetzen" msgstr "Kennwort zurücksetzen"
#: conf/admin_templates/registration/password_reset_form.html.py:5 #: conf/admin_templates/registration/password_reset_form.html:11
msgid "" msgid ""
"Forgotten your password? Enter your e-mail address below, and we'll reset " "Forgotten your password? Enter your e-mail address below, and we'll reset "
"your password and e-mail the new one to you." "your password and e-mail the new one to you."
@ -201,28 +196,28 @@ msgstr ""
"wir setzen das Kennwort auf einen neuen Wert und schicken den per eMail an " "wir setzen das Kennwort auf einen neuen Wert und schicken den per eMail an "
"Sie raus." "Sie raus."
#: conf/admin_templates/registration/password_reset_form.html.py:6 #: conf/admin_templates/registration/password_reset_form.html:15
msgid "E-mail address:" msgid "E-mail address:"
msgstr "eMail-Adresse:" msgstr "eMail-Adresse:"
#: conf/admin_templates/registration/password_reset_form.html.py:7 #: conf/admin_templates/registration/password_reset_form.html:15
msgid "Reset my password" msgid "Reset my password"
msgstr "Mein Kennwort zurücksetzen" msgstr "Mein Kennwort zurücksetzen"
#: conf/admin_templates/registration/logged_out.html.py:2 #: conf/admin_templates/registration/logged_out.html:7
msgid "Thanks for spending some quality time with the Web site today." msgid "Thanks for spending some quality time with the Web site today."
msgstr "Danke, dass Sie eine Weile bei uns waren." msgstr "Danke, dass Sie eine Weile bei uns waren."
#: conf/admin_templates/registration/logged_out.html.py:3 #: conf/admin_templates/registration/logged_out.html:9
msgid "Log in again" msgid "Log in again"
msgstr "Neu anmelden" msgstr "Neu anmelden"
#: conf/admin_templates/registration/password_reset_done.html.py:3 #: conf/admin_templates/registration/password_reset_done.html:5
#: conf/admin_templates/registration/password_reset_done.html.py:4 #: conf/admin_templates/registration/password_reset_done.html:9
msgid "Password reset successful" msgid "Password reset successful"
msgstr "Erfolgreich Kennwort zurückgesetzt" msgstr "Erfolgreich Kennwort zurückgesetzt"
#: conf/admin_templates/registration/password_reset_done.html.py:5 #: conf/admin_templates/registration/password_reset_done.html:11
msgid "" msgid ""
"We've e-mailed a new password to the e-mail address you submitted. You " "We've e-mailed a new password to the e-mail address you submitted. You "
"should be receiving it shortly." "should be receiving it shortly."
@ -230,7 +225,7 @@ msgstr ""
"Wir haben Ihnen ein neues Kennwort per eMail zugeschickt an die Adresse, die " "Wir haben Ihnen ein neues Kennwort per eMail zugeschickt an die Adresse, die "
"Sie uns gegeben haben. Es sollte in Kürze ankommen." "Sie uns gegeben haben. Es sollte in Kürze ankommen."
#: conf/admin_templates/registration/password_change_form.html.py:5 #: conf/admin_templates/registration/password_change_form.html:11
msgid "" msgid ""
"Please enter your old password, for security's sake, and then enter your new " "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." "password twice so we can verify you typed it in correctly."
@ -239,49 +234,49 @@ msgstr ""
"dann zweimal (um sicherzustellen, das Sie es korrekt eingegeben haben) das " "dann zweimal (um sicherzustellen, das Sie es korrekt eingegeben haben) das "
"neue Kennwort ein." "neue Kennwort ein."
#: conf/admin_templates/registration/password_change_form.html.py:6 #: conf/admin_templates/registration/password_change_form.html:16
msgid "Old password:" msgid "Old password:"
msgstr "altes Kennwort:" msgstr "altes Kennwort:"
#: conf/admin_templates/registration/password_change_form.html.py:7 #: conf/admin_templates/registration/password_change_form.html:18
msgid "New password:" msgid "New password:"
msgstr "neues Kennwort:" msgstr "neues Kennwort:"
#: conf/admin_templates/registration/password_change_form.html.py:8 #: conf/admin_templates/registration/password_change_form.html:20
msgid "Confirm password:" msgid "Confirm password:"
msgstr "Kennwortwiederholung:" msgstr "Kennwortwiederholung:"
#: conf/admin_templates/registration/password_change_form.html.py:9 #: conf/admin_templates/registration/password_change_form.html:22
msgid "Change my password" msgid "Change my password"
msgstr "Mein Kennwort ändern" msgstr "Mein Kennwort ändern"
#: conf/admin_templates/registration/password_reset_email.html.py:1 #: conf/admin_templates/registration/password_reset_email.html:1
msgid "You're receiving this e-mail because you requested a password reset" msgid "You're receiving this e-mail because you requested a password reset"
msgstr "Sie erhalten diese Mail, weil Sie ein neues Kennwort" msgstr "Sie erhalten diese Mail, weil Sie ein neues Kennwort"
#: conf/admin_templates/registration/password_reset_email.html.py:2 #: conf/admin_templates/registration/password_reset_email.html:2
#, python-format #, python-format
msgid "for your user account at %(site_name)s" msgid "for your user account at %(site_name)s"
msgstr "für ihren Benutzer bei %(site_name)s angefordert haben." msgstr "für ihren Benutzer bei %(site_name)s angefordert haben."
#: conf/admin_templates/registration/password_reset_email.html.py:3 #: conf/admin_templates/registration/password_reset_email.html:4
#, python-format #, python-format
msgid "Your new password is: %(new_password)s" msgid "Your new password is: %(new_password)s"
msgstr "Ihr neues Kennwort ist: %(new_password)s" msgstr "Ihr neues Kennwort ist: %(new_password)s"
#: conf/admin_templates/registration/password_reset_email.html.py:4 #: conf/admin_templates/registration/password_reset_email.html:6
msgid "Feel free to change this password by going to this page:" msgid "Feel free to change this password by going to this page:"
msgstr "Sie können das Kennwort auf folgender Seite ändern:" msgstr "Sie können das Kennwort auf folgender Seite ändern:"
#: conf/admin_templates/registration/password_reset_email.html.py:5 #: conf/admin_templates/registration/password_reset_email.html:10
msgid "Your username, in case you've forgotten:" msgid "Your username, in case you've forgotten:"
msgstr "Ihr Benutzername, falls Sie ihn vergessen haben:" msgstr "Ihr Benutzername, falls Sie ihn vergessen haben:"
#: conf/admin_templates/registration/password_reset_email.html.py:6 #: conf/admin_templates/registration/password_reset_email.html:12
msgid "Thanks for using our site!" msgid "Thanks for using our site!"
msgstr "Vielen Dank, das Sie unsere Seiten benutzen!" msgstr "Vielen Dank, das Sie unsere Seiten benutzen!"
#: conf/admin_templates/registration/password_reset_email.html.py:7 #: conf/admin_templates/registration/password_reset_email.html:14
#, python-format #, python-format
msgid "The %(site_name)s team" msgid "The %(site_name)s team"
msgstr "Das Team von %(site_name)s" msgstr "Das Team von %(site_name)s"