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 %} -

{% i18n _('Page not found') %}

+

{{ _('Page not found') }}

-

{% i18n _("We're sorry, but the requested page could not be found.") %}

+

{{ _("We're sorry, but the requested page could not be found.") }}

{% 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 %}{% endblock %} -{% block title %}{% i18n _('Server error (500)') %}{% endblock %} +{% block title %}{{ _('Server error (500)') }}{% endblock %} {% block content %} -

{% i18n _('Server Error (500)') %}

-

{% 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.") %}

+

{{ _('Server Error (500)') }}

+

{{ _("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.") }}

{% 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 %} - + {% endblock %} {% block content %} @@ -14,9 +14,9 @@ - - - + + + @@ -32,7 +32,7 @@ {% else %} -

This object doesn't have a change history. It probably wasn't added via this admin site.

+

{{ _('This object doesn't have a change history. It probably wasn't added via this admin site.') }}

{% 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 %} {% if not user.is_anonymous %} -
{% i18n _('Welcome,') %} {% if user.first_name %}{{ user.first_name }}{% else %}{{ user.username }}{% endif %}.
{% block userlinks %}{% i18n _('Change password') %} / {% i18n _('Log out') %}{% endblock %}
+
{{ _('Welcome,') }} {% if user.first_name %}{{ user.first_name }}{% else %}{{ user.username }}{% endif %}.
{% block userlinks %}{{ _('Change password') }} / {{ _('Log out') }}{% endblock %}
{% endif %} {% block nav-global %}{% endblock %}
- {% block breadcrumbs %}{% endblock %} + {% block breadcrumbs %}{% 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 %} -

{% i18n _('Django administration') %}

+

{{ _('Django administration') }}

example.com

{% 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 %} - + {% endif %}
@@ -23,7 +23,7 @@ {% if changelist %} {% 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 %} -

{% 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:") %}

+

{{ _("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:") }}

{% else %} -

{% i18n _('Are you sure you want to delete the %(object_name)s "%(object)s"? All of the following related items will be deleted:') %}

+

{{ _('Are you sure you want to delete the %(object_name)s "%(object)s"? All of the following related items will be deleted:') }}

- + {% 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 %} -
+ {% else %} {% endif %} {% if model.perms.change %} - + {% else %} {% endif %} @@ -39,7 +39,7 @@ {% endfor %} {% else %} -

{% i18n _("You don't have permission to edit anything.") %}

+

{{ _("You don't have permission to edit anything.") }}

{% endif %} {% endblock %} @@ -47,12 +47,12 @@ {% block sidebar %}
Date/timeUserAction{{ _('Date/time') }}{{ _('User') }}{{ _('Action') }}
{% i18n _('Add') %}{{ _('Add') }} {% i18n _('Change') %}{{ _('Change') }}