diff --git a/forms_fieldset/templates/forms_fieldset/tabular.html b/forms_fieldset/templates/forms_fieldset/tabular.html index 632dd7d..4026bcd 100644 --- a/forms_fieldset/templates/forms_fieldset/tabular.html +++ b/forms_fieldset/templates/forms_fieldset/tabular.html @@ -35,7 +35,7 @@

{{ label }}

{% endfor %} - Ajout supplémentaire + {{ title_add }} diff --git a/forms_fieldset/templatetags/forms_fieldset.py b/forms_fieldset/templatetags/forms_fieldset.py index ca6f3a3..6d88fa4 100644 --- a/forms_fieldset/templatetags/forms_fieldset.py +++ b/forms_fieldset/templatetags/forms_fieldset.py @@ -1,6 +1,7 @@ from django import template from django.contrib.admin.helpers import AdminForm from django.template.loader import render_to_string +from django.conf import settings class FieldsetsNotSupported(Exception): """ form field sets type error, it must be a list """ @@ -20,9 +21,21 @@ def fieldset(form, fieldsets, color='#79AEC8'): @register.simple_tag def inline_fieldset(inline_formset, color='#79AEC8', label='Inline Form'): + LANGEAGE_DATA = { + 'en-en': 'Add another', + 'en': 'Add another', + 'EN-EN': 'Add another', + 'EN': 'Add another', + 'fr-fr': 'Ajout supplémentaire', + 'fr': 'Ajout supplémentaire', + 'FR-FR': 'Ajout supplémentaire', + 'Fr': 'Ajout supplémentaire', + 'de': 'Ajout supplémentaire', + } context = { 'inline_formset': inline_formset, 'color': color, 'label': label, + 'title_add': LANGEAGE_DATA.get(settings.LANGUAGE_CODE, 'Add another') } return render_to_string('forms_fieldset/tabular.html', context) diff --git a/setup.cfg b/setup.cfg index e767b5f..7be6eb5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = django-forms-fieldset -version = 0.1.3 +version = 0.1.4 description = Django form fieldset inspire django admin fieldset. long_description = file: README.rst url = https://github.com/hadpro24/django-forms-fieldset