Translate app to french (no i18n)

This commit is contained in:
Gabriel Augendre 2016-10-27 09:35:44 +02:00
parent 9718496a31
commit da56f1641f
No known key found for this signature in database
GPG key ID: D2B6A5B41FC438B1
13 changed files with 51 additions and 49 deletions

View file

@ -9,7 +9,7 @@ urlpatterns = [
{
'template_name': 'authentication/auth_form.html',
'extra_context': {
'title': 'Login',
'title': 'Connexion',
'action': 'Login'
}
},
@ -27,7 +27,7 @@ urlpatterns = [
{
'template_name': 'authentication/auth_form.html',
'extra_context': {
'title': 'Change password',
'title': 'Modifier le mot de passe',
'action': 'Change password'
}
},

View file

@ -3,5 +3,5 @@ from django.contrib import messages
def password_change_done(request):
messages.success(request, "Password changed successfully")
messages.success(request, "Mot de passe modifié avec succès")
return render(request, 'refunds/home.html')

View file

@ -9,7 +9,7 @@ class RefundForm(forms.ModelForm):
model = Refund
fields = '__all__'
payments = forms.ModelMultipleChoiceField(queryset=Payment.objects.none())
payments = forms.ModelMultipleChoiceField(queryset=Payment.objects.none(), label='Paiements')
def __init__(self, *args, **kwargs):
super(RefundForm, self).__init__(*args, **kwargs)

View file

@ -9,14 +9,19 @@ AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
class Refund(models.Model):
title = models.CharField(max_length=100)
class Meta:
verbose_name = 'remboursement'
verbose_name_plural = 'remboursements'
title = models.CharField(max_length=100, verbose_name='titre')
date = models.DateField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
user = models.ForeignKey(
AUTH_USER_MODEL,
on_delete=models.PROTECT,
null=True
null=True,
verbose_name='utilisateur'
)
def eur_value(self) -> float:
@ -27,28 +32,34 @@ class Refund(models.Model):
return 0
def __str__(self) -> str:
return "{0} on {1} for {2:.2f}".format(self.title, self.date, self.eur_value())
return "{0} le {1} pour {2:.2f}".format(self.title, self.date, self.eur_value())
class Payment(models.Model):
title = models.CharField(max_length=100)
class Meta:
verbose_name = 'paiement'
verbose_name_plural = 'paiements'
title = models.CharField(max_length=100, verbose_name='titre')
date = models.DateField()
value = models.IntegerField()
value = models.IntegerField(verbose_name='valeur')
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
user = models.ForeignKey(
AUTH_USER_MODEL,
on_delete=models.PROTECT
on_delete=models.PROTECT,
verbose_name='utilisateur'
)
refund = models.ForeignKey(
Refund,
on_delete=models.SET_NULL,
null=True,
blank=True
blank=True,
verbose_name='remboursement'
)
def __str__(self) -> str:
s = '{0} on {1} for {2:.2f}'.format(self.title, self.date, self.value / 100)
s = '{0} le {1} pour {2:.2f}'.format(self.title, self.date, self.value / 100)
logger.error(s)
return s

View file

@ -23,6 +23,6 @@
</div>
{% else %}
<p>
{% firstof default_nothing "Nothing here..." %}
{% firstof default_nothing "Il n'y a rien ici..." %}
</p>
{% endif %}

View file

@ -3,7 +3,7 @@
{% block content %}
<h1>
{% block title %}Payments to refund{% endblock %}
{% block title %}Paiements à rembourser{% endblock %}
{% if user.is_authenticated and perms.refunding.add_payment %}
<div class="btn-group pull-right">
<a class="btn btn-success" href="{% url 'new_payment' %}">
@ -13,5 +13,5 @@
{% endif %}
</h1>
{% include 'refunding/elements_list.html' with elements=payments %}
<a href="{% url 'already_refunded_payments' %}">Only refunded payments</a>
<a href="{% url 'already_refunded_payments' %}">Afficher uniquement les paiements déjà remboursés</a>
{% endblock %}

View file

@ -3,8 +3,8 @@
{% block content %}
<h1>
{% block title %}Refunded payments{% endblock %}
{% block title %}Paiements remboursés{% endblock %}
</h1>
{% include 'refunding/elements_list.html' with elements=refunded %}
<a href="{% url 'not_refunded_payments' %}">Only not refunded payments</a>
<a href="{% url 'not_refunded_payments' %}">Afficher uniquement les paiements non remboursés</a>
{% endblock %}

View file

@ -3,7 +3,7 @@
{% block content %}
<h1>
{% block title %}Latest refunds{% endblock %}
{% block title %}Derniers remboursements{% endblock %}
{% if user.is_authenticated and perms.refunding.add_refund %}
<div class="btn-group pull-right">
<a class="btn btn-success" href="{% url 'new_refund' %}">

View file

@ -16,7 +16,7 @@ def latest_refunds(request):
refunds = Refund.objects.all().order_by('-date', '-id')[:20]
context = {
'refunds': refunds,
'default_nothing': 'No refund to show.'
'default_nothing': 'Aucun remboursement à afficher.'
}
return render(request, "refunding/refunds.html", context)
@ -31,14 +31,14 @@ def new_refund(request):
refund.user = request.user
refund.save()
messages.success(request, 'Refund created successfully')
messages.success(request, 'Remboursement créé avec succès')
return redirect('latest_refunds')
else:
form = RefundFormPublic()
context = {
'form': form,
'title': 'New refund'
'title': 'Nouveau remboursement'
}
return render(request, "refunding/refund_payment_detail.html", context)
@ -56,14 +56,14 @@ def refund_edit(request, pk):
refund.user = request.user
refund.save()
messages.success(request, 'Refund edited successfully')
messages.success(request, 'Remboursement modifié avec succès')
return redirect('latest_refunds')
else:
form = RefundFormPublic(instance=refund)
context = {
'form': form,
'title': 'Edit refund',
'title': 'Modifier un remboursement',
'refund': refund
}
@ -77,7 +77,7 @@ def refund_delete(request, pk):
refund.delete()
messages.success(request, "Refund deleted successfully")
messages.success(request, "Remboursement supprimé avec succès")
return latest_refunds(request)
@ -99,7 +99,7 @@ def not_refunded_payments(request):
context = {
'payments': payments,
'sum': value_sum,
'default_nothing': 'Nothing to refund :)'
'default_nothing': 'Rien à rembourser :)'
}
return render(request, "refunding/payments.html", context)
@ -114,14 +114,14 @@ def new_payment(request):
payment.user = request.user
payment.save()
messages.success(request, 'Payment created successfully')
messages.success(request, 'Paiement créé avec succès')
return redirect('not_refunded_payments')
else:
form = PaymentForm()
context = {
'form': form,
'title': 'New payment'
'title': 'Nouveau paiement'
}
return render(request, "refunding/refund_payment_detail.html", context)
@ -139,14 +139,14 @@ def payment_edit(request, pk):
payment.user = request.user
payment.save()
messages.success(request, 'Payment edited successfully')
messages.success(request, 'Paiement modifié avec succès')
return redirect('not_refunded_payments')
else:
form = PaymentForm(instance=payment)
context = {
'form': form,
'title': 'Edit payment',
'title': 'Modifier un paiement',
'payment': payment
}
@ -160,7 +160,7 @@ def payment_delete(request, pk):
payment.delete()
messages.success(request, "Payment deleted successfully")
messages.success(request, "Paiement supprimé avec succès")
return not_refunded_payments(request)
@ -177,6 +177,6 @@ def already_refunded_payments(request):
context = {
'refunded': refunded,
'sum': value_sum,
'default_nothing': 'No refunded payment :)'
'default_nothing': 'Aucun paiement remboursé :)'
}
return render(request, "refunding/refunded_payments.html", context)

View file

@ -1,7 +0,0 @@
{% extends 'base.html' %}
{% block title %}About{% endblock %}
{% block content %}
<h1>About</h1>
<p>This page is under construct and will be updated as soon as possible.</p>
{% endblock %}

View file

@ -3,11 +3,11 @@
{% block title %}Home{% endblock %}
{% block content %}
<h1>Refunds</h1>
<p class="lead">Welcome to my refund app!</p>
<p class="lead">Bienvenue sur mon application de remboursements !</p>
{% if not user.is_authenticated %}
<p>You may want to start by <a href="{% url 'auth_login' %}">logging in</a>.</p>
<p>Vous voudrez peut-être commencer par <a href="{% url 'auth_login' %}">vous connecter</a>.</p>
{% else %}
<p>Start by adding a <a href="{% url 'new_payment' %}">new payment</a> or <a href="{% url 'new_refund' %}">refunding</a>
some existing payments!</p>
<p>Commencez par ajouter un <a href="{% url 'new_payment' %}">nouveau paiement</a> ou par <a href="{% url 'new_refund' %}">rembourser</a>
des paiements existants</p>
{% endif %}
{% endblock %}

View file

@ -21,6 +21,5 @@ urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^auth/', include('authentication.urls')),
url(r'^$', home, name='home'),
url(r'^about/$', about, name='about'),
url(r'^', include('refunding.urls'))
]

View file

@ -15,15 +15,14 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="{% url 'about' %}">About</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'not_refunded_payments' %}">Payments</a></li>
<li><a href="{% url 'latest_refunds' %}">Refunds</a></li>
<li><a href="{% url 'not_refunded_payments' %}">Paiements</a></li>
<li><a href="{% url 'latest_refunds' %}">Remboursements</a></li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if not user.is_authenticated %}
<li><a href="{% url 'auth_login' %}?next={{ request.path }}">Login</a></li>
<li><a href="{% url 'auth_login' %}?next={{ request.path }}">Connexion</a></li>
{% else %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
@ -34,9 +33,9 @@
{% if user.is_staff %}
<li><a href="{% url 'admin:index' %}">Admin</a></li>
{% endif %}
<li><a href="{% url 'password_change' %}">Change password</a></li>
<li><a href="{% url 'password_change' %}">Modifier le mot de passe</a></li>
<li role="separator" class="divider"></li>
<li><a href="{% url 'auth_logout' %}?next={{ request.path }}">Logout</a></li>
<li><a href="{% url 'auth_logout' %}?next={{ request.path }}">Déconnexion</a></li>
</ul>
</li>
{% endif %}