[extensions-web] Add i18n support



commit cee491cf179cd71dc703ad000ed3823256e65682
Author: Claude Paroz <claude 2xlibre net>
Date:   Sat Jan 12 15:07:25 2019 +0100

    Add i18n support

 sweettooth/auth/templates/registration/login.html  |  11 +-
 .../templates/registration/login_popup_form.html   |   9 +-
 .../registration/password_reset_confirm.html       |   7 +-
 .../registration/password_reset_form.html          |   7 +-
 sweettooth/context_processors.py                   |  11 +-
 .../extensions/templates/extensions/comments.html  |  18 +-
 .../extensions/templates/extensions/detail.html    |  17 +-
 .../extensions/templates/extensions/list.html      |   3 +-
 .../extensions/templates/extensions/local.html     |   7 +-
 sweettooth/locale/en/LC_MESSAGES/django.po         | 255 +++++++++++++++++++++
 sweettooth/locale/en/LC_MESSAGES/djangojs.po       |  42 ++++
 sweettooth/ratings/templates/comments/preview.html |   3 +-
 sweettooth/settings.py                             |   3 +
 sweettooth/static/js/fsui.js                       |  12 +-
 sweettooth/templates/base.html                     |  14 +-
 sweettooth/templates/usermenu.html                 |   7 +-
 sweettooth/urls.py                                 |   3 +
 17 files changed, 374 insertions(+), 55 deletions(-)
---
diff --git a/sweettooth/auth/templates/registration/login.html 
b/sweettooth/auth/templates/registration/login.html
index 6b2b30c..8355d46 100644
--- a/sweettooth/auth/templates/registration/login.html
+++ b/sweettooth/auth/templates/registration/login.html
@@ -1,8 +1,9 @@
 {% extends "base.html" %}
+{% load i18n %}
 {% block body %}
 <div class="col-sm-8 col-md-6 col-centered">
 <form action="" method="POST" class="form auth_form">
-  <h3>User Login</h3>
+  <h3>{% trans "User Login" %}</h3>
   <input type="hidden" name="next" value="{{ next }}">
   {% csrf_token %}
 
@@ -19,7 +20,7 @@
     </div>
 
     <div class="form-group has-error">
-      {{ form.password.label_tag }} <a class="right" href="{% url 'auth_password_reset' %}">Forgot your 
password?</a>
+      {{ form.password.label_tag }} <a class="right" href="{% url 'auth_password_reset' %}">{% trans "Forgot 
your password?" %}</a>
 
       {{ form.password }}
     {% for error in form.password.errors %}
@@ -28,12 +29,12 @@
     </div>
 
     <div class="form-group">
-      <button type="submit" class="btn btn-primary btn-block">Log in</button>
+      <button type="submit" class="btn btn-primary btn-block">{% trans "Log in" %}</button>
     </div>
 </form>
 <!--<a href="{% url 'auth_password_reset' %}">Forgot your password?</a>-->
 <hr>
-<p class="text-center main_feature" style="margin-bottom: 30px;">Don't have an account?</p>
-<a href="{% url 'registration_register' %}" class="btn btn-success btn-block no-decoration">Register</a>
+<p class="text-center main_feature" style="margin-bottom: 30px;">{% trans "Don't have an account?" %}</p>
+<a href="{% url 'registration_register' %}" class="btn btn-success btn-block no-decoration">{% trans 
"Register" %}</a>
 </div>
 {% endblock %}
diff --git a/sweettooth/auth/templates/registration/login_popup_form.html 
b/sweettooth/auth/templates/registration/login_popup_form.html
index 54c0222..42317e0 100644
--- a/sweettooth/auth/templates/registration/login_popup_form.html
+++ b/sweettooth/auth/templates/registration/login_popup_form.html
@@ -1,3 +1,4 @@
+{% load i18n %}
 <div class="row">
     <div class="col-sm-12">
         <form action="{% url 'auth-login' %}" method="POST" class="form">
@@ -7,15 +8,15 @@
                 <input type="hidden" name="next" class="form-control" value="{{ request.path }}"/>
             </div>
             <div class="form-group">
-                <button type="submit" class="btn btn-primary btn-block">Log in</button>
+                <button type="submit" class="btn btn-primary btn-block">{% trans "Log in" %}</button>
             </div>
             <div class="form-group">
-                <a href="{% url 'auth_password_reset' %}" class="">Forgot your password?</a>
+                <a href="{% url 'auth_password_reset' %}">{% trans "Forgot your password?" %}</a>
             </div>
             <li class="divider"></li>
-            <p>Don't have an account?</p>
+            <p>{% trans "Don't have an account?" %}</p>
             <div class="form-group">
-                <a href="{% url 'registration_register' %}" class="btn btn-success btn-block 
no-decoration">Register</a>
+                <a href="{% url 'registration_register' %}" class="btn btn-success btn-block 
no-decoration">{% trans "Register" %}</a>
             </div>
         </form>
     </div>
diff --git a/sweettooth/auth/templates/registration/password_reset_confirm.html 
b/sweettooth/auth/templates/registration/password_reset_confirm.html
index ac28e0a..73031b6 100644
--- a/sweettooth/auth/templates/registration/password_reset_confirm.html
+++ b/sweettooth/auth/templates/registration/password_reset_confirm.html
@@ -1,16 +1,17 @@
 {% extends "base.html" %}
+{% load i18n %}
 {% block body %}
 {% if validlink %}
 <div class="col-sm-8 col-md-6 col-centered">
 <form action="" method="POST" class="auth_form">
   {% csrf_token %}
-  <h3>Password reset</h3>
+  <h3>{% trans "Password reset" %}</h3>
   <ul>
   {{ form.as_ul }}
   </ul>
-  <button type="submit" class="btn btn-primary">Reset your password</button>
+  <button type="submit" class="btn btn-primary">{% trans "Reset your password" %}</button>
 </form>
 {% else %}
-<p>The token for the password reset is incorrect. Please check your link and try again.</p>
+<p>{% trans "The token for the password reset is incorrect. Please check your link and try again." %}</p>
 {% endif %}
 {% endblock %}
diff --git a/sweettooth/auth/templates/registration/password_reset_form.html 
b/sweettooth/auth/templates/registration/password_reset_form.html
index 05c690f..c84fd15 100644
--- a/sweettooth/auth/templates/registration/password_reset_form.html
+++ b/sweettooth/auth/templates/registration/password_reset_form.html
@@ -1,14 +1,15 @@
 {% extends "base.html" %}
+{% load i18n %}
 {% block body %}
 <div class="col-sm-8 col-md-6 col-centered">
 <form action="" method="POST" class="auth_form">
   {% csrf_token %}
-  <h3>Password reset</h3>
-  <p>Forgotten your password? Enter your e-mail address below, and we’ll e-mail instructions for setting a 
new one.</p>
+  <h3>{% trans "Password reset" %}</h3>
+  <p>{% trans "Forgotten your password? Enter your e-mail address below, and we’ll e-mail instructions for 
setting a new one." %}</p>
   <ul>
   {{ form.as_ul }}
   </ul>
-  <button type="submit" class="btn btn-primary">Reset your password</button>
+  <button type="submit" class="btn btn-primary">{% trans "Reset your password" %}</button>
 </form>
 </div>
 {% endblock %}
diff --git a/sweettooth/context_processors.py b/sweettooth/context_processors.py
index 34d94ff..1e949d1 100644
--- a/sweettooth/context_processors.py
+++ b/sweettooth/context_processors.py
@@ -1,21 +1,24 @@
+from django.utils.translation import gettext as _
+
+
 def navigation(request):
     return {
         'global_menu': [
             {
                 'id': 'extensions-index',
-                'name': 'Extensions'
+                'name': _('Extensions')
             },
             {
                 'id': 'extensions-upload-file',
-                'name': 'Add yours'
+                'name': _('Add yours')
             },
             {
                 'id': 'extensions-local',
-                'name': 'Installed extensions'
+                'name': _('Installed extensions')
             },
             {
                 'id': 'extensions-about',
-                'name': 'About'
+                'name': _('About')
             }
         ]
     }
diff --git a/sweettooth/extensions/templates/extensions/comments.html 
b/sweettooth/extensions/templates/extensions/comments.html
index 7eaf815..73c96f0 100644
--- a/sweettooth/extensions/templates/extensions/comments.html
+++ b/sweettooth/extensions/templates/extensions/comments.html
@@ -1,11 +1,12 @@
+{% load i18n %}
 <div id="opinion_form" class="col-sm-6 col-sm-push-6">
-  <h4>Your opinion</h4>
+  <h4>{% trans "Your opinion" %}</h4>
   {% if request.user.is_authenticated %}
   <div class="comment_choice btn-group btn-group-justified">
-    Leave a…
-    <a class="btn btn-default" href="javascript:void 0" id="leave_comment">Comment</a>
-    <a class="btn btn-default" href="javascript:void 0" id="leave_rating">Rating</a>
-    <a class="btn btn-default" href="{% url 'report_error' pk=extension.pk %}">Bug report</a>
+    {% trans "Leave a…" %}
+    <a class="btn btn-default" href="javascript:void 0" id="leave_comment">{% trans "Comment" %}</a>
+    <a class="btn btn-default" href="javascript:void 0" id="leave_rating">{% trans "Rating" %}</a>
+    <a class="btn btn-default" href="{% url 'report_error' pk=extension.pk %}">{% trans "Bug report" %}</a>
   </div>
   <div id="rating_form">
     {% load comments %}
@@ -13,12 +14,13 @@
   </div>
   {% else %}
   <p class="unauthenticated">
-    Unfortunately, to help prevent spam, we require that you <a href="{% url 'auth-login' %}">log in to 
GNOME Shell Extensions</a> in order to post a comment or report an error. You understand, right?
+    {% url 'auth-login' as login_url %}
+    {% blocktrans %}Unfortunately, to help prevent spam, we require that you <a href="{{ login_url }}">log 
in to GNOME Shell Extensions</a> in order to post a comment or report an error. You understand, right?{% 
endblocktrans %}
   </p>
   {% endif %}
 </div>
 <div id="comments" class="col-sm-6 col-sm-pull-6 no-left-padding">
-  <h4>User Reviews</h4>
+  <h4>{% trans "User Reviews" %}</h4>
   <div class="comments-holder"></div>
-  <p class="loading">Loading reviews...</p>
+  <p class="loading">{% trans "Loading reviews…" %}</p>
 </div>
diff --git a/sweettooth/extensions/templates/extensions/detail.html 
b/sweettooth/extensions/templates/extensions/detail.html
index 2138708..e9676ab 100644
--- a/sweettooth/extensions/templates/extensions/detail.html
+++ b/sweettooth/extensions/templates/extensions/detail.html
@@ -1,4 +1,5 @@
 {% extends "base.html" %}
+{% load i18n %}
 {% block title %}{{ extension.name }} - {{ block.super }}{% endblock %}
 
 {% load extension_icon %}
@@ -21,9 +22,9 @@
       <div class="controls col-xs-12 col-sm-4 col-md-4 col-lg-4">
         <div class="switch"></div>
         <div class="extra-buttons">
-          <div class="upgrade-button" title="Upgrade this extension"></div>
-          <div class="configure-button" title="Configure this extension"></div>
-          <div class="uninstall-button" title="Uninstall this extension"></div>
+          <div class="upgrade-button" title="{% trans 'Upgrade this extension' %}"></div>
+          <div class="configure-button" title="{% trans 'Configure this extension' %}"></div>
+          <div class="uninstall-button" title="{% trans 'Uninstall this extension' %}"></div>
         </div>
       </div>
 
@@ -49,19 +50,19 @@
 
             <dl>
               {% if extension.url %}
-              <dt>Extension Homepage</dt>
+              <dt>{% trans "Extension Homepage" %}</dt>
               <dd><a href="{{ extension.url }}" id="extension_url">{{ extension.url }}</a></dd>
               {% endif %}
             </dl>
             <dl>
-              <dt>Download</dt>
+              <dt>{% trans "Download" %}</dt>
               <dd class="extension-download">
                   <select class="shell-version form-control">
-                      <option>Shell version…</option>
+                      <option>{% trans "Shell version…" %}</option>
                   </select>
 
                   <select class="extension-version form-control">
-                      <option>Extension version…</option>
+                      <option>{% trans "Extension version…" %}</option>
                   </select>
               </dd>
             </dl>
@@ -70,8 +71,10 @@
 
       {% if not is_visible %}
       <p class="step">
+        {% blocktrans trimmed %}
         A reviewer will review the extension you submitted to make sure there's nothing too
         dangerous. You'll be emailed the result of the review.
+        {% endblocktrans %}
       </p>
       {% endif %}
 
diff --git a/sweettooth/extensions/templates/extensions/list.html 
b/sweettooth/extensions/templates/extensions/list.html
index 4b589a7..39c315f 100644
--- a/sweettooth/extensions/templates/extensions/list.html
+++ b/sweettooth/extensions/templates/extensions/list.html
@@ -1,5 +1,6 @@
 {% extends "base.html" %}
 {% load static from staticfiles %}
+{% load i18n %}
 
 {% block body %}
   <div id="extensions-list">
@@ -9,7 +10,7 @@
 {% block search-bar %}
 <div id="search-bar">
     <div class="form-group has-feedback has-feedback-left">
-        <input id="search_input" class="form-control input-lg" type="text" placeholder="Search for 
extensions…">
+        <input id="search_input" class="form-control input-lg" type="text" placeholder="{% trans 'Search for 
extensions…' %}">
                 <span class="form-control-feedback"><img src="{% static 'images/search.svg' %}"></span>
         </input>
     </div>
diff --git a/sweettooth/extensions/templates/extensions/local.html 
b/sweettooth/extensions/templates/extensions/local.html
index 0eff07d..efa6027 100644
--- a/sweettooth/extensions/templates/extensions/local.html
+++ b/sweettooth/extensions/templates/extensions/local.html
@@ -1,10 +1,11 @@
 {% extends "base.html" %}
-{% block title %}Installed Extensions - {{ block.super }}{% endblock %}
+{% load i18n %}
+{% block title %}{% trans "Installed Extensions" %} - {{ block.super }}{% endblock %}
 {% block body %}
-<h2>Shell settings</h2>
+<h2>{% trans "Shell settings" %}</h2>
 <div id='shell_settings'></div>
 
-<h2>Installed Extensions</h2>
+<h2>{% trans "Installed Extensions" %}</h2>
 <div id="local_extensions">
 </div>
 {% endblock %}
diff --git a/sweettooth/locale/en/LC_MESSAGES/django.po b/sweettooth/locale/en/LC_MESSAGES/django.po
new file mode 100644
index 0000000..50e2756
--- /dev/null
+++ b/sweettooth/locale/en/LC_MESSAGES/django.po
@@ -0,0 +1,255 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-01-19 14:52+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL li org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: sweettooth/auth/forms.py:39
+msgid "Username"
+msgstr ""
+
+#: sweettooth/auth/forms.py:40
+msgid "Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."
+msgstr ""
+
+#: sweettooth/auth/forms.py:41
+msgid "This value may contain only letters, numbers and @/./+/-/_ characters."
+msgstr ""
+
+#: sweettooth/auth/forms.py:43
+msgid "Email"
+msgstr ""
+
+#: sweettooth/auth/forms.py:44
+msgid "Password"
+msgstr ""
+
+#: sweettooth/auth/forms.py:45
+msgid "Password confirmation"
+msgstr ""
+
+#: sweettooth/auth/forms.py:46
+msgid "Enter the same password as above, for verification."
+msgstr ""
+
+#: sweettooth/auth/templates/registration/login.html:6
+msgid "User Login"
+msgstr ""
+
+#: sweettooth/auth/templates/registration/login.html:23
+#: sweettooth/auth/templates/registration/login_popup_form.html:14
+msgid "Forgot your password?"
+msgstr ""
+
+#: sweettooth/auth/templates/registration/login.html:32
+#: sweettooth/auth/templates/registration/login_popup_form.html:11
+#: sweettooth/templates/base.html:72
+msgid "Log in"
+msgstr ""
+
+#: sweettooth/auth/templates/registration/login.html:37
+#: sweettooth/auth/templates/registration/login_popup_form.html:17
+msgid "Don't have an account?"
+msgstr ""
+
+#: sweettooth/auth/templates/registration/login.html:38
+#: sweettooth/auth/templates/registration/login_popup_form.html:19
+msgid "Register"
+msgstr ""
+
+#: sweettooth/auth/templates/registration/password_reset_confirm.html:8
+#: sweettooth/auth/templates/registration/password_reset_form.html:7
+msgid "Password reset"
+msgstr ""
+
+#: sweettooth/auth/templates/registration/password_reset_confirm.html:12
+#: sweettooth/auth/templates/registration/password_reset_form.html:12
+msgid "Reset your password"
+msgstr ""
+
+#: sweettooth/auth/templates/registration/password_reset_confirm.html:15
+msgid ""
+"The token for the password reset is incorrect. Please check your link and "
+"try again."
+msgstr ""
+
+#: sweettooth/auth/templates/registration/password_reset_form.html:8
+msgid ""
+"Forgotten your password? Enter your e-mail address below, and we’ll e-mail "
+"instructions for setting a new one."
+msgstr ""
+
+#: sweettooth/context_processors.py:9
+msgid "Extensions"
+msgstr ""
+
+#: sweettooth/context_processors.py:13
+msgid "Add yours"
+msgstr ""
+
+#: sweettooth/context_processors.py:17
+msgid "Installed extensions"
+msgstr ""
+
+#: sweettooth/context_processors.py:21
+msgid "About"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/comments.html:3
+msgid "Your opinion"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/comments.html:6
+msgid "Leave a…"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/comments.html:7
+msgid "Comment"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/comments.html:8
+msgid "Rating"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/comments.html:9
+msgid "Bug report"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/comments.html:18
+#, python-format
+msgid ""
+"Unfortunately, to help prevent spam, we require that you <a href="
+"\"%(login_url)s\">log in to GNOME Shell Extensions</a> in order to post a "
+"comment or report an error. You understand, right?"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/comments.html:23
+msgid "User Reviews"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/comments.html:25
+msgid "Loading reviews…"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/detail.html:25
+msgid "Upgrade this extension"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/detail.html:26
+msgid "Configure this extension"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/detail.html:27
+msgid "Uninstall this extension"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/detail.html:53
+msgid "Extension Homepage"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/detail.html:58
+msgid "Download"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/detail.html:61
+msgid "Shell version…"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/detail.html:65
+msgid "Extension version…"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/detail.html:74
+msgid ""
+"A reviewer will review the extension you submitted to make sure there's "
+"nothing too dangerous. You'll be emailed the result of the review."
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/list.html:13
+msgid "Search for extensions…"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/local.html:3
+#: sweettooth/extensions/templates/extensions/local.html:8
+msgid "Installed Extensions"
+msgstr ""
+
+#: sweettooth/extensions/templates/extensions/local.html:5
+msgid "Shell settings"
+msgstr ""
+
+#: sweettooth/ratings/admin.py:13
+msgid "Content"
+msgstr ""
+
+#: sweettooth/ratings/admin.py:16
+msgid "Metadata"
+msgstr ""
+
+#: sweettooth/ratings/templates/comments/form.html:8
+#: sweettooth/ratings/templates/comments/preview.html:27
+msgid "What do you think about this GNOME extension?"
+msgstr ""
+
+#: sweettooth/ratings/templates/comments/form.html:26
+#: sweettooth/ratings/templates/comments/preview.html:45
+msgid "Post"
+msgstr ""
+
+#: sweettooth/ratings/templates/comments/form.html:27
+#: sweettooth/ratings/templates/comments/preview.html:46
+msgid "Preview"
+msgstr ""
+
+#: sweettooth/ratings/templates/comments/preview.html:4
+#: sweettooth/ratings/templates/comments/preview.html:15
+msgid "Preview your comment"
+msgstr ""
+
+#: sweettooth/ratings/templates/comments/preview.html:13
+msgid "Please correct the error below"
+msgid_plural "Please correct the errors below"
+msgstr[0] ""
+msgstr[1] ""
+
+#: sweettooth/ratings/templates/comments/preview.html:18
+msgid "Post Comment"
+msgstr ""
+
+#: sweettooth/ratings/templates/comments/preview.html:21
+msgid "Edit your comment"
+msgstr ""
+
+#: sweettooth/templates/base.html:16
+msgid "Latest extensions in GNOME Shell Extensions"
+msgstr ""
+
+#: sweettooth/templates/base.html:17 sweettooth/templates/base.html:50
+msgid "GNOME Shell Extensions"
+msgstr ""
+
+#: sweettooth/templates/usermenu.html:5
+msgid "User Profile"
+msgstr ""
+
+#: sweettooth/templates/usermenu.html:6
+msgid "User Settings"
+msgstr ""
+
+#: sweettooth/templates/usermenu.html:7
+msgid "Log out"
+msgstr ""
diff --git a/sweettooth/locale/en/LC_MESSAGES/djangojs.po b/sweettooth/locale/en/LC_MESSAGES/djangojs.po
new file mode 100644
index 0000000..5fb1752
--- /dev/null
+++ b/sweettooth/locale/en/LC_MESSAGES/djangojs.po
@@ -0,0 +1,42 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2019-01-12 14:45+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL li org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: sweettooth/static/js/fsui.js:40
+msgid "Name"
+msgstr ""
+
+#: sweettooth/static/js/fsui.js:41
+msgid "Recent"
+msgstr ""
+
+#: sweettooth/static/js/fsui.js:42
+msgid "Downloads"
+msgstr ""
+
+#: sweettooth/static/js/fsui.js:43
+msgid "Popularity"
+msgstr ""
+
+#: sweettooth/static/js/fsui.js:73
+msgid "Sort by"
+msgstr ""
+
+#: sweettooth/static/js/fsui.js:124
+msgid "Compatible with"
+msgstr ""
diff --git a/sweettooth/ratings/templates/comments/preview.html 
b/sweettooth/ratings/templates/comments/preview.html
index 1ceda52..4d535af 100644
--- a/sweettooth/ratings/templates/comments/preview.html
+++ b/sweettooth/ratings/templates/comments/preview.html
@@ -10,8 +10,7 @@
             {% if next %}
                 <div><input type="hidden" name="next" value="{{ next }}"/></div>{% endif %}
             {% if form.errors %}
-                <h2>{% blocktrans count counter=form.errors|length %}Please correct the error below{% plural 
%}Please
-                    correct the errors below{% endblocktrans %}</h2>
+                <h2>{% blocktrans count counter=form.errors|length %}Please correct the error below{% plural 
%}Please correct the errors below{% endblocktrans %}</h2>
             {% else %}
                 <h2>{% trans "Preview your comment" %}</h2>
                 <blockquote>{{ comment|linebreaks }}</blockquote>
diff --git a/sweettooth/settings.py b/sweettooth/settings.py
index bb099c7..44c7c3f 100644
--- a/sweettooth/settings.py
+++ b/sweettooth/settings.py
@@ -58,6 +58,7 @@ INSTALLED_APPS = (
 MIDDLEWARE = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.locale.LocaleMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
     'django.middleware.security.SecurityMiddleware',
@@ -109,6 +110,8 @@ DATABASES = {
 
 LANGUAGE_CODE = 'en-us'
 
+LOCALE_PATHS = [os.path.join(BASE_DIR, 'sweettooth', 'locale')]
+
 TIME_ZONE = 'UTC'
 
 USE_I18N = True
diff --git a/sweettooth/static/js/fsui.js b/sweettooth/static/js/fsui.js
index b665612..f81575d 100644
--- a/sweettooth/static/js/fsui.js
+++ b/sweettooth/static/js/fsui.js
@@ -37,10 +37,10 @@ define(['jquery', 'dbus!_', 'hashParamUtils', 'modal'],
                }
 
                var sortCriteria = {
-                       'name': "Name",
-                       'recent': "Recent",
-                       'downloads': "Downloads",
-                       'popularity': "Popularity"
+                       'name': gettext("Name"),
+                       'recent': gettext("Recent"),
+                       'downloads': gettext("Downloads"),
+                       'popularity': gettext("Popularity")
                };
 
                $.fn.fsUIify = function () {
@@ -70,7 +70,7 @@ define(['jquery', 'dbus!_', 'hashParamUtils', 'modal'],
 
                                var $fsui = $('<div>', {'class': 'fsui'}).appendTo($elem);
 
-                               $fsui.append('<span>Sort by</span>');
+                               $fsui.append('<span>' + gettext('Sort by') + '</span>');
 
                                var $link;
 
@@ -121,7 +121,7 @@ define(['jquery', 'dbus!_', 'hashParamUtils', 'modal'],
                                        }
                                }
 
-                               $fsui.append('<span>Compatible with</span>');
+                               $fsui.append('<span>' + gettext('Compatible with') + '</span>');
 
                                $link = makeDropdownLink(textForFilterValue(shellVersion)).click(function () {
                                        var $dropdown = makeDropdown($fsui, $(this));
diff --git a/sweettooth/templates/base.html b/sweettooth/templates/base.html
index 92cd872..5c8583a 100644
--- a/sweettooth/templates/base.html
+++ b/sweettooth/templates/base.html
@@ -1,8 +1,9 @@
+{% load static from staticfiles %}
+{% load gravatar %}
+{% load i18n %}
 <!doctype html>
 <html>
   <head>
-    {% load static from staticfiles %}
-    {% load gravatar %}
     <meta charset="utf-8" />
     <meta name="google-site-verification" content="FqL97fLHaUM8zWWqkc4ZrvY-u9MikPkV0QshIzc-Bp8" />
     <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -12,8 +13,8 @@
     <link rel="stylesheet" href="{% static 'css/style.css' %}" />
     <link rel="shortcut icon" href="{% static 'images/favicon.png' %}" />
     <link rel="alternate" type="application/rss+xml"
-          href="{% url 'extensions-rss-feed' %}" title="Latest extensions in GNOME Shell Extensions" />
-    <title>{% block title %}GNOME Shell Extensions{% endblock %}</title>
+          href="{% url 'extensions-rss-feed' %}" title="{% trans 'Latest extensions in GNOME Shell 
Extensions' %}" />
+    <title>{% block title %}{% trans "GNOME Shell Extensions" %}{% endblock %}</title>
     <script>
         {% load static_paths %}
         var require = {
@@ -24,6 +25,7 @@
 
         var django_static_images = {% static_img_paths %};
     </script>
+    <script src="{% url 'javascript-catalog' %}"></script>
     <script src="{% static 'js/browser_extension.js' %}"></script>
     <script src="{% static 'js/require.js' %}"></script>
     <script src="{% static 'js/jquery.js' %}"></script>
@@ -45,7 +47,7 @@
                         <span class="icon-bar middle-bar"></span>
                         <span class="icon-bar bottom-bar"></span>
                     </button>
-                    <a class="gnome-navbar-brand" title="GNOME Shell Extensions" href="/"><img src="{% 
static 'images/gnome-extensions.svg' %}" alt="GNOME Shell Extensions" /></a>
+                    <a class="gnome-navbar-brand" title="{% trans 'GNOME Shell Extensions' %}" href="/"><img 
src="{% static 'images/gnome-extensions.svg' %}" alt="GNOME Shell Extensions" /></a>
                     <ul class="nav navbar-nav icons visible-xs">
                         {% if n_unreviewed_extensions %}
                         <li>
@@ -67,7 +69,7 @@
                     {% if request.user.is_authenticated %}
                         <a href="{% url 'auth-profile' user=request.user.username %}" class="dropdown-toggle 
hidden-xs avatar" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><img 
src="{% gravatar_url request request.user.email %}"></a>
                     {% else %}
-                        <a href="{% url 'auth-login' %}" class="dropdown-toggle hidden-xs" 
data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Log in <span 
class="caret"></span></a>
+                        <a href="{% url 'auth-login' %}" class="dropdown-toggle hidden-xs" 
data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Log in" %} <span 
class="caret"></span></a>
                     {% endif %}
                     {% endspaceless %}
                         <ul class="dropdown-menu login_popup_form">
diff --git a/sweettooth/templates/usermenu.html b/sweettooth/templates/usermenu.html
index a2526c2..9b58d57 100644
--- a/sweettooth/templates/usermenu.html
+++ b/sweettooth/templates/usermenu.html
@@ -1,9 +1,10 @@
+{% load i18n %}
 {% if request.user.is_authenticated %}
 <div class="row">
     <div class="col-sm-12">
-        <p><a class="btn btn-link no-decoration" href="{% url 'auth-profile' user=request.user.username 
%}">User Profile</a></p>
-        <p><a class="btn btn-link no-decoration" href="{% url 'auth-settings' user=request.user.username 
%}">User Settings</a></p>
-        <p><a class="btn btn-link no-decoration" href="{% url 'auth-logout' %}">Log out</a></p>
+        <p><a class="btn btn-link no-decoration" href="{% url 'auth-profile' user=request.user.username 
%}">{% trans "User Profile" %}</a></p>
+        <p><a class="btn btn-link no-decoration" href="{% url 'auth-settings' user=request.user.username 
%}">{% trans "User Settings" %}</a></p>
+        <p><a class="btn btn-link no-decoration" href="{% url 'auth-logout' %}">{% trans "Log out" %}</a></p>
     </div>
 </div>
 {% else %}
diff --git a/sweettooth/urls.py b/sweettooth/urls.py
index 21edfc1..7867976 100644
--- a/sweettooth/urls.py
+++ b/sweettooth/urls.py
@@ -8,6 +8,8 @@ from django.http import HttpResponse
 from django.contrib import admin
 from django.views import static
 from django.views.generic.base import TemplateView
+from django.views.i18n import JavaScriptCatalog
+
 admin.autodiscover()
 
 urlpatterns = [
@@ -18,6 +20,7 @@ urlpatterns = [
     url(r'^review/', include('sweettooth.review.urls')),
     url(r'^errors/', include('sweettooth.errorreports.urls')),
 
+    url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
     url(r'^admin/', include(admin.site.urls)),
     url(r'^comments/', include('sweettooth.ratings.urls')),
     url(r'^comments/', include('django_comments.urls')),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]