mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Fix address-helper wrong locale (Z#23223920) (#5884)
* Fix address-helper wrong locale (Z#23223920) * fix translation for transmission-types names * use language_code instead
This commit is contained in:
committed by
GitHub
parent
db982c9ef4
commit
2eaa6c3069
@@ -20,6 +20,7 @@
|
|||||||
# <https://www.gnu.org/licenses/>.
|
# <https://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
import pycountry
|
import pycountry
|
||||||
|
from django.conf import settings
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django.utils.translation import gettext, pgettext, pgettext_lazy
|
from django.utils.translation import gettext, pgettext, pgettext_lazy
|
||||||
@@ -29,6 +30,7 @@ from django_scopes import scope
|
|||||||
from pretix.base.addressvalidation import (
|
from pretix.base.addressvalidation import (
|
||||||
COUNTRIES_WITH_STREET_ZIPCODE_AND_CITY_REQUIRED,
|
COUNTRIES_WITH_STREET_ZIPCODE_AND_CITY_REQUIRED,
|
||||||
)
|
)
|
||||||
|
from pretix.base.i18n import language
|
||||||
from pretix.base.invoicing.transmission import get_transmission_types
|
from pretix.base.invoicing.transmission import get_transmission_types
|
||||||
from pretix.base.models import Organizer
|
from pretix.base.models import Organizer
|
||||||
from pretix.base.models.tax import VAT_ID_COUNTRIES
|
from pretix.base.models.tax import VAT_ID_COUNTRIES
|
||||||
@@ -89,7 +91,7 @@ def _info(cc):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def address_form(request):
|
def _address_form(request):
|
||||||
cc = request.GET.get("country", "DE")
|
cc = request.GET.get("country", "DE")
|
||||||
info = _info(cc)
|
info = _info(cc)
|
||||||
|
|
||||||
@@ -157,4 +159,15 @@ def address_form(request):
|
|||||||
# The help text explains that it is optional, so we want to hide that if it is required
|
# The help text explains that it is optional, so we want to hide that if it is required
|
||||||
info["vat_id"]["helptext_visible"] = False
|
info["vat_id"]["helptext_visible"] = False
|
||||||
|
|
||||||
|
return info
|
||||||
|
|
||||||
|
|
||||||
|
def address_form(request):
|
||||||
|
locale = request.GET.get('locale')
|
||||||
|
if locale in dict(settings.LANGUAGES):
|
||||||
|
with language(locale):
|
||||||
|
info = _address_form(request)
|
||||||
|
else:
|
||||||
|
info = _address_form(request)
|
||||||
|
|
||||||
return JsonResponse(info)
|
return JsonResponse(info)
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<div id="invoice" class="profile-scope"
|
<div id="invoice" class="profile-scope"
|
||||||
data-profiles-id="addresses_json"
|
data-profiles-id="addresses_json"
|
||||||
data-address-information-url="{% url "js_helpers.address_form" %}?invoice=true&organizer={{ event.organizer.slug|urlencode }}&event={{ event.slug|urlencode }}">
|
data-address-information-url="{% url "js_helpers.address_form" %}?invoice=true&organizer={{ event.organizer.slug|urlencode }}&event={{ event.slug|urlencode }}&locale={{ request.LANGUAGE_CODE }}">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if addresses_data %}
|
{% if addresses_data %}
|
||||||
<div class="form-group profile-select-container js-do-not-copy-answers">
|
<div class="form-group profile-select-container js-do-not-copy-answers">
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</h4>
|
</h4>
|
||||||
</summary>
|
</summary>
|
||||||
<div id="invoice" class="panel-collapse"
|
<div id="invoice" class="panel-collapse"
|
||||||
data-address-information-url="{% url "js_helpers.address_form" %}?invoice=true&organizer={{ event.organizer.slug|urlencode }}&event={{ event.slug|urlencode }}">
|
data-address-information-url="{% url "js_helpers.address_form" %}?invoice=true&organizer={{ event.organizer.slug|urlencode }}&event={{ event.slug|urlencode }}&locale={{ request.LANGUAGE_CODE }}">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% if event.settings.invoice_address_explanation_text %}
|
{% if event.settings.invoice_address_explanation_text %}
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user