From 6a1631476cfd5b46b1c778fff680ea2bc554baaa Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 1 May 2014 17:29:58 +0200 Subject: Internationalization to french in progress. --- pyaggr3g470r/forms.py | 32 ++-- pyaggr3g470r/templates/favorites.html | 10 +- pyaggr3g470r/templates/feed.html | 16 +- pyaggr3g470r/templates/feeds.html | 22 +-- pyaggr3g470r/templates/inactives.html | 6 +- pyaggr3g470r/templates/layout.html | 28 +-- pyaggr3g470r/templates/unread.html | 14 +- .../translations/fr/LC_MESSAGES/messages.mo | Bin 5482 -> 7154 bytes .../translations/fr/LC_MESSAGES/messages.po | 195 ++++++++++++++++++--- 9 files changed, 237 insertions(+), 86 deletions(-) (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/forms.py b/pyaggr3g470r/forms.py index a1e24bd7..7f9ab88b 100644 --- a/pyaggr3g470r/forms.py +++ b/pyaggr3g470r/forms.py @@ -28,7 +28,7 @@ __license__ = "GPLv3" from flask import flash from flask.ext.wtf import Form -from flask.ext.babel import gettext +from flask.ext.babel import lazy_gettext from wtforms import TextField, TextAreaField, PasswordField, BooleanField, SubmitField, validators from pyaggr3g470r.models import User @@ -37,9 +37,9 @@ class SigninForm(Form): """ Sign in form. """ - email = TextField("Email", [validators.Required(gettext("Please enter your email address."))]) - password = PasswordField(gettext('Password'), [validators.Required(gettext("Please enter a password."))]) - submit = SubmitField(gettext("Log In")) + email = TextField("Email", [validators.Required(lazy_gettext("Please enter your email address."))]) + password = PasswordField(lazy_gettext('Password'), [validators.Required(lazy_gettext("Please enter a password."))]) + submit = SubmitField(lazy_gettext("Log In")) def __init__(self, *args, **kwargs): Form.__init__(self, *args, **kwargs) @@ -52,17 +52,17 @@ class SigninForm(Form): if user and user.check_password(self.password.data): return True else: - flash(gettext('Invalid email or password'), 'danger') + flash(lazy_gettext('Invalid email or password'), 'danger') #self.email.errors.append("Invalid email or password") return False class AddFeedForm(Form): - title = TextField(gettext("Title"), [validators.Required(gettext("Please enter a title."))]) - link = TextField(gettext("Feed link"), [validators.Required(gettext("Please enter a link for the feed."))]) - site_link = TextField(gettext("Site link")) - email_notification = BooleanField(gettext("Email notification"), default=False) - enabled = BooleanField(gettext("Check for updates"), default=True) - submit = SubmitField(gettext("Save")) + title = TextField(lazy_gettext("Title"), [validators.Required(lazy_gettext("Please enter a title."))]) + link = TextField(lazy_gettext("Feed link"), [validators.Required(lazy_gettext("Please enter a link for the feed."))]) + site_link = TextField(lazy_gettext("Site link")) + email_notification = BooleanField(lazy_gettext("Email notification"), default=False) + enabled = BooleanField(lazy_gettext("Check for updates"), default=True) + submit = SubmitField(lazy_gettext("Save")) def __init__(self, *args, **kwargs): Form.__init__(self, *args, **kwargs) @@ -73,11 +73,11 @@ class AddFeedForm(Form): return True class ProfileForm(Form): - firstname = TextField(gettext("First name"), [validators.Required(gettext("Please enter your first name."))]) - lastname = TextField(gettext("Last name"), [validators.Required(gettext("Please enter your last name."))]) - email = TextField(gettext("Email"), [validators.Required(gettext("Please enter your email."))]) - password = PasswordField(gettext("Password")) - submit = SubmitField(gettext("Save")) + firstname = TextField(lazy_gettext("First name"), [validators.Required(lazy_gettext("Please enter your first name."))]) + lastname = TextField(lazy_gettext("Last name"), [validators.Required(lazy_gettext("Please enter your last name."))]) + email = TextField(lazy_gettext("Email"), [validators.Required(lazy_gettext("Please enter your email."))]) + password = PasswordField(lazy_gettext("Password")) + submit = SubmitField(lazy_gettext("Save")) def __init__(self, *args, **kwargs): Form.__init__(self, *args, **kwargs) diff --git a/pyaggr3g470r/templates/favorites.html b/pyaggr3g470r/templates/favorites.html index 50378d3c..b0357b41 100644 --- a/pyaggr3g470r/templates/favorites.html +++ b/pyaggr3g470r/templates/favorites.html @@ -3,19 +3,19 @@
{% if feeds|count == 0 %} {% else %} {% for feed in feeds|sort(attribute="title") %}

{{ feed.title|safe }}

- - - + + +
{% for number in range(0, feed.articles.all()|length-(feed.articles.all()|length % 3), 3) %} diff --git a/pyaggr3g470r/templates/feed.html b/pyaggr3g470r/templates/feed.html index 849dba49..98e965e4 100644 --- a/pyaggr3g470r/templates/feed.html +++ b/pyaggr3g470r/templates/feed.html @@ -4,24 +4,24 @@

{{ feed.title }}

{% if feed.description %}

{{ feed.description }}

{% endif %} - - + +

- This feed contains {{ feed.articles.all()|count }} articles + {{ _('This feed contains') }} {{ feed.articles.all()|count }} {{ _('articles') }} {% if nb_articles != 0 %} - ({{ ((feed.articles.all()|count * 100 ) / nb_articles) | round(2, 'floor') }}% of the database) + ({{ ((feed.articles.all()|count * 100 ) / nb_articles) | round(2, 'floor') }}% {{ _('of the database') }}) {% endif %} .
- Address of the feed: {{ feed.link }}
+ {{ _('Address of the feed') }}: {{ feed.link }}
{% if feed.site_link != "" %} - Address of the site: {{ feed.site_link }} + {{ _('Address of the site') }}: {{ feed.site_link }} {% endif %}
{% if feed.articles.all()|count != 0 %} - The last article was posted {{ elapsed.days }} day(s) ago.
- Daily average: {{ average }}, between the {{ first_post_date.strftime('%Y-%m-%d') }} and the {{ end_post_date.strftime('%Y-%m-%d') }}. + {{ _('The last article was posted') }} {{ elapsed.days }} {{ _('day(s) ago.') }}
+ {{ _('Daily average') }}: {{ average }}, {{ _('between the') }} {{ first_post_date.strftime('%Y-%m-%d') }} {{ _('and the') }} {{ end_post_date.strftime('%Y-%m-%d') }}. {% endif %}

diff --git a/pyaggr3g470r/templates/feeds.html b/pyaggr3g470r/templates/feeds.html index 82e4afae..4caf6653 100644 --- a/pyaggr3g470r/templates/feeds.html +++ b/pyaggr3g470r/templates/feeds.html @@ -1,17 +1,17 @@ {% extends "layout.html" %} {% block content %}
-

You are subscribed to {{ feeds.all()|count }} feeds · Add a feed

+

{{ _('You are subscribed to') }} {{ feeds.all()|count }} {{ _('feeds') }} · {{ _('Add a') }} {{ _('feed') }}

- - - - - + + + + + @@ -20,18 +20,18 @@ {% endfor %} diff --git a/pyaggr3g470r/templates/inactives.html b/pyaggr3g470r/templates/inactives.html index 0d093029..1916e09a 100644 --- a/pyaggr3g470r/templates/inactives.html +++ b/pyaggr3g470r/templates/inactives.html @@ -3,18 +3,18 @@
-

Days of inactivity:

+

{{ _('Days of inactivity') }}:


{% if inactives != [] %} {% else %} -

No inactive feeds.

+

{{ _('No inactive feeds.') }}

{% endif %}

diff --git a/pyaggr3g470r/templates/layout.html b/pyaggr3g470r/templates/layout.html index d45ce090..8ed66d89 100644 --- a/pyaggr3g470r/templates/layout.html +++ b/pyaggr3g470r/templates/layout.html @@ -40,30 +40,30 @@
#StatusTitleSiteArticlesActions{{ _('Status') }}{{ _('Title') }}{{ _('Site') }}{{ _('Articles') }}{{ _('Actions') }}
{{ loop.index }} {% if feed.enabled %} - + {% else %} - + {% endif %} {{ feed.title }} {{ feed.site_link }} {{ feed.articles.all()|count }} - - - + + +