add translations
authorymh <ymh.work@gmail.com>
Mon, 11 Jun 2012 13:05:44 +0200
changeset 52 04da822a4b08
parent 51 b5f84b880a46
child 53 b4b226944789
add translations
web/tralalere/locale/fr/LC_MESSAGES/django.mo
web/tralalere/locale/fr/LC_MESSAGES/django.po
web/tralalere/settings.py
web/tralalere/templates/home.html
web/tralalere/views.py
Binary file web/tralalere/locale/fr/LC_MESSAGES/django.mo has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/tralalere/locale/fr/LC_MESSAGES/django.po	Mon Jun 11 13:05:44 2012 +0200
@@ -0,0 +1,78 @@
+# 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.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-06-11 04:05-0500\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=2; plural=(n > 1)\n"
+
+#: settings.py:40
+msgid "French"
+msgstr "Français"
+
+#: templates/home.html:7
+msgid "Mets tes couleurs, tes émotions<br />et ta voix sur la musique !"
+msgstr "Mets tes couleurs, tes émotions<br />et ta voix sur la musique !"
+
+#: templates/admin/base_site.html:4
+msgid "Django site admin"
+msgstr "Site d'administration Django"
+
+#: templates/admin/base_site.html:7
+msgid "Django administration"
+msgstr "Administration Django"
+
+#: templates/registration/login.html:17
+msgid "Log in"
+msgstr "Connexion"
+
+#: templates/registration/login.html:20
+msgid "Sorry, that's not a valid username or password."
+msgstr "Désolé, ce n'est pas un nom d'utilisateur valide"
+
+#: templates/registration/login.html:31
+msgid "Forget password?"
+msgstr "Mot de passe oublié"
+
+#: templates/registration/login.html:34
+msgid "login"
+msgstr "login"
+
+#: templates/registration/login.html:41
+msgid "Or login with your external account"
+msgstr "Ou se connecter avec votre compte externe"
+
+msgid "red"
+msgstr "rouge"
+
+msgid "yellow"
+msgstr "jaune"
+
+msgid "green"
+msgstr "vert"
+
+msgid "blue"
+msgstr "bleue"
+
+msgid "happy"
+msgstr "content"
+
+msgid "unhappy"
+msgstr "mécontent"
+
+msgid "laughing"
+msgstr "rieur"
+
+msgid "surprised"
+msgstr "surpris"
--- a/web/tralalere/settings.py	Mon Jun 11 10:25:55 2012 +0200
+++ b/web/tralalere/settings.py	Mon Jun 11 13:05:44 2012 +0200
@@ -28,11 +28,18 @@
 # timezone as the operating system.
 # If running in a Windows environment this must be set to the same as your
 # system time zone.
-TIME_ZONE = 'America/Chicago'
+TIME_ZONE = 'UTC'
 
 # Language code for this installation. All choices can be found here:
 # http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'en-us'
+LANGUAGE_CODE = 'fr-fr'
+
+ugettext = lambda s:s
+
+LANGUAGES = (
+  ('fr', ugettext('French')),
+)
+
 
 SITE_ID = 1
 
@@ -94,11 +101,12 @@
 from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
 TEMPLATE_CONTEXT_PROCESSORS += (
     "django.core.context_processors.request",
+    'django.core.context_processors.i18n',
     "ldt.utils.context_processors.ldt_context",
 )
 
 MIDDLEWARE_CLASSES = (
-    'django.middleware.gzip.GZipMiddleware',                      
+    'django.middleware.gzip.GZipMiddleware',
     'django.middleware.cache.UpdateCacheMiddleware',
     'django.middleware.common.CommonMiddleware',
     'django.middleware.cache.FetchFromCacheMiddleware',
--- a/web/tralalere/templates/home.html	Mon Jun 11 10:25:55 2012 +0200
+++ b/web/tralalere/templates/home.html	Mon Jun 11 13:05:44 2012 +0200
@@ -1,9 +1,10 @@
 {% extends "base.html" %}
 {% block main_content %}
 {% load thumbnail %}
+{% load i18n %}
             <div class="home-header">
                 <h1>Musitag</h1>
-                <h2>Mets tes couleurs, tes émotions<br />et ta voix sur la musique !</h2>
+                <h2>{% trans "Mets tes couleurs, tes émotions<br />et ta voix sur la musique !" %}</h2>
             </div>
             
             {% for content in contents %}
@@ -21,9 +22,9 @@
                 {% if content.tags_stats.colors %}
                 <ul class="home-dataviz home-dataviz-colors">
                 {% for tag in content.tags_stats.colors %}
-                    <li style="width: {{tag.width}}px">
+                    <li style="width: {{tag.width}}px" alt="{% trans tag.tag %}">
                     {% if tag.scale == 1 %}
-                        <div class="tag-container-50">
+                        <div class="tag-container-50" >
                     {% else %}
                         <div class="tag-container-50" style="-webkit-transform-origin: bottom left; -webkit-transform: scale({{tag.scale}}); -moz-transform-origin: bottom left; -moz-transform: scale({{tag.scale}});">
                     {% endif %}
--- a/web/tralalere/views.py	Mon Jun 11 10:25:55 2012 +0200
+++ b/web/tralalere/views.py	Mon Jun 11 13:05:44 2012 +0200
@@ -1,12 +1,14 @@
 
 from django.shortcuts import render_to_response
 from django.template import RequestContext
+from django.utils.translation import ugettext as _
 from ldt.ldt_utils.models import Content, Segment
+import math
 import operator
-import math
 
 COLORS = ['red', 'yellow', 'green', 'blue']
 EMOTICONS = ['happy','unhappy','laughing','surprised']
+
 SCALES = [0.2,0.5,0.8,1]
 
 
@@ -32,7 +34,7 @@
         for t in EMOTICONS:
             if t in c_tags:
                 score = float(c_tags[t])/float(c_tags['emoticons'])
-                cat = int(len(EMOTICONS)*score)
+                cat = min(int(len(EMOTICONS)*score),3)                
                 scale = SCALES[cat]
                 width = int(50*scale)
                 emoticons_stats.append({'tag':t, 'score': score, 'cat':cat, 'scale': scale, 'width':width})
@@ -42,7 +44,7 @@
         for t in COLORS:
             if t in c_tags:
                 score = float(c_tags[t])/float(c_tags['colors'])
-                cat = int(len(COLORS)*score)
+                cat = min(int(len(COLORS)*score),3)
                 scale = SCALES[cat]
                 width = int(50*scale)
                 colors_stats.append({'tag':t, 'score': score, 'cat':cat, 'scale': scale, 'width':width})