-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numbers in templates are still getting localized #7556
Comments
@Pomax I’m curious where you see this happening? |
Ah, the data-creepiness attribute, just caught up with the PNI PR. |
yup. Apparently we missed this part in https://docs.djangoproject.com/en/3.2/ref/settings/#use-thousand-separator:
Without any clues as to how it does that, and how you stop it (that I can find) beyond "you don't, you have to use that template tag". |
Need to do audit to determine where it's being used across locales |
Hey @Pomax I've audited the templates by searching for instances of mozfest_footer.html
signup.html
buyersguide_item.html - ALREADY ADDED FOR PNI
bannered_campaign_page.html
index_page.html
profile_blocks.html
pulse_project_list.html
petition.html
load-more-regrets.html
Let me know if you'd like me to add the I also reviewed the Django docs but couldn't see a documented way to switch the template system so it doesn't assume that numerical values in templates are intended for human consumption and therefore have L10n applied. |
this would be good to revisit |
@cdanfon Let's move this up the backlog too and see if it's still relevant, might be a fairly easy win. |
This is the full documentation of the
So it's a bit ambiguous, but it seems to me like the locale override would refer to Is this a bug in Django? From the above it sounds like |
I have filed https://code.djangoproject.com/ticket/34064 to clarify the docs at least. |
I guess the issue is that number localization is not only the thousand separator, but also the decimal separator. This means turning off the thousand separator is not sufficient to get unlocalized numbers. Actually, thousand separators are more of an accounting way of writing numbers, while the decimal separator is more general. |
Isn't
-- https://docs.djangoproject.com/en/3.2/ref/settings/#use-l10n So turning this off should prevent the automatic conversion in the templates. Unfortunately though, this is deprecated starting with Django 4.0: https://docs.djangoproject.com/en/4.0/ref/settings/#use-l10n So I guess we will need to go the manual route. |
I have updated the locations identified above and also searched for For the future we need to pay attention to this in general, but it would also be good to include the original locations where the issue was identified in the ticket. |
Hey @tbrlpld I've tested the newsletter signup in https://foundation.mofostaging.net/en both in the header and footer with different emails and I don't think it's working as I haven't received any email confirmation, unless the SMTP is not configured to work on staging? |
@cdanfon I actually don't really know how this works, but I don't think we are sending the emails directly. I think the external newsletter service is handling the sending of the emails. But it is a good question if everything is configured correctly on staging. |
Ok, so it looks like we are using this client to use the Mozilla newsletter service "Basket". From the config on staging, I would guess this is not configured to be working as it is not using the production settings for |
@cdanfon Nevermind my comment then about testing the newsletter signup. Seems like this should not be working and I don't know if it worked before. Guess we will just have to wait and see in prod 🤷♂️ |
Makes sense @tbrlpld Can you give me a nudge when this gets to production to check please? Thanks |
@cdanfon This has been on prod since monday. I was not aware there was a prod deployment on monday. |
Hey @tbrlpld tested signing up to the newsletter on prod and all worked fine |
This is caused by
L10N=True
: even though we removedUSE_THOUSAND_SEPARATOR
, which turns this behaviour off for English/default, theL10N
setting "overrules" that and turns on silent number reformatting with even less control. There is the{{ value | unlocalize }}
template filter from thel10n
tags that we can use, but it would be fantastic if we can find out how to actually turns this off for every locale, except whereintcomma
is explicitly used.The text was updated successfully, but these errors were encountered: