Django

Code

Changeset 763

Show
Ignore:
Timestamp:
10/01/05 11:47:15 (3 years ago)
Author:
hugo
Message:

i18n: changed all admin templates to use the new shorter {{ _(..) }} syntax for i18n strings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/i18n/django/bin/make-messages.py

    r729 r763  
    4040lf = os.path.join(basedir, '%s.po' % domain) 
    4141 
    42 tpl_re = re.compile(r'{%\s+i18n\s+.*?%}') 
     42tpl_i18n_re = re.compile(r'{%\s+i18n\s+.*?%}') 
     43tpl_value_re = re.compile(r'{{\s*_\(.*?\)\s*}}') 
     44tpl_tag_re = re.compile(r"""{%.*_\((?:".*?")|(?:'.*?')\).*%}""") 
    4345 
    4446for (dirpath, dirnames, filenames) in os.walk("."): 
     
    4951                src = open(os.path.join(dirpath, file), "rb").read() 
    5052                lst = [] 
    51                 for match in tpl_re.findall(src): 
     53                for match in tpl_i18n_re.findall(src): 
     54                   lst.append(match) 
     55                for match in tpl_value_re.findall(src): 
     56                   lst.append(match) 
     57                for match in tpl_tag_re.findall(src): 
    5258                   lst.append(match) 
    5359                open(os.path.join(dirpath, '%s.py' % file), "wb").write('\n'.join(lst)) 
  • django/branches/i18n/django/conf/admin_templates/404.html

    r730 r763  
    11{% extends "base_site" %} 
    22 
    3 {% block title %}{% i18n _('Page not found') %}{% endblock %} 
     3{% block title %}{{ _('Page not found') }}{% endblock %} 
    44 
    55{% block content %} 
    66 
    7 <h2>{% i18n _('Page not found') %}</h2> 
     7<h2>{{ _('Page not found') }}</h2> 
    88 
    9 <p>{% i18n _("We're sorry, but the requested page could not be found.") %}</p> 
     9<p>{{ _("We're sorry, but the requested page could not be found.") }}</p> 
    1010 
    1111{% endblock %} 
  • django/branches/i18n/django/conf/admin_templates/500.html

    r730 r763  
    33{% block breadcrumbs %}<div class="breadcrumbs"><a href="/">Home</a> &rsaquo; Server error</div>{% endblock %} 
    44 
    5 {% block title %}{% i18n _('Server error (500)') %}{% endblock %} 
     5{% block title %}{{ _('Server error (500)') }}{% endblock %} 
    66 
    77{% block content %} 
    8 <h1>{% i18n _('Server Error <em>(500)</em>') %}</h1> 
    9 <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> 
     8<h1>{{ _('Server Error <em>(500)</em>') }}</h1> 
     9<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> 
    1010 
    1111{% endblock %} 
  • django/branches/i18n/django/conf/admin_templates/admin_object_history.html

    r92 r763  
    22 
    33{% block breadcrumbs %} 
    4 <div class="breadcrumbs"><a href="../../../../">Home</a> &rsaquo; <a href="../../">{{ module_name }}</a> &rsaquo; <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo; History</div> 
     4<div class="breadcrumbs"><a href="../../../../">{{ _('Home') }}</a> &rsaquo; <a href="../../">{{ module_name }}</a> &rsaquo; <a href="../">{{ object|truncatewords:"18" }}</a> &rsaquo; {{ _('History') }}</div> 
    55{% endblock %} 
    66 
     
    1515        <thead> 
    1616        <tr> 
    17             <th>Date/time</th> 
    18             <th>User</th> 
    19             <th>Action</th> 
     17            <th>{{ _('Date/time') }}</th> 
     18            <th>{{ _('User') }}</th> 
     19            <th>{{ _('Action') }}</th> 
    2020        </tr> 
    2121        </thead> 
     
    3333{% else %} 
    3434 
    35     <p>This object doesn't have a change history. It probably wasn't added via this admin site.</p> 
     35    <p>{{ _('This object doesn't have a change history. It probably wasn't added via this admin site.') }}</p> 
    3636 
    3737{% endif %} 
  • django/branches/i18n/django/conf/admin_templates/base.html

    r730 r763  
    2020        </div> 
    2121        {% if not user.is_anonymous %} 
    22         <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> 
     22        <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> 
    2323        {% endif %} 
    2424        {% block nav-global %}{% endblock %} 
     
    2626    </div> 
    2727    <!-- END Header --> 
    28     {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% i18n _('Home') %}</a>{% if title %} &rsaquo; {{ title }}{% endif %}</div>{% endblock %} 
     28    {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{{ _('Home') }}</a>{% if title %} &rsaquo; {{ title }}{% endif %}</div>{% endblock %} 
    2929    {% endif %} 
    3030 
  • django/branches/i18n/django/conf/admin_templates/base_site.html

    r730 r763  
    11{% extends "base" %} 
    22 
    3 {% block title %}{{ title }} | {% i18n _('Django site admin') %}{% endblock %} 
     3{% block title %}{{ title }} | {{ _('Django site admin') }}{% endblock %} 
    44 
    55{% block branding %} 
    6 <h1 id="site-name">{% i18n _('Django administration') %}</h1> 
     6<h1 id="site-name">{{ _('Django administration') }}</h1> 
    77<h2 id="site-url"><a href="http://www.example.com/">example.com</a></h2> 
    88{% endblock %} 
  • django/branches/i18n/django/conf/admin_templates/changelist_generic.html

    r730 r763  
    66 
    77{% if not hide_add_link %} 
    8 <ul class="object-tools"><li><a href="/{{ admin_url }}/add/" class="addlink">{% i18n _('Add') %} {{ object_name }}</a></li></ul> 
     8<ul class="object-tools"><li><a href="/{{ admin_url }}/add/" class="addlink">{{ _('Add') }} {{ object_name }}</a></li></ul> 
    99{% endif %} 
    1010 
     
    2424    <ul class="changelist"> 
    2525        {% for obj in changelist %} 
    26         <li class="{% cycle row1,row2 %}"><a href="/{{ admin_url }}/change/{{ obj.id }}/" title="{% i18n _('Click to change') %}">{{ obj|striptags|escape }}</a></li> 
     26        <li class="{% cycle row1,row2 %}"><a href="/{{ admin_url }}/change/{{ obj.id }}/" title="{{ _('Click to change') }}">{{ obj|striptags|escape }}</a></li> 
    2727        {% endfor %} 
    2828    </ul> 
  • django/branches/i18n/django/conf/admin_templates/delete_confirmation_generic.html

    r730 r763  
    44 
    55{% if perms_lacking %} 
    6     <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> 
     6    <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> 
    77    <ul> 
    88    {% for obj in perms_lacking %} 
     
    1111    </ul> 
    1212{% else %} 
    13     <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> 
     13    <p>{{ _('Are you sure you want to delete the %(object_name)s "%(object)s"? All of the following related items will be deleted:') }}</p> 
    1414    <ul>{{ deleted_objects|unordered_list }}</ul> 
    1515    <form action="" method="post"> 
    1616    <input type="hidden" name="post" value="yes" /> 
    17     <input type="submit" value="{% i18n _("Yes, I'm sure") %}" /> 
     17    <input type="submit" value="{{ _("Yes, I'm sure") }}" /> 
    1818    </form> 
    1919{% endif %} 
  • django/branches/i18n/django/conf/admin_templates/index.html

    r730 r763  
    2424 
    2525            {% if model.perms.add %} 
    26                 <td class="x50"><a href="{{ model.admin_url }}add/" class="addlink">{% i18n _('Add') %}</a></td> 
     26                <td class="x50"><a href="{{ model.admin_url }}add/" class="addlink">{{ _('Add') }}</a></td> 
    2727            {% else %} 
    2828                <td class="x50">&nbsp;</td> 
     
    3030 
    3131            {% if model.perms.change %} 
    32                 <td class="x75"><a href="{{ model.admin_url }}" class="changelink">{% i18n _('Change') %}</a></td> 
     32                <td class="x75"><a href="{{ model.admin_url }}" class="changelink">{{ _('Change') }}</a></td> 
    3333            {% else %} 
    3434                <td class="x75">&nbsp;</td> 
     
    4040    {% endfor %} 
    4141{% else %} 
    42     <p>{% i18n _("You don't have permission to edit anything.") %}</p> 
     42    <p>{{ _("You don't have permission to edit anything.") }}</p> 
    4343{% endif %} 
    4444</div> 
     
    4848<div id="content-related"> 
    4949    <div class="module" id="recent-actions-module"> 
    50         <h2>{% i18n _('Recent Actions') %}</h2> 
    51         <h3>{% i18n _('My Actions') %}</h3> 
     50        <h2>{{ _('Recent Actions') }}</h2> 
     51        <h3>{{ _('My Actions') }}</h3> 
    5252            {% load auth.log %} 
    5353            {% get_admin_log 10 as admin_log for_user user %} 
    5454            {% if not admin_log %} 
    55             <p>{% i18n _('None available') %}</p> 
     55            <p>{{ _('None available') }}</p> 
    5656            {% else %} 
    5757            <ul class="actionlist"> 
  • django/branches/i18n/django/conf/admin_templates/login.html

    r730 r763  
    1212 
    1313<p class="aligned"> 
    14 <label for="id_username">{% i18n _('Username:') %}</label> <input type="text" name="username" id="id_username" /> 
     14<label for="id_username">{{ _('Username:') }}</label> <input type="text" name="username" id="id_username" /> 
    1515</p> 
    1616<p class="aligned"> 
    17 <label for="id_password">{% i18n _('Password:') %}</label> <input type="password" name="password" id="id_password" /> 
     17<label for="id_password">{{ _('Password:') }}</label> <input type="password" name="password" id="id_password" /> 
    1818<input type="hidden" name="this_is_the_login_form" value="1" /> 
    19 <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 %} 
     19<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 %} 
    2020</p> 
    2121 
    2222<div class="aligned "> 
    23 <label>&nbsp;</label><input type="submit" value="{% i18n _('Log in') %}" /> 
     23<label>&nbsp;</label><input type="submit" value="{{ _('Log in') }}" /> 
    2424</div> 
    2525</form> 
  • django/branches/i18n/django/conf/admin_templates/registration/logged_out.html

    r730 r763  
    11{% extends "base_site" %} 
    22 
    3 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a></div>{% endblock %} 
     3{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a></div>{% endblock %} 
    44 
    55{% block content %} 
    66 
    7 <p>{% i18n _("Thanks for spending some quality time with the Web site today.") %}</p> 
     7<p>{{ _("Thanks for spending some quality time with the Web site today.") }}</p> 
    88 
    9 <p><a href="../">{% i18n _('Log in again') %}</a></p> 
     9<p><a href="../">{{ _('Log in again') }}</a></p> 
    1010 
    1111{% endblock %} 
  • django/branches/i18n/django/conf/admin_templates/registration/password_change_done.html

    r730 r763  
    11{% extends "base_site" %} 
    22 
    3 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> &rsaquo; {% i18n _('Password change') %}</div>{% endblock %} 
     3{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> &rsaquo; {{ _('Password change') }}</div>{% endblock %} 
    44 
    5 {% block title %}{% i18n _('Password change successful') %}{% endblock %} 
     5{% block title %}{{ _('Password change successful') }}{% endblock %} 
    66 
    77{% block content %} 
    88 
    9 <h1>{% i18n _('Password change successful') %}</h1> 
     9<h1>{{ _('Password change successful') }}</h1> 
    1010 
    11 <p>{% i18n _('Your password was changed.') %}</p> 
     11<p>{{ _('Your password was changed.') }}</p> 
    1212 
    1313{% endblock %} 
  • django/branches/i18n/django/conf/admin_templates/registration/password_change_form.html

    r733 r763  
    11{% extends "base_site" %} 
    22 
    3 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> &rsaquo; {% i18n _('Password change') %}</div>{% endblock %} 
     3{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> &rsaquo; {{ _('Password change') }}</div>{% endblock %} 
    44 
    5 {% block title %}{% i18n _('Password change') %}{% endblock %} 
     5{% block title %}{{ _('Password change') }}{% endblock %} 
    66 
    77{% block content %} 
    88 
    9 <h1>{% i18n _('Password change') %}</h1> 
     9<h1>{{ _('Password change') }}</h1> 
    1010 
    11 <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> 
     11<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> 
    1212 
    1313<form action="" method="post"> 
    1414 
    1515{% if form.old_password.errors %}{{ form.old_password.html_error_list }}{% endif %} 
    16 <p class="aligned wide"><label for="id_old_password">{% i18n _('Old password:') %}</label>{{ form.old_password }}</p> 
     16<p class="aligned wide"><label for="id_old_password">{{ _('Old password:') }}</label>{{ form.old_password }}</p> 
    1717{% if form.new_password1.errors %}{{ form.new_password1.html_error_list }}{% endif %} 
    18 <p class="aligned wide"><label for="id_new_password1">{% i18n _('New password:') %}</label>{{ form.new_password1 }}</p> 
     18<p class="aligned wide"><label for="id_new_password1">{{ _('New password:') }}</label>{{ form.new_password1 }}</p> 
    1919{% if form.new_password2.errors %}{{ form.new_password2.html_error_list }}{% endif %} 
    20 <p class="aligned wide"><label for="id_new_password2">{% i18n _('Confirm password:') %}</label>{{ form.new_password2 }}</p> 
     20<p class="aligned wide"><label for="id_new_password2">{{ _('Confirm password:') }}</label>{{ form.new_password2 }}</p> 
    2121 
    22 <p><input type="submit" value="{% i18n _('Change my password') %}" /></p> 
     22<p><input type="submit" value="{{ _('Change my password') }}" /></p> 
    2323</form> 
    2424 
  • django/branches/i18n/django/conf/admin_templates/registration/password_reset_done.html

    r730 r763  
    11{% extends "base_site" %} 
    22 
    3 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> &rsaquo; {% i18n _('Password reset') %}</div>{% endblock %} 
     3{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> &rsaquo; {{ _('Password reset') }}</div>{% endblock %} 
    44 
    5 {% block title %}{% i18n _('Password reset successful') %}{% endblock %} 
     5{% block title %}{{ _('Password reset successful') }}{% endblock %} 
    66 
    77{% block content %} 
    88 
    9 <h1>{% i18n _('Password reset successful') %}</h1> 
     9<h1>{{ _('Password reset successful') }}</h1> 
    1010 
    11 <p>{% i18n _("We've e-mailed a new password to the e-mail address you submitted. You should be receiving it shortly.") %}</p> 
     11<p>{{ _("We've e-mailed a new password to the e-mail address you submitted. You should be receiving it shortly.") }}</p> 
    1212 
    1313{% endblock %} 
  • django/branches/i18n/django/conf/admin_templates/registration/password_reset_email.html

    r730 r763  
    1 {% i18n _("You're receiving this e-mail because you requested a password reset") %
    2 {% i18n _("for your user account at %(site_name)s") %}. 
     1{{ _("You're receiving this e-mail because you requested a password reset") }
     2{{ _("for your user account at %(site_name)s") }}. 
    33 
    4 {% i18n _("Your new password is: %(new_password)s") %
     4{{ _("Your new password is: %(new_password)s") }
    55 
    6 {% i18n _("Feel free to change this password by going to this page:") %
     6{{ _("Feel free to change this password by going to this page:") }
    77 
    88http://{{ domain }}/password_change/ 
    99 
    10 {% i18n _("Your username, in case you've forgotten:") %} {{ user.username }} 
     10{{ _("Your username, in case you've forgotten:") }} {{ user.username }} 
    1111 
    12 {% i18n _("Thanks for using our site!") %
     12{{ _("Thanks for using our site!") }
    1313 
    14 {% i18n _("The %(site_name)s team") %
     14{{ _("The %(site_name)s team") }
  • django/branches/i18n/django/conf/admin_templates/registration/password_reset_form.html

    r730 r763  
    11{% extends "base_site" %} 
    22 
    3 {% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{% i18n _('Home') %}</a> &rsaquo; {% i18n _('Password reset') %}</div>{% endblock %} 
     3{% block breadcrumbs %}<div class="breadcrumbs"><a href="../">{{ _('Home') }}</a> &rsaquo; {{ _('Password reset') }}</div>{% endblock %} 
    44 
    5 {% block title %}{% i18n _("Password reset") %}{% endblock %} 
     5{% block title %}{{ _("Password reset") }}{% endblock %} 
    66 
    77{% block content %} 
    88 
    9 <h1>{% i18n _("Password reset") %}</h1> 
     9<h1>{{ _("Password reset") }}</h1> 
    1010 
    11 <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> 
     11<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> 
    1212 
    1313<form action="" method="post"> 
    1414{% if form.email.errors %}{{ form.email.html_error_list }}{% endif %} 
    15 <p><label for="id_email">{% i18n _('E-mail address:') %}</label> {{ form.email }} <input type="submit" value="{% i18n _('Reset my password') %}" /></p> 
     15<p><label for="id_email">{{ _('E-mail address:') }}</label> {{ form.email }} <input type="submit" value="{{ _('Reset my password') }}" /></p> 
    1616</form> 
    1717