add french locale

This commit is contained in:
Benjamin Dauvergne 2017-03-30 01:01:23 +02:00
parent 60b1b8be77
commit efe31c8e3b
6 changed files with 160 additions and 13 deletions

View File

@ -1,4 +1,5 @@
# locales
recursive-include petale/locale *.po *.mo
# static

View File

@ -0,0 +1,140 @@
# french localization of petale
# Copyright (C) 2017 petale © Entr'ouvert
# This file is distributed under the same license as the petale package.
# Benjamin Dauvergne <bdauvergne@entrouvert.com>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: petale 0.2\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-30 00:47+0200\n"
"PO-Revision-Date: 2017-03-29 01:01:01+0200\n"
"Last-Translator: Benjamin Dauvergne <bdauvergne@entrouvert.com>\n"
"Language-Team: French <fr@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"
#: models.py:33 models.py:85 models.py:188
msgid "Partner"
msgstr "Partenaire"
#: models.py:38
msgid "Admin emails"
msgstr "Courriels des administrateurs"
#: models.py:41
msgid "List of admin emails separated by comma"
msgstr "Liste de courriels d'administrateurs séparés par des virgules"
#: models.py:43
msgid "Hard max size"
msgstr "Taille globale maximum des pétales"
#: models.py:44 models.py:47 models.py:50 models.py:53 models.py:57
#: models.py:140
msgid "as bytes"
msgstr "en octets"
#: models.py:46
msgid "Soft max size"
msgstr "Seuil global avant alerte"
#: models.py:49
msgid "Hard max size per key"
msgstr "Taille maximum par pétale"
#: models.py:52
msgid "Soft max size per key"
msgstr "Seuil avant alerte par pétale"
#: models.py:55 models.py:138
msgid "Size"
msgstr "Taille"
#: models.py:71
#, python-format
msgid "Partner %s space almost exhausted"
msgstr "L'espace alloué au partenaire %s est presque épuisé"
#: models.py:72 models.py:170
#, python-brace-format
msgid "Current size: {current_size}, Max size: {max_size}"
msgstr "Taille actuelle: {current_size}, Taille maximum: {max_size}"
#: models.py:86
msgid "Partners"
msgstr "Partenaires"
#: models.py:99
msgid "CUT"
msgstr "Compte Urbain du Territoire"
#: models.py:100
msgid "CUTs"
msgstr "Comptes Urbains du Territoire"
#: models.py:119
msgid "Created"
msgstr "Création"
#: models.py:122
msgid "Updated"
msgstr "Dernière mise à jour"
#: models.py:125
msgid "Name"
msgstr "Nom"
#: models.py:129
msgid "ETag"
msgstr ""
#: models.py:132
msgid "Data Content"
msgstr "Contenu"
#: models.py:135
msgid "Content type"
msgstr "Type de donnée"
#: models.py:167
#, python-brace-format
msgid "Key {key} space of partner {partner} almost exhausted"
msgstr ""
"L'espacé alloué à la clé {key} pour le partenaire {partner} est presque "
"épuisé"
#: models.py:179
msgid "Petal"
msgstr "Pétale"
#: models.py:180
msgid "Petals"
msgstr "Pétales"
#: models.py:185
msgid "Order"
msgstr "Ordre"
#: models.py:191
msgid "User"
msgstr "Utilisateur"
#: models.py:193
msgid "Allowed methods"
msgstr "Méthodes HTTP permises"
#: models.py:198
msgid "Allowed keys"
msgstr "Clés permises"
#: models.py:207
msgid "Access control list"
msgstr "Règle de contrôle d'accès"
#: models.py:208
msgid "Access control lists"
msgstr "Règles de contrôle d'accès"

View File

@ -69,8 +69,9 @@ class Partner(models.Model):
and new_size > self.soft_global_max_size):
self.notify_admins(
subject=_('Partner %s space almost exhausted') % self.name,
body=_('Current size: %s, Max size: %s') % (
new_size, self.hard_global_max_size),
body=_('Current size: {current_size}, Max size: {max_size}').format(
current_size=new_size,
max_size=self.hard_global_max_size),
**kwargs)
def notify_admins(self, subject, body, **kwargs):
@ -162,10 +163,12 @@ class Petal(models.Model):
if content_length > self.partner.soft_per_key_max_size:
self.partner.notify_admins(
_('Key %s space of partner %s almost exhausted') % (
self.name, self.partner.name),
_('Current size: %s, Max size: %s') % (
content_length, self.partner.hard_per_key_max_size),
_('Key {key} space of partner {partner} almost exhausted').format(
key=self.name,
partner=self.partner.name),
_('Current size: {current_size}, Max size: {max_size}').format(
current_size=content_length,
max_size=self.partner.hard_per_key_max_size),
partner=self.partner.name,
cut=self.cut.uuid,
key=self.name)

View File

@ -68,9 +68,9 @@ DATABASES = {
# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'fr-fr'
TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Paris'
USE_I18N = True

View File

@ -3,7 +3,6 @@
import os
import subprocess
import sys
from setuptools.command.install_lib import install_lib as _install_lib
from distutils.command.build import build as _build
@ -13,6 +12,7 @@ from setuptools import setup, find_packages
class eo_sdist(sdist):
sub_commands = [('compile_translations', None)] + sdist.sub_commands
def run(self):
if os.path.exists('VERSION'):

View File

@ -248,8 +248,10 @@ def test_partner_size_limit(app, cut_kevin_uuid, acl, petal_invoice, petal_books
assert len(mailoutbox) == 1
sent_mail = mailoutbox[0]
assert sent_mail.to[0] == 'b.wayne@gotham.gov'
assert sent_mail.subject == 'Key taxes-fail space of partner gotham almost exhausted'
assert 'Current size: 395, Max size: 400' in sent_mail.message().as_string()
assert 'taxes-fail' in sent_mail.subject
assert 'gotham' in sent_mail.subject
assert '395' in sent_mail.message().as_string()
assert '400' in sent_mail.message().as_string()
payload.pop('birthdate')
for i in range(4):
@ -259,8 +261,9 @@ def test_partner_size_limit(app, cut_kevin_uuid, acl, petal_invoice, petal_books
assert len(mailoutbox) == 2
sent_mail = mailoutbox[1]
assert sent_mail.to[0] == 'b.wayne@gotham.gov'
assert sent_mail.subject == 'Partner gotham space almost exhausted'
assert 'Current size: 1867, Max size: 2048' in sent_mail.message().as_string()
assert 'gotham' in sent_mail.subject
assert '1867' in sent_mail.message().as_string()
assert '2048' in sent_mail.message().as_string()
url = '/api/gotham/%s/taxes-4/' % cut_kevin_uuid
resp = app.put_json(url, params=payload, headers={'If-None-Match': '*'}, status=500)