]> git.0d.be Git - panikweb.git/commitdiff
add French/English switch
authorFrédéric Péters <fpeters@0d.be>
Fri, 10 Apr 2015 12:47:15 +0000 (14:47 +0200)
committerFrédéric Péters <fpeters@0d.be>
Fri, 10 Apr 2015 12:47:15 +0000 (14:47 +0200)
17 files changed:
panikweb/paniktags/templatetags/paniktags.py
panikweb/settings.py
panikweb_templates/locale/fr/LC_MESSAGES/django.po
panikweb_templates/static/css/specifics.css
panikweb_templates/static/js/specifics.js
panikweb_templates/templates/agenda.html
panikweb_templates/templates/emissions.html
panikweb_templates/templates/emissions/archives.html
panikweb_templates/templates/emissions/emission_detail.html
panikweb_templates/templates/emissions/nav.html
panikweb_templates/templates/grid.html
panikweb_templates/templates/home.html
panikweb_templates/templates/includes/metaNav.html
panikweb_templates/templates/listen.html
panikweb_templates/templates/news.html
panikweb_templates/templates/news/archives.html
panikweb_templates/templates/program.html

index a0338e1a2126a9fd93b29bd526e685a78af72596..244e8c4f58140072b923ac263b9effedaf34ec6d 100644 (file)
@@ -125,8 +125,9 @@ def player(context):
 @register.inclusion_tag('includes/metaNav.html', takes_context=True)
 def metanav(context, active=None):
     return {
+        'LANGUAGE_CODE': context.get('LANGUAGE_CODE'),
         'sectionName': context.get('sectionName')
-       }
+        }
 
 @register.inclusion_tag('includes/week.html')
 def weekview(year=None, week=None):
index 85d1a3ea8d470cde03b4b42cdbc2579c95201203..b7ac0ca84bdffb2243129471513c5393950e17cd 100644 (file)
@@ -47,6 +47,7 @@ LANGUAGE_CODE = 'fr-be'
 
 LANGUAGES = (
   ('fr', u'Français'),
+  ('en', u'English'),
 )
 
 SITE_ID = 1
@@ -106,6 +107,7 @@ MIDDLEWARE_CLASSES = (
     'django.middleware.cache.UpdateCacheMiddleware',
     #'django.middleware.gzip.GZipMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.locale.LocaleMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -227,7 +229,7 @@ COMBO_PUBLIC_TEMPLATES = {
     },
 }
 
-
+LANGUAGE_COOKIE_NAME = 'panikweb_language'
 
 try:
     from local_settings import *
index 311ec60597af969d09e6e5f5225762b123a742d4..9976314419ceb52eb1652ccbad62f62593f16640 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: panikweb_templates 0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-09-07 14:29+0200\n"
+"POT-Creation-Date: 2015-04-10 14:42+0200\n"
 "PO-Revision-Date: 2013-09-07 14:22+0200\n"
 "Last-Translator: Frederic Peters <fpeters@0d.be>\n"
 "Language: fr\n"
@@ -17,31 +17,88 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n > 1);\n"
 
-#: templates/includes/metaNav.html:7
-msgid "Home"
-msgstr "Accueil"
+#: templates/agenda.html:60 templates/home.html:38 templates/news.html:42
+msgid "Latest News"
+msgstr "Dernières actus"
+
+#: templates/emissions.html:6 templates/emissions/archives.html:6
+#: templates/emissions/emission_detail.html:17 templates/grid.html:6
+#: templates/home.html:16 templates/includes/metaNav.html:18
+msgid "Program"
+msgstr "Programme"
 
-#: templates/includes/metaNav.html:11
+#: templates/emissions/emission_detail.html:39
+#: templates/includes/metaNav.html:10 templates/news.html:3
+#: templates/news.html.py:5 templates/news/archives.html:3
 msgid "News"
 msgstr "Actus"
 
-#: templates/includes/metaNav.html:15
-msgid "Listen"
-msgstr "Sons"
+#: templates/emissions/emission_detail.html:59
+msgid "Coming Soon"
+msgstr "À venir"
 
-#: templates/includes/metaNav.html:19
-msgid "Program"
-msgstr "Programme"
+#: templates/emissions/emission_detail.html:68
+msgid "Previously"
+msgstr "Précédemment"
+
+#: templates/emissions/nav.html:8 templates/grid.html:4
+msgid "Grid"
+msgstr "La grille"
+
+#: templates/emissions/nav.html:11
+msgid "By Week"
+msgstr "Par semaine"
+
+#: templates/emissions/nav.html:14
+msgid "Emissions"
+msgstr "Émissions"
+
+#: templates/emissions/nav.html:17
+msgid "Archives"
+msgstr "Archives"
 
-#: templates/includes/metaNav.html:23
+#: templates/home.html:4 templates/includes/metaNav.html:6
+msgid "Home"
+msgstr "Accueil"
+
+#: templates/home.html:17
+msgid "This week on Panik"
+msgstr "Cette semaine sur Panik"
+
+#: templates/home.html:24
+msgid "Every Monday, the news of the Panik week:"
+msgstr "Tous les lundis, l'actualité de la semaine de Panik :"
+
+#: templates/home.html:26
+msgid "Subscribe"
+msgstr "M'inscrire"
+
+#: templates/home.html:31 templates/listen.html:20 templates/news.html:21
+msgid "Focus"
+msgstr "Focus"
+
+#: templates/home.html:52 templates/listen.html:65
+msgid "Latest Sounds"
+msgstr "Derniers sons"
+
+#: templates/home.html:66
+msgid "New emissions"
+msgstr "Nouvelles émissions"
+
+#: templates/includes/metaNav.html:14 templates/listen.html:3
+#: templates/listen.html.py:5
+msgid "Sounds"
+msgstr "Sons"
+
+#: templates/includes/metaNav.html:22
 msgid "About"
 msgstr "À propos"
 
-#: templates/includes/metaNav.html:27
+#: templates/includes/metaNav.html:31
 msgid "Search"
 msgstr "Recherche"
 
-#: templates/includes/player.html:8
+#: templates/includes/player.html:8 templates/includes/player.html.py:9
 msgid "Get the stream on your player!"
 msgstr "Récupérez le stream sur votre lecteur !"
 
@@ -52,3 +109,6 @@ msgstr "Besoin d'aide ?"
 #: templates/includes/player.html:14
 msgid "live"
 msgstr "en direct"
+
+#~ msgid "Listen"
+#~ msgstr "Sons"
index 441f9e2de12d9be5324d60ecc7390d84cee09519..55f4537c04aed54de05cb3169372a80c99da0e73 100644 (file)
@@ -236,6 +236,16 @@ body{
        display:block;
 }
 
+#metaNav ul li#nav-language span {
+       cursor: pointer;
+       padding:0.4em 0 0.5em 0;
+       display: inline-block;
+}
+
+#metaNav ul li#nav-language span.lang-on {
+       color: white;
+}
+
 #metaNav ul li a span{
     padding:0.4em 0 0.5em 0;
        display:inline-block;
index 82c25f8eba082139c71e53f5347f97b79050a347..d73468932b5c9cabd76be71453c60bdbbd9dddba 100644 (file)
@@ -489,6 +489,11 @@ $(function() {
                        });
                });
 
+               $('#nav-language span').click(function() {
+                       document.cookie = 'panikweb_language=' + $(this).data('lang') + '; path=/';
+                       window.location = window.location;
+                       return false;
+               });
 
                if (document.cookie.indexOf('panikdb=on') != -1) {
                        panikdb_path = null;
index 4e0aa916e86742ea0e3859dac723a12fa84f0db8..24c3bd7ddd1d262ec22770716be53e1c2d80635e 100644 (file)
@@ -1,6 +1,6 @@
 {% extends "base.html"%}
 {% load paniktags i18n %}
-{% block title %}Actus{% endblock %}
+{% block title %}{% trnas 'Actus' %}{% endblock %}
 {% block toptitle %}
 <h1 class="top"><a href="{% url 'news' %}">Actus</a> - L'agenda</h1>
 {% endblock %}
@@ -57,7 +57,7 @@ vous fait savoir.
                                    </a>
                     </h5>
                                        <h5 class="sectionLabel">
-                            <span class="iconLabel">Dernières actus</span>
+                            <span class="iconLabel">{% trans 'Latest News'%}</span>
                             <a class="button icon-rss inBlock" href="{% url 'rss-feed' %}"></a>
                     </h5>
 
index b2cdd7b5cd593ce875f23df1ceb05a672c56cb3d..8d4c0d2610bb5dc754aa5348e95637dcb55b0030 100644 (file)
@@ -1,9 +1,9 @@
 {% extends "base.html" %}
-{% load paniktags %}
+{% load paniktags i18n %}
 {% block bodyID %}Emissions{% endblock %}
 {% block title %}Émissions{% endblock %}
 {% block toptitle %}
-<h1 class="top"><a href="{% url 'grid' %}">Programme</a></h1>
+<h1 class="top"><a href="{% url 'grid' %}">{% trans 'Program' %}</a></h1>
 {% endblock %}
 {% block nav %}
        {% emission_nav with klass="emissions" %}
index 01ae50114fda1ab09ce43c5d0acd37f66d78cc0c..758d34840aa9a2c2be69cf37160eb7081a8020bc 100644 (file)
@@ -1,9 +1,9 @@
 {% extends "emissions.html" %}
-{% load paniktags %}
+{% load paniktags i18n%}
 {% block bodyID %}Emissions{% endblock %}
 {% block title %}Archives{% endblock %}
 {% block toptitle %}
-<h1 class="top"><a href="{% url 'grid' %}">Programme</a></h1>
+<h1 class="top"><a href="{% url 'grid' %}">{% trans 'Program' %}</a></h1>
 {% endblock %}
 {% block nav %}
        {% emission_nav with klass="archives" %}
index 60e5124adcd8743961198ef064ee64459d121f5e..0d8a0cb51d277a83a152cce31041e29de7f66863 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "emissions.html" %}
-{% load paniktags thumbnails staticfiles %}
+{% load paniktags thumbnails staticfiles i18n %}
 {% block bodyID %}Emissions{% endblock %}
 {% block title %}{{ emission.title }}{% endblock %}
 
@@ -14,7 +14,7 @@
 {% endblock %}
 
 {% block toptitle %}
-<h1 class="top"><a href="{% url 'grid' %}">Programme</a></h1>
+<h1 class="top"><a href="{% url 'grid' %}">{% trans 'Program' %}</a></h1>
 {% endblock %}
 {% block nav %}
        {% emission_nav %}
@@ -36,7 +36,7 @@
 
                                {% if news %}
                                        <div class="sub emissions-newsitems">
-                                               <h5 class="sectionLabel">Actu</h5>
+                                               <h5 class="sectionLabel">{% trans 'News' %}</h5>
                                                <ul class="custom list">
                                                {% for content in news %}
                                                        <li>{% news_inline %}</li>
@@ -56,7 +56,7 @@
 
                                {% if futurEpisodes %}
                                        <div class="sub futur-episodes">
-                                               <h5 class="sectionLabel">À venir</h5>
+                                               <h5 class="sectionLabel">{% trans 'Coming Soon' %}</h5>
                                                {% for episode in futurEpisodes|slice:":3" %}
                                                        {% episode_inline %}
                                                {% endfor %}
@@ -65,7 +65,7 @@
 
                                {% if episodes %}
                                        <div class="sub recent-episodes">
-                                               <h5 class="sectionLabel">Précédemment</h5>
+                                               <h5 class="sectionLabel">{% trans 'Previously' %}</h5>
 
                                                {% with episodes|slice:"0:5" as episodes %}
                                                        {% for episode in episodes %}
index 9204935656e65ba720e98e4fe1d8e26bad07513b..fc1f4ff82c6590bdc3ec34b92ac9ee4ba968a5c3 100644 (file)
@@ -1,19 +1,20 @@
+{% load i18n %}
 
 <div class="mainSub">
     <div class="wrapper">
            <nav>
                    <ul class="inline padded">
                            <li><a href="{% url 'grid' %}" class="{% if class = "grid" %}active{% endif %}">
-                                   <span class="iconLabel">La grille</span>
+                                   <span class="iconLabel">{% trans 'Grid' %}</span>
                            </a></li>
                            <li><a href="{% url 'program' %}" class="{% if class = "program" %}active{% endif %}">
-                                   <span class="iconLabel">Par semaine</span>
+                                   <span class="iconLabel">{% trans 'By Week' %}</span>
                            </a></li>
                            <li><a href="{% url 'emissions' %}" class="{% if class != "program" and class != "grid" and class != "archives" %}active{% endif %}">
-                                   <span class="iconLabel">Émissions</span>
+                                   <span class="iconLabel">{% trans 'Emissions' %}</span>
                            </a></li>
                            <li><a href="{% url 'emissionsArchives' %}" class="{% if class = "archives" %}active{% endif %}">
-                                   <span class="iconLabel">Archives</span>
+                                   <span class="iconLabel">{% trans 'Archives' %}</span>
                            </a></li>
                    </ul>
            </nav>
index 9214439ac327f920cadcfa90b86c71e7706ef208..a5d98d7b528e8742028c7d525878b7a28bc3a212 100644 (file)
@@ -1,9 +1,9 @@
 {% extends "emissions.html" %}
-{% load paniktags %}
+{% load paniktags i18n %}
 {% block bodyID %}Grid{% endblock %}
-{% block title %}La grille{% endblock %}
+{% block title %}{% trans 'Grid' %}{% endblock %}
 {% block toptitle %}
-<h1 class="top"><a href="{% url 'grid' %}">Programme</a></h1>
+<h1 class="top"><a href="{% url 'grid' %}">{% trans 'Program' %}</a></h1>
 {% endblock %}
 {% block nav %}
        {% emission_nav with klass="grid" %}
index d40b123dfc517a41a051b16f1272bfa082e3fadc..68d7b1fd24f72a6236f5354841746faa85a42c72 100644 (file)
@@ -1,7 +1,7 @@
 {% extends "base.html" %}
-{% load thumbnails paniktags staticfiles %}
+{% load thumbnails paniktags staticfiles i18n %}
 {% block bodyID %}Home{% endblock %}
-{% block title %}Accueil{% endblock %}
+{% block title %}{% trans 'Home' %}{% endblock %}
 
 {% block head %}
 <meta property="og:title" content="Radio Panik - 105.4 FM" />
 <div class="sided wrapper navigation" id="specialHome">
     <div>
            <div class="leftPart">
-                   <h1 class="top"><a href="{% url 'grid' %}">Programme</a></h1>
-                   <h2><a href="{% url 'program' %}">Cette semaine sur Panik</a></h2>
+                   <h1 class="top"><a href="{% url 'grid' %}">{% trans 'Program' %}</a></h1>
+                   <h2><a href="{% url 'program' %}">{% trans 'This week on Panik' %}</a></h2>
 
                    {% weeknav %}
                    {% weekview %}
 
              <form method="post" action="{% url 'newsletter-subscribe' %}"
                      class="marged" id="subscribe-form">
-             <p>Tous les lundis, l'actualité de la semaine de Panik :</p>
+             <p>{% trans 'Every Monday, the news of the Panik week:' %}</p>
                {{ newsletter_form.as_table }}
-               <button>M'inscrire</button>
+               <button>{% trans 'Subscribe' %}</button>
              </form>
            </div>
 
            <div class="rightPart">
-                   <h1 class="top">Focus</h1>
+                   <h1 class="top">{% trans 'Focus' %}</h1>
                    {% newsroll %}
 
             {% if newsitems %}
 
                    <div id="recent-news">
                    <h3 class="sectionLabel right"><a href="{% url 'newsArchives' %}">Toutes</a></h3>
-                   <h3 class="sectionLabel"><a href="{% url 'news' %}">Dernières actus</a>&nbsp;<a class="button icon-rss inBlock" href="{% url 'atom-feed' %}"></a></h3>
+                   <h3 class="sectionLabel"><a href="{% url 'news' %}">{% trans 'Latest News' %}</a>&nbsp;<a class="button icon-rss inBlock" href="{% url 'atom-feed' %}"></a></h3>
                    <ul class="custom list">
                    {% for content in newsitems %}
                    <li class="item">{% news_inline %}</li>
@@ -49,7 +49,7 @@
 
                    <div id="recent-sounds">
                    <h3 class="sectionLabel right"><a href="{% url 'listenArchives' %}">Tous</a></h3>
-                   <h3 class="sectionLabel"><a href="{% url 'listen' %}">Derniers sons</a>&nbsp;<a class="button icon-rss inBlock" href="{% url 'podcasts-feed' %}"></a></h3>
+                   <h3 class="sectionLabel"><a href="{% url 'listen' %}">{% trans 'Latest Sounds' %}</a>&nbsp;<a class="button icon-rss inBlock" href="{% url 'podcasts-feed' %}"></a></h3>
                    <ul class="custom list">
                    {% for soundfile in soundfiles %}
                            <li class="item {% for category in soundfile.episode.emission.categories.all %} {{ category|slugify }}{% endfor %}">
@@ -63,7 +63,7 @@
             {% if emissions %}
                    <div id="recent-emissions">
                    <h3 class="sectionLabel right"><a href="{% url 'emissions' %}">Toutes</a></h3>
-                   <h3 class="sectionLabel">Nouvelles émissions</h3>
+                   <h3 class="sectionLabel">{% trans 'New emissions' %}</h3>
                    <ul class="custom list padded">
                    {% for emission in emissions %}
                            <li class="item">
index 9c869f8759d9e37c7bb76843c60e5a4473c51693..a214db49b49fd7202ad17b345098c1251805191e 100644 (file)
@@ -11,7 +11,7 @@
                        </a></li>
                        <li class="{% if sectionName = "Listen" %}active{% endif %}"><a title="Derniers contenus écoutables publiés" href="{% url 'listen' %}">
                                <span class="nav-icon icon-headphones resymbol" ></span>
-                               <span class="iconLabel">{% trans 'Listen' %}</span>
+                               <span class="iconLabel">{% trans 'Sounds' %}</span>
                        </a></li>
                        <li class="{% if sectionName = "Emissions" %}active{% endif %}"><a title="Les émissions, le programme de la semaine, la grille" href="{% url 'grid' %}">
                                <span class="nav-icon icon-calendar resymbol" ></span>
                                <span class="nav-icon icon-info-sign" ></span>
                                <span class="iconLabel">{% trans 'About' %}</span>
                        </a></li>
+                       <li id="nav-language">
+                       <span data-lang="fr" {% if LANGUAGE_CODE == 'fr' %}class="lang-on"{% endif %}>FR</span></a>
+                       /
+                       <span data-lang="en"{% if LANGUAGE_CODE == 'en' %}class="lang-on"{% endif %}>EN</span>
+                       </li>
                        <li id="nav-search" class="{% if sectionName = "Search" %}active{% endif %}"><a href="{% url 'search' %}">
                                <span class="nav-icon icon-search resymbol" ></span>
                                <span class="iconLabel">{% trans 'Search' %}</span>
index 2b856651ef987d968045f6e5dba8ed511c292e66..986cd0ac120a136e86191ceca03971b017c280ad 100644 (file)
@@ -1,8 +1,8 @@
 {% extends "base.html" %}
-{% load paniktags staticfiles thumbnails  %}
-{% block title %}Sons{% endblock %}
+{% load paniktags staticfiles thumbnails i18n %}
+{% block title %}{% trans 'Sounds' %}{% endblock %}
 {% block toptitle %}
-<h1 class="top"><a href="{% url 'listen' %}">Sons</a></h1>
+<h1 class="top"><a href="{% url 'listen' %}">{% trans 'Sounds' %}</a></h1>
 {% endblock %}
 {% block nav %}
 {% endblock %}
@@ -17,7 +17,7 @@
 
     <div class="leftPart">
       <div class="soundfiles">
-        <h5 class="sectionLabel focus-title">Focus</h5>
+        <h5 class="sectionLabel focus-title">{% trans 'Focus' %}</h5>
 
         <ul class="custom columns cf padded">
         {% for soundfile in focus %}
@@ -62,7 +62,7 @@
         <h5 class="sectionLabel right">
           <a href="{% url 'listenArchives' %}"><span class="iconLabel">Tous</span></a>
         </h5>
-        <h5 class="sectionLabel">Derniers sons&nbsp;<a
+        <h5 class="sectionLabel">{% trans 'Latest Sounds' %}&nbsp;<a
                         class="button icon-rss inBlock" href="{% url 'podcasts-feed' %}"></a></h5>
 
        <form action="{% url 'listenArchives' %}" id="search-form">
index e3e47c622e9191dff67c9b46ba14ba544ca80f5d..1e0e7d30cf52bc690194156b8f96fc3577247646 100644 (file)
@@ -1,8 +1,8 @@
 {% extends "base.html"%}
 {% load paniktags i18n %}
-{% block title %}Actus{% endblock %}
+{% block title %}{% trans 'News' %}{% endblock %}
 {% block toptitle %}
-<h1 class="top"><a href="{% url 'news' %}">Actus</a></h1>
+<h1 class="top"><a href="{% url 'news' %}">{% trans 'News' %}</a></h1>
 {% endblock %}
 {% block nav %}
        {% news_nav %}
@@ -18,7 +18,7 @@ vous fait savoir.
 
                <div class="leftPart">
             <div class="news">
-                                   <h5 class="sectionLabel focus-title">Focus</h5>
+                                   <h5 class="sectionLabel focus-title">{% trans 'Focus' %}</h5>
 
                    {% with focus as news %}
                            <ul class="custom columns cf padded">
@@ -39,7 +39,7 @@ vous fait savoir.
                                    </a>
                     </h5>
                                        <h5 class="sectionLabel">
-                            <span class="iconLabel">Dernières actus</span>
+                            <span class="iconLabel">{% trans 'Latest News' %}</span>
                             <a class="button icon-rss inBlock" href="{% url 'rss-feed' %}"></a>
                     </h5>
 
index 57af0e32a7c57323b6ec0734169204374c321473..c330e440d0ca179e447a3238d99a890750928bec 100644 (file)
@@ -1,6 +1,6 @@
 {% extends "news.html" %}
-{% load thumbnails paniktags %}
-{% block title %}Actus - Archives{% endblock %}
+{% load thumbnails paniktags i18n %}
+{% block title %}{% trans 'News' %} - Archives{% endblock %}
 {% block nav %}
        <div class="search-filters">
                {% if facets.fields.news_categories %}
index e1b1e4078f6cf80f981f8f803c8d1dfc3e8a159f..4ceeb766cfe803713746e04d9fd50471515285a7 100644 (file)
@@ -1,9 +1,9 @@
 {% extends "emissions.html" %}
-{% load paniktags %}
+{% load paniktags i18n %}
 {% block bodyID %}Program{% endblock %}
-{% block title %}Programme{% endblock %}
+{% block title %}{% trans 'Program' %}{% endblock %}
 {% block toptitle %}
-<h1 class="top"><a href="{% url 'grid' %}">Programme</a></h1>
+<h1 class="top"><a href="{% url 'grid' %}">{% trans 'Program' %}</a></h1>
 {% endblock %}
 {% block nav %}
        {% emission_nav with klass="program" %}