1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

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
This commit is contained in:
Georg Bauer 2005-10-01 16:47:15 +00:00
parent bd9cb4c9f4
commit 0649365f43
16 changed files with 69 additions and 63 deletions

View File

@ -39,7 +39,9 @@ if not os.path.isdir(basedir):
lf = os.path.join(basedir, '%s.po' % domain) 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 (dirpath, dirnames, filenames) in os.walk("."):
for file in filenames: for file in filenames:
@ -48,7 +50,11 @@ for (dirpath, dirnames, filenames) in os.walk("."):
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 = [] 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) 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('\n'.join(lst))
thefile = '%s.py' % file thefile = '%s.py' % file

View File

@ -1,11 +1,11 @@
{% extends "base_site" %} {% extends "base_site" %}
{% block title %}{% i18n _('Page not found') %}{% endblock %} {% block title %}{{ _('Page not found') }}{% endblock %}
{% block content %} {% 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 %} {% endblock %}

View File

@ -2,10 +2,10 @@
{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; Server error</div>{% endblock %} {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; Server error</div>{% endblock %}
{% block title %}{% i18n _('Server error (500)') %}{% endblock %} {% block title %}{{ _('Server error (500)') }}{% endblock %}
{% block content %} {% block content %}
<h1>{% i18n _('Server Error <em>(500)</em>') %}</h1> <h1>{{ _('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> <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 %} {% endblock %}

View File

@ -1,7 +1,7 @@
{% extends "base_site" %} {% extends "base_site" %}
{% block breadcrumbs %} {% block breadcrumbs %}
<div class="breadcrumbs"><a href="../../../../">Home</a> &rsaquo; <a href="../../">{{ module_name }}</a> &rsaquo; <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo; History</div> <div class="breadcrumbs"><a href="../../../../">{{ _('Home') }}</a> &rsaquo; <a href="../../">{{ module_name }}</a> &rsaquo; <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo; {{ _('History') }}</div>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -14,9 +14,9 @@
<table id="change-history"> <table id="change-history">
<thead> <thead>
<tr> <tr>
<th>Date/time</th> <th>{{ _('Date/time') }}</th>
<th>User</th> <th>{{ _('User') }}</th>
<th>Action</th> <th>{{ _('Action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -32,7 +32,7 @@
{% else %} {% 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 %} {% endif %}

View File

@ -19,13 +19,13 @@
{% block branding %}{% endblock %} {% block branding %}{% endblock %}
</div> </div>
{% if not user.is_anonymous %} {% 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 %} {% endif %}
{% block nav-global %}{% endblock %} {% block nav-global %}{% endblock %}
<br class="clear" /> <br class="clear" />
</div> </div>
<!-- END Header --> <!-- END Header -->
{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% i18n _('Home') %}</a>{% if title %} &rsaquo; {{ title }}{% endif %}</div>{% endblock %} {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{{ _('Home') }}</a>{% if title %} &rsaquo; {{ title }}{% endif %}</div>{% endblock %}
{% endif %} {% endif %}
{% if messages %} {% if messages %}

View File

@ -1,9 +1,9 @@
{% extends "base" %} {% extends "base" %}
{% block title %}{{ title }} | {% i18n _('Django site admin') %}{% endblock %} {% block title %}{{ title }} | {{ _('Django site admin') }}{% endblock %}
{% block branding %} {% 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> <h2 id="site-url"><a href="http://www.example.com/">example.com</a></h2>
{% endblock %} {% endblock %}

View File

@ -5,7 +5,7 @@
{% block content %} {% block content %}
{% if not hide_add_link %} {% 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 %} {% endif %}
<div id="content-main"> <div id="content-main">
@ -23,7 +23,7 @@
{% if changelist %} {% if changelist %}
<ul class="changelist"> <ul class="changelist">
{% for obj in 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 %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}

View File

@ -3,18 +3,18 @@
{% block content %} {% block content %}
{% if perms_lacking %} {% 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> <ul>
{% for obj in perms_lacking %} {% for obj in perms_lacking %}
<li>{{ obj }}</li> <li>{{ obj }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% else %} {% 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> <ul>{{ deleted_objects|unordered_list }}</ul>
<form action="" method="post"> <form action="" method="post">
<input type="hidden" name="post" value="yes" /> <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> </form>
{% endif %} {% endif %}

View File

@ -23,13 +23,13 @@
{% endif %} {% endif %}
{% if model.perms.add %} {% 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 %} {% else %}
<td class="x50">&nbsp;</td> <td class="x50">&nbsp;</td>
{% endif %} {% endif %}
{% if model.perms.change %} {% 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 %} {% else %}
<td class="x75">&nbsp;</td> <td class="x75">&nbsp;</td>
{% endif %} {% endif %}
@ -39,7 +39,7 @@
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<p>{% i18n _("You don't have permission to edit anything.") %}</p> <p>{{ _("You don't have permission to edit anything.") }}</p>
{% endif %} {% endif %}
</div> </div>
{% endblock %} {% endblock %}
@ -47,12 +47,12 @@
{% block sidebar %} {% block sidebar %}
<div id="content-related"> <div id="content-related">
<div class="module" id="recent-actions-module"> <div class="module" id="recent-actions-module">
<h2>{% i18n _('Recent Actions') %}</h2> <h2>{{ _('Recent Actions') }}</h2>
<h3>{% i18n _('My Actions') %}</h3> <h3>{{ _('My Actions') }}</h3>
{% load auth.log %} {% load auth.log %}
{% get_admin_log 10 as admin_log for_user user %} {% get_admin_log 10 as admin_log for_user user %}
{% if not admin_log %} {% if not admin_log %}
<p>{% i18n _('None available') %}</p> <p>{{ _('None available') }}</p>
{% else %} {% else %}
<ul class="actionlist"> <ul class="actionlist">
{% for entry in admin_log %} {% for entry in admin_log %}

View File

@ -11,16 +11,16 @@
<form action="{{ app_path }}" method="post"> <form action="{{ app_path }}" method="post">
<p class="aligned"> <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>
<p class="aligned"> <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="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> </p>
<div class="aligned "> <div class="aligned ">
<label>&nbsp;</label><input type="submit" value="{% i18n _('Log in') %}" /> <label>&nbsp;</label><input type="submit" value="{{ _('Log in') }}" />
</div> </div>
</form> </form>

View File

@ -1,11 +1,11 @@
{% extends "base_site" %} {% 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 %} {% 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 %} {% endblock %}

View File

@ -1,13 +1,13 @@
{% extends "base_site" %} {% extends "base_site" %}
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> &rsaquo; {% i18n _('Password change') %}</div>{% endblock %} {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> &rsaquo; {{ _('Password change') }}</div>{% endblock %}
{% block title %}{% i18n _('Password change successful') %}{% endblock %} {% block title %}{{ _('Password change successful') }}{% endblock %}
{% block content %} {% 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 %} {% endblock %}

View File

@ -1,25 +1,25 @@
{% extends "base_site" %} {% extends "base_site" %}
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> &rsaquo; {% i18n _('Password change') %}</div>{% endblock %} {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> &rsaquo; {{ _('Password change') }}</div>{% endblock %}
{% block title %}{% i18n _('Password change') %}{% endblock %} {% block title %}{{ _('Password change') }}{% endblock %}
{% block content %} {% 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"> <form action="" method="post">
{% if form.old_password.errors %}{{ form.old_password.html_error_list }}{% endif %} {% 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 %} {% 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 %} {% 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> </form>
{% endblock %} {% endblock %}

View File

@ -1,13 +1,13 @@
{% extends "base_site" %} {% extends "base_site" %}
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> &rsaquo; {% i18n _('Password reset') %}</div>{% endblock %} {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> &rsaquo; {{ _('Password reset') }}</div>{% endblock %}
{% block title %}{% i18n _('Password reset successful') %}{% endblock %} {% block title %}{{ _('Password reset successful') }}{% endblock %}
{% block content %} {% 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 %} {% endblock %}

View File

@ -1,14 +1,14 @@
{% i18n _("You're receiving this e-mail because you requested a password reset") %} {{ _("You're receiving this e-mail because you requested a password reset") }}
{% i18n _("for your user account at %(site_name)s") %}. {{ _("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/ 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") }}

View File

@ -1,18 +1,18 @@
{% extends "base_site" %} {% extends "base_site" %}
{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> &rsaquo; {% i18n _('Password reset') %}</div>{% endblock %} {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> &rsaquo; {{ _('Password reset') }}</div>{% endblock %}
{% block title %}{% i18n _("Password reset") %}{% endblock %} {% block title %}{{ _("Password reset") }}{% endblock %}
{% block content %} {% 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"> <form action="" method="post">
{% if form.email.errors %}{{ form.email.html_error_list }}{% endif %} {% 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> </form>
{% endblock %} {% endblock %}