Translate media app

This commit is contained in:
Alexandre Iooss 2019-08-16 14:01:13 +02:00
parent accaa965c8
commit 21c1dd067a
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
5 changed files with 238 additions and 45 deletions

View File

@ -13,21 +13,21 @@ from .models import Auteur, Emprunt, Jeu, Media
class AuteurAdmin(VersionAdmin):
list_display = ('nom',)
search_fields = ('nom',)
list_display = ('name',)
search_fields = ('name',)
class MediaAdmin(VersionAdmin):
list_display = ('__str__', 'authors_list', 'side_identifier', 'isbn',
'external_link')
search_fields = ('title', 'authors__nom', 'side_identifier', 'subtitle',
search_fields = ('title', 'authors__name', 'side_identifier', 'subtitle',
'isbn')
autocomplete_fields = ('authors',)
date_hierarchy = 'publish_date'
form = MediaAdminForm
def authors_list(self, obj):
return ", ".join([a.nom for a in obj.authors.all()])
return ", ".join([a.name for a in obj.authors.all()])
authors_list.short_description = _('authors')
@ -82,14 +82,14 @@ class EmpruntAdmin(VersionAdmin):
_('Turn back')
)
permanencier_rendu_custom.short_description = _('permanencier rendu')
permanencier_rendu_custom.short_description = _('given back to')
permanencier_rendu_custom.allow_tags = True
class JeuAdmin(VersionAdmin):
list_display = ('nom', 'proprietaire', 'duree', 'nombre_joueurs_min',
list_display = ('name', 'proprietaire', 'duree', 'nombre_joueurs_min',
'nombre_joueurs_max', 'comment')
search_fields = ('nom', 'proprietaire__username', 'duree', 'comment')
search_fields = ('name', 'proprietaire__username', 'duree', 'comment')
autocomplete_fields = ('proprietaire',)

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-11 10:46+0200\n"
"POT-Creation-Date: 2019-08-16 14:00+0200\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"
@ -13,83 +13,131 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: admin.py:32 models.py:20 models.py:51
#: admin.py:32 models.py:24 models.py:56
msgid "authors"
msgstr "auteurs"
#: admin.py:39
#: admin.py:42
msgid "external url"
msgstr "URL externe"
#: admin.py:79
#: admin.py:82
msgid "Turn back"
msgstr "Rendre"
#: admin.py:82
msgid "permanencier rendu"
msgstr ""
#: admin.py:85 models.py:112
msgid "given back to"
msgstr "rendu à"
#: fields.py:17
msgid "ISBN-10 or ISBN-13"
msgstr "ISBN-10 ou ISBN-13"
#: models.py:19
#: models.py:16 models.py:136
msgid "name"
msgstr "nom"
#: models.py:23
msgid "author"
msgstr "auteur"
#: models.py:25
#: models.py:30
msgid "ISBN"
msgstr "ISBN"
#: models.py:26
#: models.py:31
msgid "You may be able to scan it from a bar code."
msgstr "Peut souvent être scanné à partir du code barre."
#: models.py:31
#: models.py:36
msgid "title"
msgstr "titre"
#: models.py:35
#: models.py:40
msgid "subtitle"
msgstr "sous-titre"
#: models.py:41
#: models.py:46
msgid "external URL"
msgstr "URL externe"
#: models.py:46
#: models.py:51
msgid "side identifier"
msgstr "côte"
#: models.py:54
#: models.py:59
msgid "number of pages"
msgstr "nombre de pages"
#: models.py:59
#: models.py:64
msgid "publish date"
msgstr "date de publication"
#: models.py:68
#: models.py:76
msgid "medium"
msgstr "medium"
#: models.py:69
#: models.py:77
msgid "media"
msgstr "media"
#: models.py:98
#: models.py:89
msgid "borrower"
msgstr "emprunteur"
#: models.py:92
msgid "borrowed on"
msgstr "emprunté le"
#: models.py:97
msgid "given back on"
msgstr "rendu le"
#: models.py:103
msgid "borrowed with"
msgstr "emprunté avec"
#: models.py:104
msgid "The keyholder that registered this borrowed item."
msgstr "Le permanencier qui enregistre cet emprunt."
#: models.py:113
msgid "The keyholder to whom this item was given back."
msgstr "Le permanencier à qui l'emprunt a été rendu."
#: models.py:120
msgid "borrowed item"
msgstr "emprunt"
#: models.py:99
#: models.py:121
msgid "borrowed items"
msgstr "emprunts"
#: models.py:123
#: models.py:141
msgid "owner"
msgstr "propriétaire"
#: models.py:146
msgid "duration"
msgstr "durée"
#: models.py:150
msgid "minimum number of players"
msgstr "nombre minimum de joueurs"
#: models.py:154
msgid "maximum number of players"
msgstr "nombre maximum de joueurs"
#: models.py:160
msgid "comment"
msgstr "commentaire"
#: models.py:167
msgid "game"
msgstr "jeu"
#: models.py:124
#: models.py:168
msgid "games"
msgstr "jeux"

View File

@ -0,0 +1,31 @@
# Generated by Django 2.2.4 on 2019-08-16 11:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('media', '0022_auto_20190811_1804'),
]
operations = [
migrations.AlterModelOptions(
name='auteur',
options={'ordering': ['name'], 'verbose_name': 'author', 'verbose_name_plural': 'authors'},
),
migrations.AlterModelOptions(
name='jeu',
options={'ordering': ['name'], 'verbose_name': 'game', 'verbose_name_plural': 'games'},
),
migrations.RenameField(
model_name='auteur',
old_name='nom',
new_name='name',
),
migrations.RenameField(
model_name='jeu',
old_name='nom',
new_name='name',
),
]

View File

@ -0,0 +1,76 @@
# Generated by Django 2.2.4 on 2019-08-16 11:56
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('media', '0023_auto_20190816_1349'),
]
operations = [
migrations.AlterField(
model_name='auteur',
name='name',
field=models.CharField(max_length=255, unique=True, verbose_name='name'),
),
migrations.AlterField(
model_name='emprunt',
name='date_emprunt',
field=models.DateTimeField(verbose_name='borrowed on'),
),
migrations.AlterField(
model_name='emprunt',
name='date_rendu',
field=models.DateTimeField(blank=True, null=True, verbose_name='given back on'),
),
migrations.AlterField(
model_name='emprunt',
name='permanencier_emprunt',
field=models.ForeignKey(help_text='The keyholder that registered this borrowed item.', on_delete=django.db.models.deletion.PROTECT, related_name='user_permanencier_emprunt', to=settings.AUTH_USER_MODEL, verbose_name='borrowed with'),
),
migrations.AlterField(
model_name='emprunt',
name='permanencier_rendu',
field=models.ForeignKey(blank=True, help_text='The keyholder to whom this item was given back.', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='user_permanencier_rendu', to=settings.AUTH_USER_MODEL, verbose_name='given back to'),
),
migrations.AlterField(
model_name='emprunt',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='borrower'),
),
migrations.AlterField(
model_name='jeu',
name='comment',
field=models.CharField(blank=True, max_length=255, null=True, verbose_name='comment'),
),
migrations.AlterField(
model_name='jeu',
name='duree',
field=models.CharField(choices=[('-1h', '-1h'), ('1-2h', '1-2h'), ('2-3h', '2-3h'), ('3-4h', '3-4h'), ('4h+', '4h+')], max_length=255, verbose_name='duration'),
),
migrations.AlterField(
model_name='jeu',
name='name',
field=models.CharField(max_length=255, verbose_name='name'),
),
migrations.AlterField(
model_name='jeu',
name='nombre_joueurs_max',
field=models.IntegerField(validators=[django.core.validators.MinValueValidator(1)], verbose_name='maximum number of players'),
),
migrations.AlterField(
model_name='jeu',
name='nombre_joueurs_min',
field=models.IntegerField(validators=[django.core.validators.MinValueValidator(1)], verbose_name='minimum number of players'),
),
migrations.AlterField(
model_name='jeu',
name='proprietaire',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='owner'),
),
]

View File

@ -10,15 +10,19 @@ from .fields import ISBNField
class Auteur(models.Model):
nom = models.CharField(max_length=255, unique=True)
name = models.CharField(
max_length=255,
unique=True,
verbose_name=_('name'),
)
def __str__(self):
return self.nom
return self.name
class Meta:
verbose_name = _("author")
verbose_name_plural = _("authors")
ordering = ['nom']
ordering = ['name']
class Media(models.Model):
@ -75,18 +79,29 @@ class Media(models.Model):
class Emprunt(models.Model):
media = models.ForeignKey('Media', on_delete=models.PROTECT)
user = models.ForeignKey('users.User', on_delete=models.PROTECT)
date_emprunt = models.DateTimeField(help_text='%d/%m/%y %H:%M:%S')
media = models.ForeignKey(
'Media',
on_delete=models.PROTECT,
)
user = models.ForeignKey(
'users.User',
on_delete=models.PROTECT,
verbose_name=_("borrower"),
)
date_emprunt = models.DateTimeField(
verbose_name=_('borrowed on'),
)
date_rendu = models.DateTimeField(
help_text='%d/%m/%y %H:%M:%S',
blank=True,
null=True,
verbose_name=_('given back on'),
)
permanencier_emprunt = models.ForeignKey(
'users.User',
on_delete=models.PROTECT,
related_name='user_permanencier_emprunt',
verbose_name=_('borrowed with'),
help_text=_('The keyholder that registered this borrowed item.')
)
permanencier_rendu = models.ForeignKey(
'users.User',
@ -94,6 +109,8 @@ class Emprunt(models.Model):
related_name='user_permanencier_rendu',
blank=True,
null=True,
verbose_name=_('given back to'),
help_text=_('The keyholder to whom this item was given back.')
)
def __str__(self):
@ -114,18 +131,39 @@ class Jeu(models.Model):
('4h+', '4h+'),
)
nom = models.CharField(max_length=255)
proprietaire = models.ForeignKey('users.User', on_delete=models.PROTECT)
duree = models.CharField(choices=DUREE, max_length=255)
nombre_joueurs_min = models.IntegerField(validators=[MinValueValidator(1)])
nombre_joueurs_max = models.IntegerField(validators=[MinValueValidator(1)])
comment = models.CharField(help_text="Commentaire", max_length=255,
blank=True, null=True)
name = models.CharField(
max_length=255,
verbose_name=_("name"),
)
proprietaire = models.ForeignKey(
'users.User',
on_delete=models.PROTECT,
verbose_name=_("owner"),
)
duree = models.CharField(
choices=DUREE,
max_length=255,
verbose_name=_("duration"),
)
nombre_joueurs_min = models.IntegerField(
validators=[MinValueValidator(1)],
verbose_name=_("minimum number of players"),
)
nombre_joueurs_max = models.IntegerField(
validators=[MinValueValidator(1)],
verbose_name=_('maximum number of players'),
)
comment = models.CharField(
max_length=255,
blank=True,
null=True,
verbose_name=_('comment'),
)
def __str__(self):
return str(self.nom)
return str(self.name)
class Meta:
verbose_name = _("game")
verbose_name_plural = _("games")
ordering = ['nom']
ordering = ['name']