From 4fc6d40d00586610ffabc8bf18b8e62fa12ed9bf Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Sat, 8 Oct 2005 00:01:25 +0000 Subject: [PATCH] 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 --- django/bin/make-messages.py | 38 ++++-- django/conf/locale/de/LC_MESSAGES/django.po | 143 ++++++++++---------- 2 files changed, 96 insertions(+), 85 deletions(-) diff --git a/django/bin/make-messages.py b/django/bin/make-messages.py index 6b72e04211..d7d32071f9 100755 --- a/django/bin/make-messages.py +++ b/django/bin/make-messages.py @@ -37,9 +37,28 @@ basedir = os.path.join(basedir, lang, 'LC_MESSAGES') if not os.path.isdir(basedir): os.makedirs(basedir) -tpl_i18n_re = re.compile(r'{%\s+i18n\s+.*?%}') -tpl_value_re = re.compile(r'{{\s*_\(.*?\)\s*}}') -tpl_tag_re = re.compile(r"""{%.*_\((?:".*?")|(?:'.*?')\).*%}""") +dot_re = re.compile('\S') +def blank(src): + 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) potfile = os.path.join(basedir, '%s.pot' % domain) @@ -53,19 +72,16 @@ for (dirpath, dirnames, filenames) in os.walk("."): thefile = file if file.endswith('.html'): src = open(os.path.join(dirpath, file), "rb").read() - lst = [] - 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)) + 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 -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: diff --git a/django/conf/locale/de/LC_MESSAGES/django.po b/django/conf/locale/de/LC_MESSAGES/django.po index a2f7b11b74..f363ea28a3 100644 --- a/django/conf/locale/de/LC_MESSAGES/django.po +++ b/django/conf/locale/de/LC_MESSAGES/django.po @@ -8,40 +8,40 @@ msgid "" msgstr "" "Project-Id-Version: Django 1.0\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" "Last-Translator: Georg Bauer \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=iso-8859-1\n" "Content-Transfer-Encoding: 8bit\n" -#: conf/admin_templates/admin_object_history.html.py:1 -#: conf/admin_templates/base.html.py:4 -#: conf/admin_templates/registration/password_change_done.html.py:1 -#: conf/admin_templates/registration/password_reset_form.html.py:1 -#: conf/admin_templates/registration/logged_out.html.py:1 -#: conf/admin_templates/registration/password_reset_done.html.py:1 -#: conf/admin_templates/registration/password_change_form.html.py:1 +#: conf/admin_templates/admin_object_history.html:4 +#: conf/admin_templates/base.html:28 +#: conf/admin_templates/registration/password_change_done.html:3 +#: conf/admin_templates/registration/password_reset_form.html:3 +#: conf/admin_templates/registration/logged_out.html:3 +#: conf/admin_templates/registration/password_reset_done.html:3 +#: conf/admin_templates/registration/password_change_form.html:3 msgid "Home" msgstr "Start" -#: conf/admin_templates/admin_object_history.html.py:2 +#: conf/admin_templates/admin_object_history.html:4 msgid "History" msgstr "Geschichte" -#: conf/admin_templates/admin_object_history.html.py:3 +#: conf/admin_templates/admin_object_history.html:17 msgid "Date/time" msgstr "Datum/Zeit" -#: conf/admin_templates/admin_object_history.html.py:4 +#: conf/admin_templates/admin_object_history.html:18 msgid "User" msgstr "Benutzer" -#: conf/admin_templates/admin_object_history.html.py:5 +#: conf/admin_templates/admin_object_history.html:19 msgid "Action" msgstr "Aktion" -#: conf/admin_templates/admin_object_history.html.py:6 +#: conf/admin_templates/admin_object_history.html:35 msgid "" "This object doesn't have a change history. It probably wasn't added via this " "admin site." @@ -49,52 +49,52 @@ msgstr "" "Dieses Objekt hat keine Änderungsgeschichte. Es wurde möglicherweise nicht " "über diese Verwaltungsseiten angelegt." -#: conf/admin_templates/changelist_generic.html.py:1 -#: conf/admin_templates/index.html.py:1 +#: conf/admin_templates/changelist_generic.html:8 +#: conf/admin_templates/index.html:26 msgid "Add" msgstr "Zufügen" -#: conf/admin_templates/changelist_generic.html.py:2 +#: conf/admin_templates/changelist_generic.html:26 msgid "Click to change" msgstr "Zur Änderung klicken" -#: conf/admin_templates/base_site.html.py:1 +#: conf/admin_templates/base_site.html:3 msgid "Django site admin" msgstr "Django Systemverwaltung" -#: conf/admin_templates/base_site.html.py:2 +#: conf/admin_templates/base_site.html:6 msgid "Django administration" msgstr "Django Verwaltung" -#: conf/admin_templates/index.html.py:2 +#: conf/admin_templates/index.html:32 msgid "Change" msgstr "Ändern" -#: conf/admin_templates/index.html.py:3 +#: conf/admin_templates/index.html:42 msgid "You don't have permission to edit anything." msgstr "Sie haben keine Berechtigung irgendwas zu ändern." -#: conf/admin_templates/index.html.py:4 +#: conf/admin_templates/index.html:50 msgid "Recent Actions" msgstr "Kürzliche Aktionen" -#: conf/admin_templates/index.html.py:5 +#: conf/admin_templates/index.html:51 msgid "My Actions" msgstr "Meine Aktionen" -#: conf/admin_templates/index.html.py:6 +#: conf/admin_templates/index.html:55 msgid "None available" msgstr "Keine vorhanden" -#: conf/admin_templates/500.html.py:1 +#: conf/admin_templates/500.html:5 msgid "Server error (500)" msgstr "Serverfehler (500)" -#: conf/admin_templates/500.html.py:2 +#: conf/admin_templates/500.html:8 msgid "Server Error (500)" msgstr "Serverfehler (500)" -#: conf/admin_templates/500.html.py:3 +#: conf/admin_templates/500.html:9 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." @@ -103,16 +103,16 @@ msgstr "" "eMail weitergegeben und sollte bald behoben sein. Vielen Dank für Ihr " "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" 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." msgstr "" "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 msgid "" "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 " "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 msgid "" "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 " "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" msgstr "Ja, ich bin sicher" -#: conf/admin_templates/login.html.py:1 +#: conf/admin_templates/login.html:14 msgid "Username:" msgstr "Benutzername:" -#: conf/admin_templates/login.html.py:2 +#: conf/admin_templates/login.html:17 msgid "Password:" msgstr "Passwort:" -#: conf/admin_templates/login.html.py:3 +#: conf/admin_templates/login.html:19 msgid "Have you forgotten your password?" msgstr "Haben Sie ihr Passwort vergessen?" -#: conf/admin_templates/login.html.py:4 +#: conf/admin_templates/login.html:23 msgid "Log in" msgstr "Anmelden" -#: conf/admin_templates/base.html.py:1 +#: conf/admin_templates/base.html:22 msgid "Welcome," 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" 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" msgstr "Abmelden" -#: 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 +#: conf/admin_templates/registration/password_change_done.html:3 +#: conf/admin_templates/registration/password_change_form.html:3 +#: conf/admin_templates/registration/password_change_form.html:5 +#: conf/admin_templates/registration/password_change_form.html:9 msgid "Password change" msgstr "Kennwort ändern" -#: conf/admin_templates/registration/password_change_done.html.py:3 -#: conf/admin_templates/registration/password_change_done.html.py:4 +#: conf/admin_templates/registration/password_change_done.html:5 +#: conf/admin_templates/registration/password_change_done.html:9 msgid "Password change successful" 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." msgstr "Ihr Kennwort wurde geändert." -#: 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 -#: 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:3 +#: conf/admin_templates/registration/password_reset_form.html:5 +#: conf/admin_templates/registration/password_reset_form.html:9 +#: conf/admin_templates/registration/password_reset_done.html:3 msgid "Password reset" msgstr "Kennwort zurücksetzen" -#: conf/admin_templates/registration/password_reset_form.html.py:5 +#: conf/admin_templates/registration/password_reset_form.html:11 msgid "" "Forgotten your password? Enter your e-mail address below, and we'll reset " "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 " "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:" 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" 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." 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" msgstr "Neu anmelden" -#: conf/admin_templates/registration/password_reset_done.html.py:3 -#: conf/admin_templates/registration/password_reset_done.html.py:4 +#: conf/admin_templates/registration/password_reset_done.html:5 +#: conf/admin_templates/registration/password_reset_done.html:9 msgid "Password reset successful" 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 "" "We've e-mailed a new password to the e-mail address you submitted. You " "should be receiving it shortly." @@ -230,7 +225,7 @@ msgstr "" "Wir haben Ihnen ein neues Kennwort per eMail zugeschickt an die Adresse, die " "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 "" "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." @@ -239,49 +234,49 @@ msgstr "" "dann zweimal (um sicherzustellen, das Sie es korrekt eingegeben haben) das " "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:" 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:" 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:" 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" 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" 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 msgid "for your user account at %(site_name)s" 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 msgid "Your new password is: %(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:" 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:" 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!" 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 msgid "The %(site_name)s team" msgstr "Das Team von %(site_name)s"