8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-22 23:13:46 +00:00

Mark strings for translation in cotisations

This commit is contained in:
Laouen Fernet 2019-11-16 14:02:32 +00:00 committed by chirac
parent 3743a46bc5
commit 2454de2032
19 changed files with 117 additions and 91 deletions

View file

@ -116,7 +116,7 @@ class DiscountForm(Form):
"""
is_relative = forms.BooleanField(
label=_("Discount is on percentage."), required=False
label=_("Discount is in percentage."), required=False
)
discount = forms.DecimalField(
label=_("Discount"),
@ -136,7 +136,7 @@ class DiscountForm(Form):
else:
amount = discount
if amount:
name = _("{}% discount") if is_relative else _("{}€ discount")
name = _("{}% discount") if is_relative else _("{} € discount")
name = name.format(discount)
Vente.objects.create(facture=invoice, name=name, prix=-amount, number=1)
@ -184,7 +184,7 @@ class DelArticleForm(FormRevMixin, Form):
articles = forms.ModelMultipleChoiceField(
queryset=Article.objects.none(),
label=_("Available articles"),
label=_("Current articles"),
widget=forms.CheckboxSelectMultiple,
)
@ -226,7 +226,7 @@ class DelPaiementForm(FormRevMixin, Form):
# TODO : change paiement to payment
paiements = forms.ModelMultipleChoiceField(
queryset=Paiement.objects.none(),
label=_("Available payment methods"),
label=_("Current payment methods"),
widget=forms.CheckboxSelectMultiple,
)
@ -266,7 +266,7 @@ class DelBanqueForm(FormRevMixin, Form):
# TODO : change banque to bank
banques = forms.ModelMultipleChoiceField(
queryset=Banque.objects.none(),
label=_("Available banks"),
label=_("Current banks"),
widget=forms.CheckboxSelectMultiple,
)

View file

@ -56,7 +56,7 @@ from cotisations.validators import check_no_balance
class BaseInvoice(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
date = models.DateTimeField(auto_now_add=True, verbose_name=_("Date"))
date = models.DateTimeField(auto_now_add=True, verbose_name=_("date"))
# TODO : change prix to price
def prix(self):
@ -138,7 +138,7 @@ class Facture(BaseInvoice):
abstract = False
permissions = (
# TODO : change facture to invoice
("change_facture_control", _('Can edit the "controlled" state')),
("change_facture_control", _("Can edit the \"controlled\" state")),
("view_facture", _("Can view an invoice object")),
("change_all_facture", _("Can edit all the previous invoices")),
)
@ -174,8 +174,8 @@ class Facture(BaseInvoice):
return (
False,
_(
"You don't have the right to edit an invoice "
"already controlled or invalidated."
"You don't have the right to edit an invoice"
" already controlled or invalidated."
),
("cotisations.change_all_facture",),
)
@ -206,8 +206,8 @@ class Facture(BaseInvoice):
return (
False,
_(
"You don't have the right to delete an invoice "
"already controlled or invalidated."
"You don't have the right to delete an invoice"
" already controlled or invalidated."
),
("cotisations.change_all_facture",),
)
@ -220,8 +220,8 @@ class Facture(BaseInvoice):
return (
False,
_(
"You don't have the right to view someone else's "
"invoices history."
"You don't have the right to view someone else's"
" invoices history."
),
("cotisations.view_facture",),
)
@ -243,7 +243,7 @@ class Facture(BaseInvoice):
can = user_request.has_perm("cotisations.change_facture_control")
return (
can,
_('You don\'t have the right to edit the "controlled" state.')
_("You don't have the right to edit the \"controlled\" state.")
if not can
else None,
("cotisations.change_facture_control",),
@ -262,13 +262,13 @@ class Facture(BaseInvoice):
if len(Paiement.find_allowed_payments(user_request)) <= 0:
return (
False,
_("There are no payment method which you can use."),
_("There are no payment methods that you can use."),
("cotisations.add_facture",),
)
if len(Article.find_allowed_articles(user_request, user_request)) <= 0:
return (
False,
_("There are no article that you can buy."),
_("There are no articles that you can buy."),
("cotisations.add_facture",),
)
return True, None, None
@ -346,11 +346,11 @@ class CustomInvoice(BaseInvoice):
class Meta:
permissions = (("view_custominvoice", _("Can view a custom invoice object")),)
recipient = models.CharField(max_length=255, verbose_name=_("Recipient"))
payment = models.CharField(max_length=255, verbose_name=_("Payment type"))
address = models.CharField(max_length=255, verbose_name=_("Address"))
paid = models.BooleanField(verbose_name=_("Paid"), default=False)
remark = models.TextField(verbose_name=_("Remark"), blank=True, null=True)
recipient = models.CharField(max_length=255, verbose_name=_("recipient"))
payment = models.CharField(max_length=255, verbose_name=_("payment type"))
address = models.CharField(max_length=255, verbose_name=_("address"))
paid = models.BooleanField(verbose_name=_("paid"), default=False)
remark = models.TextField(verbose_name=_("remark"), blank=True, null=True)
class CostEstimate(CustomInvoice):
@ -358,7 +358,7 @@ class CostEstimate(CustomInvoice):
permissions = (("view_costestimate", _("Can view a cost estimate object")),)
validity = models.DurationField(
verbose_name=_("Period of validity"), help_text="DD HH:MM:SS"
verbose_name=_("period of validity"), help_text="DD HH:MM:SS"
)
final_invoice = models.ForeignKey(
CustomInvoice,
@ -547,7 +547,7 @@ class Vente(RevMixin, AclMixin, models.Model):
if not user_request.has_perm("cotisations.change_vente"):
return (
False,
_("You don't have the right to edit the purchases."),
_("You don't have the right to edit a purchase."),
("cotisations.change_vente",),
)
elif not (user_request.has_perm("cotisations.change_all_facture") or user_can):
@ -562,8 +562,8 @@ class Vente(RevMixin, AclMixin, models.Model):
return (
False,
_(
"You don't have the right to edit a purchase "
"already controlled or invalidated."
"You don't have the right to edit a purchase"
" already controlled or invalidated."
),
("cotisations.change_all_vente",),
)
@ -590,8 +590,8 @@ class Vente(RevMixin, AclMixin, models.Model):
return (
False,
_(
"You don't have the right to delete a purchase "
"already controlled or invalidated."
"You don't have the right to delete a purchase"
" already controlled or invalidated."
),
None,
)
@ -606,8 +606,8 @@ class Vente(RevMixin, AclMixin, models.Model):
return (
False,
_(
"You don't have the right to view someone "
"else's purchase history."
"You don't have the right to view someone"
" else's purchase history."
),
("cotisations.view_vente",),
)
@ -731,7 +731,7 @@ class Article(RevMixin, AclMixin, models.Model):
def clean(self):
if self.name.lower() == "solde":
raise ValidationError(_("Balance is a reserved article name."))
raise ValidationError(_("Solde is a reserved article name."))
if self.type_cotisation and not (self.duration or self.duration_days):
raise ValidationError(_("Duration must be specified for a subscription."))
@ -921,7 +921,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
p = find_payment_method(self)
if p is not None:
return p._meta.verbose_name
return _("No custom payment method.")
return _("No custom payment methods.")
class Cotisation(RevMixin, AclMixin, models.Model):
@ -976,8 +976,8 @@ class Cotisation(RevMixin, AclMixin, models.Model):
return (
False,
_(
"You don't have the right to edit a subscription "
"already controlled or invalidated."
"You don't have the right to edit a subscription"
" already controlled or invalidated."
),
("cotisations.change_all_cotisation",),
)
@ -995,8 +995,8 @@ class Cotisation(RevMixin, AclMixin, models.Model):
return (
False,
_(
"You don't have the right to delete a subscription "
"already controlled or invalidated."
"You don't have the right to delete a subscription"
" already controlled or invalidated."
),
None,
)
@ -1011,8 +1011,8 @@ class Cotisation(RevMixin, AclMixin, models.Model):
return (
False,
_(
"You don't have the right to view someone else's "
"subscription history."
"You don't have the right to view someone else's"
" subscription history."
),
("cotisations.view_cotisation",),
)

View file

@ -44,18 +44,17 @@ class BalancePayment(PaymentMethodMixin, models.Model):
editable=False,
)
minimum_balance = models.DecimalField(
verbose_name=_("Minimum balance"),
verbose_name=_("minimum balance"),
help_text=_(
"The minimal amount of money allowed for the balance"
" at the end of a payment. You can specify negative "
"amount."
"The minimal amount of money allowed for the balance at the end"
" of a payment. You can specify a negative amount."
),
max_digits=5,
decimal_places=2,
default=0,
)
maximum_balance = models.DecimalField(
verbose_name=_("Maximum balance"),
verbose_name=_("maximum balance"),
help_text=_("The maximal amount of money allowed for the balance."),
max_digits=5,
decimal_places=2,
@ -64,7 +63,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
null=True,
)
credit_balance_allowed = models.BooleanField(
verbose_name=_("Allow user to credit their balance"), default=False
verbose_name=_("allow user to credit their balance"), default=False
)
def end_payment(self, invoice, request):

View file

@ -33,7 +33,7 @@ class ChequePayment(PaymentMethodMixin, models.Model):
"""
class Meta:
verbose_name = _("Cheque")
verbose_name = _("cheque")
payment = models.OneToOneField(
Paiement,

View file

@ -51,9 +51,10 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
max_length=255, null=True, blank=True, verbose_name=_("ComNpay secret key")
)
minimum_payment = models.DecimalField(
verbose_name=_("Minimum payment"),
verbose_name=_("minimum payment"),
help_text=_(
"The minimal amount of money you have to use when paying" " with ComNpay"
"The minimal amount of money you have to use when paying with"
" ComNpay."
),
max_digits=5,
decimal_places=2,
@ -62,7 +63,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
production = models.BooleanField(
default=True,
verbose_name=_(
"Production mode enabled (production URL, instead of homologation)"
"production mode enabled (production URL, instead of homologation)"
),
)

View file

@ -58,9 +58,9 @@ class PaymentMethodForm(forms.Form):
payment_method = forms.ChoiceField(
label=_("Special payment method"),
help_text=_(
"Warning: you will not be able to change the payment "
"method later. But you will be allowed to edit the other "
"options."
"Warning: you will not be able to change the payment"
" method later. But you will be allowed to edit the other"
" options."
),
required=False,
)
@ -71,7 +71,7 @@ class PaymentMethodForm(forms.Form):
self.fields["payment_method"].choices = [
(i, p.NAME) for (i, p) in enumerate(PAYMENT_METHODS)
]
self.fields["payment_method"].choices.insert(0, ("", _("no")))
self.fields["payment_method"].choices.insert(0, ("", _("No")))
self.fields["payment_method"].widget.attrs = {"id": "paymentMethodSelect"}
self.templates = [
forms.modelform_factory(p.PaymentMethod, fields="__all__")(prefix=prefix)

View file

@ -51,4 +51,4 @@ class FreePayment(PaymentMethodMixin, models.Model):
"""Checks that the price meets the requirement to be paid with user
balance.
"""
return (price == 0, _("You cannot validate this invoice for free."))
return (price == 0, _("You can't pay this invoice for free."))

View file

@ -30,5 +30,5 @@ class NoteCredentialForm(forms.Form):
object.
"""
login = forms.CharField(label=_("pseudo note"))
login = forms.CharField(label=_("Username"))
password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)

View file

@ -31,7 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<thead>
<tr>
<th>{% trans "Payment type" %}</th>
<th>{% trans "Is available for everyone" %}</th>
<th>{% trans "Available for everyone" %}</th>
<th>{% trans "Custom payment method" %}</th>
<th></th>
</tr>

View file

@ -45,12 +45,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<tr>
<th>{% trans "Profile" %}</th>
<th>
{% trans "Last name" as tr_last_name %}
{% include 'buttons/sort.html' with prefix='control' col='name' text=tr_last_name %}
{% trans "First name" as tr_first_name %}
{% include 'buttons/sort.html' with prefix='control' col='name' text=tr_first_name %}
</th>
<th>
{% trans "First name" as tr_first_name %}
{% include 'buttons/sort.html' with prefix='control' col='surname' text=tr_first_name %}
{% trans "Surname" as tr_surname %}
{% include 'buttons/sort.html' with prefix='control' col='surname' text=tr_surname %}
</th>
<th>
{% trans "Invoice ID" as tr_invoice_id %}
@ -104,8 +104,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
</tr>
{% endfor %}
</table>
{% trans "Edit" as tr_edit %}
{% bootstrap_button tr_edit button_type='submit' icon='ok' button_class='btn-success' %}
{% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type='submit' icon='ok' button_class='btn-success' %}
</form>
{% endblock %}

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<form class="form" method="post">
{% csrf_token %}
<h4>
{% blocktrans %}Warning: are you sure you really want to delete this {{ object_name }} object ( {{ objet }} )?{% endblocktrans %}
{% blocktrans %}Warning: are you sure you really want to delete this {{ objet_name }} object ( {{ objet }} )?{% endblocktrans %}
</h4>
{% trans "Confirm" as tr_confirm %}
{% bootstrap_button tr_confirm button_type='submit' icon='trash' button_class='btn-danger' %}

View file

@ -6,17 +6,17 @@ Nous vous remercions pour votre achat auprès de {{asso_name}} et nous vous en j
En cas de question, nhésitez pas à nous contacter par mail à {{contact_mail}}.
Cordialement,
Léquipe de {{asso_name}}
Respectueusement,
Léquipe de {{asso_name}}.
=== English version ===
Dear {{name}},
Hello {{name}},
Thank you for your purchase. Here is your invoice.
Thank you for your purchase at {{asso_name}}. Here is your invoice.
Should you need extra information, you can email us at {{contact_mail}}.
Should you need extra information, do not hesitate to email us at {{contact_mail}}.
Best regards,
{{ asso_name }}'s team
Regards,
The {{ asso_name }} team.

View file

@ -6,17 +6,18 @@ Vous trouverez en pièce jointe un reçu.
Pour nous faire part de toute remarque, suggestion ou problème vous pouvez nous envoyer un mail à {{asso_email}}.
À bientôt,
Respectueusement,
L'équipe de {{asso_name}}.
---
Hello {{name}}!
Your subscription to {{asso_name}} has just been accepted. You are now a full member of {{asso_name}} until {{ date_end|date:"d/m/Y" }}.
You will find with this email a subscription voucher.
For any information, suggestion or problem, you can contact us via email at
{{asso_email}}.
To express any comment, suggestion or problem, you can send us an email to {{asso_email}}.
Regards,
The {{asso_name}} team.

View file

@ -30,14 +30,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Articles" %}{% endblock %}
{% block content %}
<h2>{% trans "List of article types" %}</h2>
<h2>{% trans "List of articles" %}</h2>
{% can_create Article %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-article' %}">
<i class="fa fa-cart-plus"></i> {% trans "Add an article type" %}
<i class="fa fa-plus"></i> {% trans "Add an article" %}
</a>
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-article' %}">
<i class="fa fa-trash"></i> {% trans "Delete one or several article types" %}
<i class="fa fa-trash"></i> {% trans "Delete one or several articles" %}
</a>
{% include 'cotisations/aff_article.html' with article_list=article_list %}
{% endblock %}

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "List of banks" %}</h2>
{% can_create Banque %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-banque' %}">
<i class="fa fa-cart-plus"></i> {% trans "Add a bank" %}
<i class="fa fa-plus"></i> {% trans "Add a bank" %}
</a>
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-banque' %}">

View file

@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<h2>{% trans "List of payment methods" %}</h2>
{% can_create Paiement %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-paiement' %}">
<i class="fa fa-cart-plus"></i> {% trans "Add a payment method" %}
<i class="fa fa-plus"></i> {% trans "Add a payment method" %}
</a>
{% acl_end %}
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-paiement' %}">

View file

@ -52,7 +52,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% acl_end %}
{% can_view_all Article %}
<a class="list-group-item list-group-item-info" href="{% url 'cotisations:index-article' %}">
<i class="fa fa-list-ul"></i> {% trans "Available articles" %}
<i class="fa fa-list-ul"></i> {% trans "Articles" %}
</a>
{% acl_end %}
{% can_view_all Banque %}

View file

@ -36,7 +36,6 @@ from django.template.loader import get_template
from django.http import HttpResponse
from django.conf import settings
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
from re2o.mixins import AclMixin, RevMixin
from preferences.models import CotisationsOption

View file

@ -166,6 +166,7 @@ def new_facture(request, user, userid):
"articlelist": article_list,
"balance": balance,
"action_name": _("Confirm"),
"title": _("New invoice"),
},
"cotisations/facture.html",
request,
@ -222,7 +223,7 @@ def new_cost_estimate(request):
"articlesformset": articles_formset,
"articlelist": articles,
"discount_form": discount_form,
"title": _("Cost estimate"),
"title": _("New cost estimate"),
},
"cotisations/facture.html",
request,
@ -278,6 +279,7 @@ def new_custom_invoice(request):
"articlesformset": articles_formset,
"articlelist": articles,
"discount_form": discount_form,
"title": _("New custom invoice"),
},
"cotisations/facture.html",
request,
@ -373,7 +375,7 @@ def del_facture(request, facture, **_kwargs):
messages.success(request, _("The invoice was deleted."))
return redirect(reverse("cotisations:index"))
return form(
{"objet": facture, "objet_name": _("Invoice")},
{"objet": facture, "objet_name": _("invoice")},
"cotisations/delete.html",
request,
)
@ -437,7 +439,11 @@ def edit_custom_invoice(request, invoice, **kwargs):
return redirect(reverse("cotisations:index-custom-invoice"))
return form(
{"factureform": invoice_form, "venteform": purchase_form},
{
"factureform": invoice_form,
"venteform": purchase_form,
"title": _("Edit custom invoice"),
},
"cotisations/edit_facture.html",
request,
)
@ -501,7 +507,7 @@ def del_cost_estimate(request, estimate, **_kwargs):
messages.success(request, _("The cost estimate was deleted."))
return redirect(reverse("cotisations:index-cost-estimate"))
return form(
{"objet": estimate, "objet_name": _("Cost estimate")},
{"objet": estimate, "objet_name": _("cost estimate")},
"cotisations/delete.html",
request,
)
@ -564,7 +570,7 @@ def del_custom_invoice(request, invoice, **_kwargs):
messages.success(request, _("The invoice was deleted."))
return redirect(reverse("cotisations:index-custom-invoice"))
return form(
{"objet": invoice, "objet_name": _("Invoice")},
{"objet": invoice, "objet_name": _("invoice")},
"cotisations/delete.html",
request,
)
@ -588,7 +594,11 @@ def add_article(request):
messages.success(request, _("The article was created."))
return redirect(reverse("cotisations:index-article"))
return form(
{"factureform": article, "action_name": _("Add"), "title": _("New article")},
{
"factureform": article,
"action_name": _("Add"),
"title": _("New article"),
},
"cotisations/facture.html",
request,
)
@ -607,7 +617,11 @@ def edit_article(request, article_instance, **_kwargs):
messages.success(request, _("The article was edited."))
return redirect(reverse("cotisations:index-article"))
return form(
{"factureform": article, "action_name": _("Edit"), "title": _("Edit article")},
{
"factureform": article,
"action_name": _("Edit"),
"title": _("Edit article"),
},
"cotisations/facture.html",
request,
)
@ -718,8 +732,8 @@ def del_paiement(request, instances):
messages.error(
request,
_(
"The payment method %(method_name)s can't be deleted \
because there are invoices using it."
"The payment method %(method_name)s can't be deleted"
" because there are invoices using it."
)
% {"method_name": payment_del},
)
@ -748,7 +762,11 @@ def add_banque(request):
messages.success(request, _("The bank was created."))
return redirect(reverse("cotisations:index-banque"))
return form(
{"factureform": bank, "action_name": _("Add"), "title": _("New bank")},
{
"factureform": bank,
"action_name": _("Add"),
"title": _("New bank"),
},
"cotisations/facture.html",
request,
)
@ -768,7 +786,11 @@ def edit_banque(request, banque_instance, **_kwargs):
messages.success(request, _("The bank was edited."))
return redirect(reverse("cotisations:index-banque"))
return form(
{"factureform": bank, "action_name": _("Edit"), "title": _("Edit bank")},
{
"factureform": bank,
"action_name": _("Edit"),
"title": _("Edit bank"),
},
"cotisations/facture.html",
request,
)
@ -802,7 +824,11 @@ def del_banque(request, instances):
)
return redirect(reverse("cotisations:index-banque"))
return form(
{"factureform": bank, "action_name": _("Delete"), "title": _("Delete bank")},
{
"factureform": bank,
"action_name": _("Delete"),
"title": _("Delete bank"),
},
"cotisations/facture.html",
request,
)
@ -833,7 +859,7 @@ def control(request):
)
if control_invoices_form.is_valid():
control_invoices_form.save()
reversion.set_comment("Controle")
reversion.set_comment("Control")
messages.success(
request, _("Your changes have been properly taken into account.")
)