Mercurial > hg > savane-forge
changeset 288:4388bfc8f3a0
Exclude translation strings already translated in Django itself
line wrap: on
line diff
--- a/TRANSLATIONS.txt +++ b/TRANSLATIONS.txt @@ -11,7 +11,7 @@ Once that's done, still in a terminal, type: - ./manage.py makemessages -l XX -e html,inc + ./manage.py makemessages -l fr -e .html,.inc -i '*/django-overrides/*' where XX is your language code: http://www.gnu.org/software/gettext/manual/html_node/Usual-Language-Codes.html @@ -47,7 +47,7 @@ In a terminal, just type again: - ./manage.py makemessages -l XX + ./manage.py makemessages -l fr -e .html,.inc -i '*/django-overrides/*' Don't use Poedit to update your catalog, as it doesn't know how to search for strings in the Savane templates (Django format).
--- a/doc/DJANGO_I18N +++ b/doc/DJANGO_I18N @@ -1,21 +1,23 @@ Translations ============ -You create them with either: +(see TRANSLATIONS.txt for the Savane-specific options) + +Generally, you create them using Django with either: - a monolithic translation catalog (what we currently use) cd framework/ mkdir locale/ # or conf/locale/ - django-admin makemessages -l fr -e html,inc + django-admin makemessages -l fr django-admin compilemessages -l fr - per-app translation catalogs: cd framework/savane/svmain/ mkdir locale/ - django-admin makemessages -l fr -e html,inc + django-admin makemessages -l fr django-admin compilemessages -l fr - in both cases, to update: @@ -23,7 +25,6 @@ cd ... django-admin makemessages -a - Monolithic translations are not suited for deploying reusable apps (because they are installed in the projects rather than in the applications).
--- a/settings_default.py +++ b/settings_default.py @@ -96,6 +96,7 @@ # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. os.path.join(os.path.dirname(__file__), 'templates'), + os.path.join(os.path.dirname(__file__), 'templates', 'django-overrides'), ) # Used by syncdb, etc.
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/README @@ -0,0 +1,4 @@ +These templates override the Django default ones (such as login and +password recovery). They are placed in a separate directory so they +can be easily excluded from the translation catalog: no need to +translate them, because the Django contributors already did.
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/README @@ -0,0 +1,5 @@ +'registration/login.html' is the place where Django (more precisely +'django.contrib.auth.views.login') looks for the login template by +default. + +Similarly, \ No newline at end of file
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/login.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}Login{% endblock %} + +{% block content %} +<form action="{% url django.contrib.auth.views.login %}" method="post">{% csrf_token %} +{{form.as_p}} +<input type="hidden" name="next" value="{{next}}" /> +<input type="submit" name="login" value="Login" /> +</form> + +<p>[<a href="{% url django.contrib.auth.views.password_reset %}">{% trans "Lost your password?" %}</a>]</p> + +{% endblock %}
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/password_change_done.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans 'Password change successful' %}{% endblock %} + +{% block content %} + +<p>{% trans 'Your password was changed.' %}</p> + +{% endblock %}
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/password_change_form.html @@ -0,0 +1,45 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans 'Password change' %}{% endblock %} + +{% block content %} + +<form action="" method="post">{% csrf_token %} +<div> +{% if form.errors %} + <p class="errornote"> + {% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} + </p> +{% endif %} + +<p>{% trans "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> + +<fieldset class="module aligned wide"> + +<div class="form-row"> + {{ form.old_password.errors }} + <label for="id_old_password" class="required">{% trans 'Old password' %}:</label>{{ form.old_password }} +</div> + +<div class="form-row"> + {{ form.new_password1.errors }} + <label for="id_new_password1" class="required">{% trans 'New password' %}:</label>{{ form.new_password1 }} +</div> + +<div class="form-row"> +{{ form.new_password2.errors }} + <label for="id_new_password2" class="required">{% trans 'Password (again)' %}:</label>{{ form.new_password2 }} +</div> + +</fieldset> + +<div class="submit-row"> + <input type="submit" value="{% trans 'Change my password' %}" class="default" /> +</div> + +<script type="text/javascript">document.getElementById("id_old_password").focus();</script> +</div> +</form> + +{% endblock %}
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/password_reset_complete.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans 'Password reset complete' %}{% endblock %} + +{% block content %} + +<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p> + +<p><a href="{{ login_url }}">{% trans 'Log in' %}</a></p> + +{% endblock %}
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/password_reset_confirm.html @@ -0,0 +1,30 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans 'Password reset' %}{% endblock %} + +{% block content %} + +{% if validlink %} + +<h2>{% trans 'Enter new password' %}</h2> + +<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p> + +<form action="" method="post">{% csrf_token %} +{{ form.new_password1.errors }} +<p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label>{{ form.new_password1 }}</p> +{{ form.new_password2.errors }} +<p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label>{{ form.new_password2 }}</p> +<p><input type="submit" value="{% trans 'Change my password' %}" /></p> +</form> + +{% else %} + +<h2>{% trans 'Password reset unsuccessful' %}</h2> + +<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p> + +{% endif %} + +{% endblock %}
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/password_reset_done.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans 'Password reset successful' %}{% endblock %} + +{% block content %} + +<p>{% trans "We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}</p> + +{% endblock %}
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/password_reset_email.html @@ -0,0 +1,15 @@ +{% load i18n %}{% autoescape off %} +{% trans "You're receiving this e-mail because you requested a password reset" %} +{% blocktrans %}for your user account at {{ site_name }}{% endblocktrans %}. + +{% trans "Please go to the following page and choose a new password:" %} +{% block reset_link %} +{{ protocol }}://{{ domain }}{% url django.contrib.auth.views.password_reset_confirm uidb36=uid token=token %} +{% endblock %} +{% trans "Your username, in case you've forgotten:" %} {{ user.username }} + +{% trans "Thanks for using our site!" %} + +{% blocktrans %}The {{ site_name }} team{% endblocktrans %} + +{% endautoescape %}
new file mode 100644 --- /dev/null +++ b/templates/django-overrides/registration/password_reset_form.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block title %}{% trans "Password reset" %}{% endblock %} + +{% block content %} + +<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}</p> + +<form action="" method="post">{% csrf_token %} +{{ form.email.errors }} +<p><label for="id_email">{% trans 'E-mail address:' %}</label> {{ form.email }} <input type="submit" value="{% trans 'Reset my password' %}" /></p> +</form> + +{% endblock %}
--- a/templates/registration/README +++ b/templates/registration/README @@ -1,5 +1,1 @@ -'registration/login.html' is the place where Django (more precisely -'django.contrib.auth.views.login') looks for the login template by -default. - -Other templates are required by the 'django-registration' application. +These templates are required by the 'django-registration' application.
deleted file mode 100644 --- a/templates/registration/login.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}Login{% endblock %} - -{% block content %} -<form action="{% url django.contrib.auth.views.login %}" method="post">{% csrf_token %} -{{form.as_p}} -<input type="hidden" name="next" value="{{next}}" /> -<input type="submit" name="login" value="Login" /> -</form> - -<p>[<a href="{% url django.contrib.auth.views.password_reset %}">{% trans "Lost your password?" %}</a>]</p> - -{% endblock %}
deleted file mode 100644 --- a/templates/registration/password_change_done.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans 'Password change successful' %}{% endblock %} - -{% block content %} - -<p>{% trans 'Your password was changed.' %}</p> - -{% endblock %}
deleted file mode 100644 --- a/templates/registration/password_change_form.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans 'Password change' %}{% endblock %} - -{% block content %} - -<form action="" method="post">{% csrf_token %} -<div> -{% if form.errors %} - <p class="errornote"> - {% blocktrans count form.errors.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} - </p> -{% endif %} - -<p>{% trans "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> - -<fieldset class="module aligned wide"> - -<div class="form-row"> - {{ form.old_password.errors }} - <label for="id_old_password" class="required">{% trans 'Old password' %}:</label>{{ form.old_password }} -</div> - -<div class="form-row"> - {{ form.new_password1.errors }} - <label for="id_new_password1" class="required">{% trans 'New password' %}:</label>{{ form.new_password1 }} -</div> - -<div class="form-row"> -{{ form.new_password2.errors }} - <label for="id_new_password2" class="required">{% trans 'Password (again)' %}:</label>{{ form.new_password2 }} -</div> - -</fieldset> - -<div class="submit-row"> - <input type="submit" value="{% trans 'Change my password' %}" class="default" /> -</div> - -<script type="text/javascript">document.getElementById("id_old_password").focus();</script> -</div> -</form> - -{% endblock %}
deleted file mode 100644 --- a/templates/registration/password_reset_complete.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans 'Password reset complete' %}{% endblock %} - -{% block content %} - -<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p> - -<p><a href="{{ login_url }}">{% trans 'Log in' %}</a></p> - -{% endblock %}
deleted file mode 100644 --- a/templates/registration/password_reset_confirm.html +++ /dev/null @@ -1,30 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans 'Password reset' %}{% endblock %} - -{% block content %} - -{% if validlink %} - -<h2>{% trans 'Enter new password' %}</h2> - -<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p> - -<form action="" method="post">{% csrf_token %} -{{ form.new_password1.errors }} -<p class="aligned wide"><label for="id_new_password1">{% trans 'New password:' %}</label>{{ form.new_password1 }}</p> -{{ form.new_password2.errors }} -<p class="aligned wide"><label for="id_new_password2">{% trans 'Confirm password:' %}</label>{{ form.new_password2 }}</p> -<p><input type="submit" value="{% trans 'Change my password' %}" /></p> -</form> - -{% else %} - -<h2>{% trans 'Password reset unsuccessful' %}</h2> - -<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p> - -{% endif %} - -{% endblock %}
deleted file mode 100644 --- a/templates/registration/password_reset_done.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans 'Password reset successful' %}{% endblock %} - -{% block content %} - -<p>{% trans "We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly." %}</p> - -{% endblock %}
deleted file mode 100644 --- a/templates/registration/password_reset_email.html +++ /dev/null @@ -1,15 +0,0 @@ -{% load i18n %}{% autoescape off %} -{% trans "You're receiving this e-mail because you requested a password reset" %} -{% blocktrans %}for your user account at {{ site_name }}{% endblocktrans %}. - -{% trans "Please go to the following page and choose a new password:" %} -{% block reset_link %} -{{ protocol }}://{{ domain }}{% url django.contrib.auth.views.password_reset_confirm uidb36=uid token=token %} -{% endblock %} -{% trans "Your username, in case you've forgotten:" %} {{ user.username }} - -{% trans "Thanks for using our site!" %} - -{% blocktrans %}The {{ site_name }} team{% endblocktrans %} - -{% endautoescape %}
deleted file mode 100644 --- a/templates/registration/password_reset_form.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block title %}{% trans "Password reset" %}{% endblock %} - -{% block content %} - -<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll e-mail instructions for setting a new one." %}</p> - -<form action="" method="post">{% csrf_token %} -{{ form.email.errors }} -<p><label for="id_email">{% trans 'E-mail address:' %}</label> {{ form.email }} <input type="submit" value="{% trans 'Reset my password' %}" /></p> -</form> - -{% endblock %}