diff options
| author | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-01 16:47:15 +0000 |
|---|---|---|
| committer | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-01 16:47:15 +0000 |
| commit | 0649365f43fb71332e3f492f635dc8daa7b0bc8a (patch) | |
| tree | 2fbcdb067d2d07bdbbd9b1a40f8291a5b1cc0438 | |
| parent | bd9cb4c9f45ab6b26359cacc2dc6a44ec58f21ff (diff) | |
i18n: changed all admin templates to use the new shorter {{ _(..) }} syntax for i18n strings.
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@763 bcc190cf-cafb-0310-a4f2-bffc1f526a37
16 files changed, 69 insertions, 63 deletions
diff --git a/django/bin/make-messages.py b/django/bin/make-messages.py index d445335915..a97297c08b 100755 --- a/django/bin/make-messages.py +++ b/django/bin/make-messages.py @@ -39,7 +39,9 @@ if not os.path.isdir(basedir): lf = os.path.join(basedir, '%s.po' % domain) -tpl_re = re.compile(r'{%\s+i18n\s+.*?%}') +tpl_i18n_re = re.compile(r'{%\s+i18n\s+.*?%}') +tpl_value_re = re.compile(r'{{\s*_\(.*?\)\s*}}') +tpl_tag_re = re.compile(r"""{%.*_\((?:".*?")|(?:'.*?')\).*%}""") for (dirpath, dirnames, filenames) in os.walk("."): for file in filenames: @@ -48,7 +50,11 @@ for (dirpath, dirnames, filenames) in os.walk("."): if file.endswith('.html'): src = open(os.path.join(dirpath, file), "rb").read() lst = [] - for match in tpl_re.findall(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 diff --git a/django/conf/admin_templates/404.html b/django/conf/admin_templates/404.html index ac70bf27b9..ebe5da57ed 100644 --- a/django/conf/admin_templates/404.html +++ b/django/conf/admin_templates/404.html @@ -1,11 +1,11 @@ {% extends "base_site" %} -{% block title %}{% i18n _('Page not found') %}{% endblock %} +{% block title %}{{ _('Page not found') }}{% endblock %} {% block content %} -<h2>{% i18n _('Page not found') %}</h2> +<h2>{{ _('Page not found') }}</h2> -<p>{% i18n _("We're sorry, but the requested page could not be found.") %}</p> +<p>{{ _("We're sorry, but the requested page could not be found.") }}</p> {% endblock %} diff --git a/django/conf/admin_templates/500.html b/django/conf/admin_templates/500.html index 0bb6e5eed2..854d6e50fa 100644 --- a/django/conf/admin_templates/500.html +++ b/django/conf/admin_templates/500.html @@ -2,10 +2,10 @@ {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">Home</a> › Server error</div>{% endblock %} -{% block title %}{% i18n _('Server error (500)') %}{% endblock %} +{% block title %}{{ _('Server error (500)') }}{% endblock %} {% block content %} -<h1>{% i18n _('Server Error <em>(500)</em>') %}</h1> -<p>{% i18n _("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.") %}</p> +<h1>{{ _('Server Error <em>(500)</em>') }}</h1> +<p>{{ _("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.") }}</p> {% endblock %} diff --git a/django/conf/admin_templates/admin_object_history.html b/django/conf/admin_templates/admin_object_history.html index 580d47760f..2a2e367489 100644 --- a/django/conf/admin_templates/admin_object_history.html +++ b/django/conf/admin_templates/admin_object_history.html @@ -1,7 +1,7 @@ {% extends "base_site" %} {% block breadcrumbs %} -<div class="breadcrumbs"><a href="../../../../">Home</a> › <a href="../../">{{ module_name }}</a> › <a href="../">{{ object|truncatewords:"18" }}</a> › History</div> +<div class="breadcrumbs"><a href="../../../../">{{ _('Home') }}</a> › <a href="../../">{{ module_name }}</a> › <a href="../">{{ object|truncatewords:"18" }}</a> › {{ _('History') }}</div> {% endblock %} {% block content %} @@ -14,9 +14,9 @@ <table id="change-history"> <thead> <tr> - <th>Date/time</th> - <th>User</th> - <th>Action</th> + <th>{{ _('Date/time') }}</th> + <th>{{ _('User') }}</th> + <th>{{ _('Action') }}</th> </tr> </thead> <tbody> @@ -32,7 +32,7 @@ {% else %} - <p>This object doesn't have a change history. It probably wasn't added via this admin site.</p> + <p>{{ _('This object doesn't have a change history. It probably wasn't added via this admin site.') }}</p> {% endif %} diff --git a/django/conf/admin_templates/base.html b/django/conf/admin_templates/base.html index 115e28a11b..b5e1256202 100644 --- a/django/conf/admin_templates/base.html +++ b/django/conf/admin_templates/base.html @@ -19,13 +19,13 @@ {% block branding %}{% endblock %} </div> {% if not user.is_anonymous %} - <div id="user-tools">{% i18n _('Welcome,') %} <strong>{% if user.first_name %}{{ user.first_name }}{% else %}{{ user.username }}{% endif %}</strong>. <br />{% block userlinks %}<a href="/admin/password_change/">{% i18n _('Change password') %}</a> / <a href="/admin/logout/">{% i18n _('Log out') %}</a>{% endblock %}</div> + <div id="user-tools">{{ _('Welcome,') }} <strong>{% if user.first_name %}{{ user.first_name }}{% else %}{{ user.username }}{% endif %}</strong>. <br />{% block userlinks %}<a href="/admin/password_change/">{{ _('Change password') }}</a> / <a href="/admin/logout/">{{ _('Log out') }}</a>{% endblock %}</div> {% endif %} {% block nav-global %}{% endblock %} <br class="clear" /> </div> <!-- END Header --> - {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% i18n _('Home') %}</a>{% if title %} › {{ title }}{% endif %}</div>{% endblock %} + {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{{ _('Home') }}</a>{% if title %} › {{ title }}{% endif %}</div>{% endblock %} {% endif %} {% if messages %} diff --git a/django/conf/admin_templates/base_site.html b/django/conf/admin_templates/base_site.html index bfbf9a2e34..8ca2400db0 100644 --- a/django/conf/admin_templates/base_site.html +++ b/django/conf/admin_templates/base_site.html @@ -1,9 +1,9 @@ {% extends "base" %} -{% block title %}{{ title }} | {% i18n _('Django site admin') %}{% endblock %} +{% block title %}{{ title }} | {{ _('Django site admin') }}{% endblock %} {% block branding %} -<h1 id="site-name">{% i18n _('Django administration') %}</h1> +<h1 id="site-name">{{ _('Django administration') }}</h1> <h2 id="site-url"><a href="http://www.example.com/">example.com</a></h2> {% endblock %} diff --git a/django/conf/admin_templates/changelist_generic.html b/django/conf/admin_templates/changelist_generic.html index ab8e449373..aac479a6a9 100644 --- a/django/conf/admin_templates/changelist_generic.html +++ b/django/conf/admin_templates/changelist_generic.html @@ -5,7 +5,7 @@ {% block content %} {% if not hide_add_link %} -<ul class="object-tools"><li><a href="/{{ admin_url }}/add/" class="addlink">{% i18n _('Add') %} {{ object_name }}</a></li></ul> +<ul class="object-tools"><li><a href="/{{ admin_url }}/add/" class="addlink">{{ _('Add') }} {{ object_name }}</a></li></ul> {% endif %} <div id="content-main"> @@ -23,7 +23,7 @@ {% if changelist %} <ul class="changelist"> {% for obj in changelist %} - <li class="{% cycle row1,row2 %}"><a href="/{{ admin_url }}/change/{{ obj.id }}/" title="{% i18n _('Click to change') %}">{{ obj|striptags|escape }}</a></li> + <li class="{% cycle row1,row2 %}"><a href="/{{ admin_url }}/change/{{ obj.id }}/" title="{{ _('Click to change') }}">{{ obj|striptags|escape }}</a></li> {% endfor %} </ul> {% endif %} diff --git a/django/conf/admin_templates/delete_confirmation_generic.html b/django/conf/admin_templates/delete_confirmation_generic.html index a41c3764c1..6c435c2409 100644 --- a/django/conf/admin_templates/delete_confirmation_generic.html +++ b/django/conf/admin_templates/delete_confirmation_generic.html @@ -3,18 +3,18 @@ {% block content %} {% if perms_lacking %} - <p>{% i18n _("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:") %}</p> + <p>{{ _("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:") }}</p> <ul> {% for obj in perms_lacking %} <li>{{ obj }}</li> {% endfor %} </ul> {% else %} - <p>{% i18n _('Are you sure you want to delete the %(object_name)s "%(object)s"? All of the following related items will be deleted:') %}</p> + <p>{{ _('Are you sure you want to delete the %(object_name)s "%(object)s"? All of the following related items will be deleted:') }}</p> <ul>{{ deleted_objects|unordered_list }}</ul> <form action="" method="post"> <input type="hidden" name="post" value="yes" /> - <input type="submit" value="{% i18n _("Yes, I'm sure") %}" /> + <input type="submit" value="{{ _("Yes, I'm sure") }}" /> </form> {% endif %} diff --git a/django/conf/admin_templates/index.html b/django/conf/admin_templates/index.html index 48bd5d91c1..6f1bd70e8f 100644 --- a/django/conf/admin_templates/index.html +++ b/django/conf/admin_templates/index.html @@ -23,13 +23,13 @@ {% endif %} {% if model.perms.add %} - <td class="x50"><a href="{{ model.admin_url }}add/" class="addlink">{% i18n _('Add') %}</a></td> + <td class="x50"><a href="{{ model.admin_url }}add/" class="addlink">{{ _('Add') }}</a></td> {% else %} <td class="x50"> </td> {% endif %} {% if model.perms.change %} - <td class="x75"><a href="{{ model.admin_url }}" class="changelink">{% i18n _('Change') %}</a></td> + <td class="x75"><a href="{{ model.admin_url }}" class="changelink">{{ _('Change') }}</a></td> {% else %} <td class="x75"> </td> {% endif %} @@ -39,7 +39,7 @@ </div> {% endfor %} {% else %} - <p>{% i18n _("You don't have permission to edit anything.") %}</p> + <p>{{ _("You don't have permission to edit anything.") }}</p> {% endif %} </div> {% endblock %} @@ -47,12 +47,12 @@ {% block sidebar %} <div id="content-related"> <div class="module" id="recent-actions-module"> - <h2>{% i18n _('Recent Actions') %}</h2> - <h3>{% i18n _('My Actions') %}</h3> + <h2>{{ _('Recent Actions') }}</h2> + <h3>{{ _('My Actions') }}</h3> {% load auth.log %} {% get_admin_log 10 as admin_log for_user user %} {% if not admin_log %} - <p>{% i18n _('None available') %}</p> + <p>{{ _('None available') }}</p> {% else %} <ul class="actionlist"> {% for entry in admin_log %} diff --git a/django/conf/admin_templates/login.html b/django/conf/admin_templates/login.html index 47a5e05750..b1c6e2a8bb 100644 --- a/django/conf/admin_templates/login.html +++ b/django/conf/admin_templates/login.html @@ -11,16 +11,16 @@ <form action="{{ app_path }}" method="post"> <p class="aligned"> -<label for="id_username">{% i18n _('Username:') %}</label> <input type="text" name="username" id="id_username" /> +<label for="id_username">{{ _('Username:') }}</label> <input type="text" name="username" id="id_username" /> </p> <p class="aligned"> -<label for="id_password">{% i18n _('Password:') %}</label> <input type="password" name="password" id="id_password" /> +<label for="id_password">{{ _('Password:') }}</label> <input type="password" name="password" id="id_password" /> <input type="hidden" name="this_is_the_login_form" value="1" /> -<input type="hidden" name="post_data" value="{{ post_data }}" />{% comment %} <span class="help">{% i18n _('Have you <a href="/password_reset/">forgotten your password</a>?') %}</span>{% endcomment %} +<input type="hidden" name="post_data" value="{{ post_data }}" />{% comment %} <span class="help">{{ _('Have you <a href="/password_reset/">forgotten your password</a>?') }}</span>{% endcomment %} </p> <div class="aligned "> -<label> </label><input type="submit" value="{% i18n _('Log in') %}" /> +<label> </label><input type="submit" value="{{ _('Log in') }}" /> </div> </form> diff --git a/django/conf/admin_templates/registration/logged_out.html b/django/conf/admin_templates/registration/logged_out.html index 404b8c37fc..25e4d9fbae 100644 --- a/django/conf/admin_templates/registration/logged_out.html +++ b/django/conf/admin_templates/registration/logged_out.html @@ -1,11 +1,11 @@ {% extends "base_site" %} -{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a></div>{% endblock %} +{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a></div>{% endblock %} {% block content %} -<p>{% i18n _("Thanks for spending some quality time with the Web site today.") %}</p> +<p>{{ _("Thanks for spending some quality time with the Web site today.") }}</p> -<p><a href="../">{% i18n _('Log in again') %}</a></p> +<p><a href="../">{{ _('Log in again') }}</a></p> {% endblock %} diff --git a/django/conf/admin_templates/registration/password_change_done.html b/django/conf/admin_templates/registration/password_change_done.html index f5242c7076..5859965abd 100644 --- a/django/conf/admin_templates/registration/password_change_done.html +++ b/django/conf/admin_templates/registration/password_change_done.html @@ -1,13 +1,13 @@ {% extends "base_site" %} -{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> › {% i18n _('Password change') %}</div>{% endblock %} +{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> › {{ _('Password change') }}</div>{% endblock %} -{% block title %}{% i18n _('Password change successful') %}{% endblock %} +{% block title %}{{ _('Password change successful') }}{% endblock %} {% block content %} -<h1>{% i18n _('Password change successful') %}</h1> +<h1>{{ _('Password change successful') }}</h1> -<p>{% i18n _('Your password was changed.') %}</p> +<p>{{ _('Your password was changed.') }}</p> {% endblock %} diff --git a/django/conf/admin_templates/registration/password_change_form.html b/django/conf/admin_templates/registration/password_change_form.html index f0b8c3bf41..9d00a17e02 100644 --- a/django/conf/admin_templates/registration/password_change_form.html +++ b/django/conf/admin_templates/registration/password_change_form.html @@ -1,25 +1,25 @@ {% extends "base_site" %} -{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> › {% i18n _('Password change') %}</div>{% endblock %} +{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> › {{ _('Password change') }}</div>{% endblock %} -{% block title %}{% i18n _('Password change') %}{% endblock %} +{% block title %}{{ _('Password change') }}{% endblock %} {% block content %} -<h1>{% i18n _('Password change') %}</h1> +<h1>{{ _('Password change') }}</h1> -<p>{% i18n _("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.") %}</p> +<p>{{ _("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.") }}</p> <form action="" method="post"> {% if form.old_password.errors %}{{ form.old_password.html_error_list }}{% endif %} -<p class="aligned wide"><label for="id_old_password">{% i18n _('Old password:') %}</label>{{ form.old_password }}</p> +<p class="aligned wide"><label for="id_old_password">{{ _('Old password:') }}</label>{{ form.old_password }}</p> {% if form.new_password1.errors %}{{ form.new_password1.html_error_list }}{% endif %} -<p class="aligned wide"><label for="id_new_password1">{% i18n _('New password:') %}</label>{{ form.new_password1 }}</p> +<p class="aligned wide"><label for="id_new_password1">{{ _('New password:') }}</label>{{ form.new_password1 }}</p> {% if form.new_password2.errors %}{{ form.new_password2.html_error_list }}{% endif %} -<p class="aligned wide"><label for="id_new_password2">{% i18n _('Confirm password:') %}</label>{{ form.new_password2 }}</p> +<p class="aligned wide"><label for="id_new_password2">{{ _('Confirm password:') }}</label>{{ form.new_password2 }}</p> -<p><input type="submit" value="{% i18n _('Change my password') %}" /></p> +<p><input type="submit" value="{{ _('Change my password') }}" /></p> </form> {% endblock %} diff --git a/django/conf/admin_templates/registration/password_reset_done.html b/django/conf/admin_templates/registration/password_reset_done.html index 625ed0c833..51e3668526 100644 --- a/django/conf/admin_templates/registration/password_reset_done.html +++ b/django/conf/admin_templates/registration/password_reset_done.html @@ -1,13 +1,13 @@ {% extends "base_site" %} -{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> › {% i18n _('Password reset') %}</div>{% endblock %} +{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> › {{ _('Password reset') }}</div>{% endblock %} -{% block title %}{% i18n _('Password reset successful') %}{% endblock %} +{% block title %}{{ _('Password reset successful') }}{% endblock %} {% block content %} -<h1>{% i18n _('Password reset successful') %}</h1> +<h1>{{ _('Password reset successful') }}</h1> -<p>{% i18n _("We've e-mailed a new password to the e-mail address you submitted. You should be receiving it shortly.") %}</p> +<p>{{ _("We've e-mailed a new password to the e-mail address you submitted. You should be receiving it shortly.") }}</p> {% endblock %} diff --git a/django/conf/admin_templates/registration/password_reset_email.html b/django/conf/admin_templates/registration/password_reset_email.html index f707fbb279..08ca2c142d 100644 --- a/django/conf/admin_templates/registration/password_reset_email.html +++ b/django/conf/admin_templates/registration/password_reset_email.html @@ -1,14 +1,14 @@ -{% i18n _("You're receiving this e-mail because you requested a password reset") %} -{% i18n _("for your user account at %(site_name)s") %}. +{{ _("You're receiving this e-mail because you requested a password reset") }} +{{ _("for your user account at %(site_name)s") }}. -{% i18n _("Your new password is: %(new_password)s") %} +{{ _("Your new password is: %(new_password)s") }} -{% i18n _("Feel free to change this password by going to this page:") %} +{{ _("Feel free to change this password by going to this page:") }} http://{{ domain }}/password_change/ -{% i18n _("Your username, in case you've forgotten:") %} {{ user.username }} +{{ _("Your username, in case you've forgotten:") }} {{ user.username }} -{% i18n _("Thanks for using our site!") %} +{{ _("Thanks for using our site!") }} -{% i18n _("The %(site_name)s team") %} +{{ _("The %(site_name)s team") }} diff --git a/django/conf/admin_templates/registration/password_reset_form.html b/django/conf/admin_templates/registration/password_reset_form.html index 3c378def29..116f9f5bbb 100644 --- a/django/conf/admin_templates/registration/password_reset_form.html +++ b/django/conf/admin_templates/registration/password_reset_form.html @@ -1,18 +1,18 @@ {% extends "base_site" %} -{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> › {% i18n _('Password reset') %}</div>{% endblock %} +{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> › {{ _('Password reset') }}</div>{% endblock %} -{% block title %}{% i18n _("Password reset") %}{% endblock %} +{% block title %}{{ _("Password reset") }}{% endblock %} {% block content %} -<h1>{% i18n _("Password reset") %}</h1> +<h1>{{ _("Password reset") }}</h1> -<p>{% i18n _("Forgotten your password? Enter your e-mail address below, and we'll reset your password and e-mail the new one to you.") %}</p> +<p>{{ _("Forgotten your password? Enter your e-mail address below, and we'll reset your password and e-mail the new one to you.") }}</p> <form action="" method="post"> {% if form.email.errors %}{{ form.email.html_error_list }}{% endif %} -<p><label for="id_email">{% i18n _('E-mail address:') %}</label> {{ form.email }} <input type="submit" value="{% i18n _('Reset my password') %}" /></p> +<p><label for="id_email">{{ _('E-mail address:') }}</label> {{ form.email }} <input type="submit" value="{{ _('Reset my password') }}" /></p> </form> {% endblock %} |
