1
0
mirror of https://gitlab.crans.org/mediatek/med.git synced 2024-11-27 00:47:10 +00:00

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): class AuteurAdmin(VersionAdmin):
list_display = ('nom',) list_display = ('name',)
search_fields = ('nom',) search_fields = ('name',)
class MediaAdmin(VersionAdmin): class MediaAdmin(VersionAdmin):
list_display = ('__str__', 'authors_list', 'side_identifier', 'isbn', list_display = ('__str__', 'authors_list', 'side_identifier', 'isbn',
'external_link') 'external_link')
search_fields = ('title', 'authors__nom', 'side_identifier', 'subtitle', search_fields = ('title', 'authors__name', 'side_identifier', 'subtitle',
'isbn') 'isbn')
autocomplete_fields = ('authors',) autocomplete_fields = ('authors',)
date_hierarchy = 'publish_date' date_hierarchy = 'publish_date'
form = MediaAdminForm form = MediaAdminForm
def authors_list(self, obj): 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') authors_list.short_description = _('authors')
@ -82,14 +82,14 @@ class EmpruntAdmin(VersionAdmin):
_('Turn back') _('Turn back')
) )
permanencier_rendu_custom.short_description = _('permanencier rendu') permanencier_rendu_custom.short_description = _('given back to')
permanencier_rendu_custom.allow_tags = True permanencier_rendu_custom.allow_tags = True
class JeuAdmin(VersionAdmin): class JeuAdmin(VersionAdmin):
list_display = ('nom', 'proprietaire', 'duree', 'nombre_joueurs_min', list_display = ('name', 'proprietaire', 'duree', 'nombre_joueurs_min',
'nombre_joueurs_max', 'comment') 'nombre_joueurs_max', 'comment')
search_fields = ('nom', 'proprietaire__username', 'duree', 'comment') search_fields = ('name', 'proprietaire__username', 'duree', 'comment')
autocomplete_fields = ('proprietaire',) autocomplete_fields = ('proprietaire',)

View File

@ -3,7 +3,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -13,83 +13,131 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\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" msgid "authors"
msgstr "auteurs" msgstr "auteurs"
#: admin.py:39 #: admin.py:42
msgid "external url" msgid "external url"
msgstr "URL externe" msgstr "URL externe"
#: admin.py:79 #: admin.py:82
msgid "Turn back" msgid "Turn back"
msgstr "Rendre" msgstr "Rendre"
#: admin.py:82 #: admin.py:85 models.py:112
msgid "permanencier rendu" msgid "given back to"
msgstr "" msgstr "rendu à"
#: fields.py:17 #: fields.py:17
msgid "ISBN-10 or ISBN-13" msgid "ISBN-10 or ISBN-13"
msgstr "ISBN-10 ou 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" msgid "author"
msgstr "auteur" msgstr "auteur"
#: models.py:25 #: models.py:30
msgid "ISBN" msgid "ISBN"
msgstr "ISBN" msgstr "ISBN"
#: models.py:26 #: models.py:31
msgid "You may be able to scan it from a bar code." msgid "You may be able to scan it from a bar code."
msgstr "Peut souvent être scanné à partir du code barre." msgstr "Peut souvent être scanné à partir du code barre."
#: models.py:31 #: models.py:36
msgid "title" msgid "title"
msgstr "titre" msgstr "titre"
#: models.py:35 #: models.py:40
msgid "subtitle" msgid "subtitle"
msgstr "sous-titre" msgstr "sous-titre"
#: models.py:41 #: models.py:46
msgid "external URL" msgid "external URL"
msgstr "URL externe" msgstr "URL externe"
#: models.py:46 #: models.py:51
msgid "side identifier" msgid "side identifier"
msgstr "côte" msgstr "côte"
#: models.py:54 #: models.py:59
msgid "number of pages" msgid "number of pages"
msgstr "nombre de pages" msgstr "nombre de pages"
#: models.py:59 #: models.py:64
msgid "publish date" msgid "publish date"
msgstr "date de publication" msgstr "date de publication"
#: models.py:68 #: models.py:76
msgid "medium" msgid "medium"
msgstr "medium" msgstr "medium"
#: models.py:69 #: models.py:77
msgid "media" msgid "media"
msgstr "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" msgid "borrowed item"
msgstr "emprunt" msgstr "emprunt"
#: models.py:99 #: models.py:121
msgid "borrowed items" msgid "borrowed items"
msgstr "emprunts" 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" msgid "game"
msgstr "jeu" msgstr "jeu"
#: models.py:124 #: models.py:168
msgid "games" msgid "games"
msgstr "jeux" 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): 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): def __str__(self):
return self.nom return self.name
class Meta: class Meta:
verbose_name = _("author") verbose_name = _("author")
verbose_name_plural = _("authors") verbose_name_plural = _("authors")
ordering = ['nom'] ordering = ['name']
class Media(models.Model): class Media(models.Model):
@ -75,18 +79,29 @@ class Media(models.Model):
class Emprunt(models.Model): class Emprunt(models.Model):
media = models.ForeignKey('Media', on_delete=models.PROTECT) media = models.ForeignKey(
user = models.ForeignKey('users.User', on_delete=models.PROTECT) 'Media',
date_emprunt = models.DateTimeField(help_text='%d/%m/%y %H:%M:%S') 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( date_rendu = models.DateTimeField(
help_text='%d/%m/%y %H:%M:%S',
blank=True, blank=True,
null=True, null=True,
verbose_name=_('given back on'),
) )
permanencier_emprunt = models.ForeignKey( permanencier_emprunt = models.ForeignKey(
'users.User', 'users.User',
on_delete=models.PROTECT, on_delete=models.PROTECT,
related_name='user_permanencier_emprunt', related_name='user_permanencier_emprunt',
verbose_name=_('borrowed with'),
help_text=_('The keyholder that registered this borrowed item.')
) )
permanencier_rendu = models.ForeignKey( permanencier_rendu = models.ForeignKey(
'users.User', 'users.User',
@ -94,6 +109,8 @@ class Emprunt(models.Model):
related_name='user_permanencier_rendu', related_name='user_permanencier_rendu',
blank=True, blank=True,
null=True, null=True,
verbose_name=_('given back to'),
help_text=_('The keyholder to whom this item was given back.')
) )
def __str__(self): def __str__(self):
@ -114,18 +131,39 @@ class Jeu(models.Model):
('4h+', '4h+'), ('4h+', '4h+'),
) )
nom = models.CharField(max_length=255) name = models.CharField(
proprietaire = models.ForeignKey('users.User', on_delete=models.PROTECT) max_length=255,
duree = models.CharField(choices=DUREE, max_length=255) verbose_name=_("name"),
nombre_joueurs_min = models.IntegerField(validators=[MinValueValidator(1)]) )
nombre_joueurs_max = models.IntegerField(validators=[MinValueValidator(1)]) proprietaire = models.ForeignKey(
comment = models.CharField(help_text="Commentaire", max_length=255, 'users.User',
blank=True, null=True) 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): def __str__(self):
return str(self.nom) return str(self.name)
class Meta: class Meta:
verbose_name = _("game") verbose_name = _("game")
verbose_name_plural = _("games") verbose_name_plural = _("games")
ordering = ['nom'] ordering = ['name']