re-enable USE_L10N and LocaleMiddleware - Update Internationalization #7512

Closed
opened 2025-12-29 20:24:30 +01:00 by adam · 6 comments
Owner

Originally created by @arthanson on GitHub (Jan 13, 2023).

Originally assigned to: @arthanson on GitHub.

Proposed Changes

re-enable USE_L10N and LocaleMiddleware.

There was a previous issue #11271 which solution was to disable internationalization. This is for updating the underlying problems so internationalization can be turned on in a future release.

This issue is intended to track all the issues related to the enabling of USE_L10N and LocaleMiddleware.

Some words are now translated, causing a mix of English and the browser language

https://github.com/netbox-community/netbox/issues/11189#issuecomment-1356326763 - Humanized dates are output with localized minutes/hours/days
https://github.com/netbox-community/netbox/issues/11240 - The word "Tags" is displayed as the German word "Schlagwörter"

Possible solution is to disable USE_I18N as netbox is not yet translated itself.

Floats are output with localized decimal separator breaking progress bars and other functionality

https://github.com/netbox-community/netbox/issues/11272 - Device position dropdown gets the U value with a comma, causing device save to fail.

https://github.com/netbox-community/netbox/discussions/11270 - When browser language is set to any language using comma as a decimal separator it breaks the progressbars:

https://github.com/netbox-community/netbox/issues/11273
3675ad2539/netbox/utilities/templates/helpers/utilization_graph.html (L6)

HTML doesn't support commas there for displaying progressbars. Possible solution is to disable the LocaleMiddleware again until we have a better understanding of the effects. Alternatively find all the places where comma as a decimal separator is invalid and find a way to output the unlocalized float.

It is not possible to configure the date and datetime format anymore

https://github.com/netbox-community/netbox/issues/11189#issuecomment-1356326763
https://github.com/netbox-community/netbox/issues/11268

The way to configuring a global date and datetime format with LocaleMiddleware installed seems to be the following:
https://docs.djangoproject.com/en/4.1/ref/settings/#format-module-path

Currently we do not expose this and frankly I think it's a bad UX to have to create formats.py for each language you want to control localization for. It is also not great for people running containerized as it forces either mounts or building a custom image. Maybe there's a better way I'm missing. My suggestion is to revert the USE_L10N and LocaleMiddleware changes until we have a better solution for all the above problems. Django 5 is not slated to come out until december 2023, so we have plenty of time. Currently I do not see any benefits to the changes.

An alternative to reverting would be allowing the disabling of the LocaleMiddleware by a netbox setting.

Justification

Without these changes we can not turn on internationalization or support other languages.

Originally created by @arthanson on GitHub (Jan 13, 2023). Originally assigned to: @arthanson on GitHub. ### Proposed Changes re-enable USE_L10N and LocaleMiddleware. There was a previous issue #11271 which solution was to disable internationalization. This is for updating the underlying problems so internationalization can be turned on in a future release. This issue is intended to track all the issues related to the enabling of USE_L10N and LocaleMiddleware. ### Some words are now translated, causing a mix of English and the browser language https://github.com/netbox-community/netbox/issues/11189#issuecomment-1356326763 - Humanized dates are output with localized `minutes/hours/days` https://github.com/netbox-community/netbox/issues/11240 - The word "Tags" is displayed as the German word "Schlagwörter" Possible solution is to disable USE_I18N as netbox is not yet translated itself. ### Floats are output with localized decimal separator breaking progress bars and other functionality https://github.com/netbox-community/netbox/issues/11272 - Device position dropdown gets the U value with a comma, causing device save to fail. https://github.com/netbox-community/netbox/discussions/11270 - When browser language is set to any language using comma as a decimal separator it breaks the progressbars: https://github.com/netbox-community/netbox/issues/11273 https://github.com/netbox-community/netbox/blob/3675ad2539400038af6797140ddca3679b8bca30/netbox/utilities/templates/helpers/utilization_graph.html#L6 HTML doesn't support commas there for displaying progressbars. Possible solution is to disable the LocaleMiddleware again until we have a better understanding of the effects. Alternatively find all the places where comma as a decimal separator is invalid and find a way to output the unlocalized float. ### It is not possible to configure the date and datetime format anymore https://github.com/netbox-community/netbox/issues/11189#issuecomment-1356326763 https://github.com/netbox-community/netbox/issues/11268 The way to configuring a global date and datetime format with LocaleMiddleware installed seems to be the following: https://docs.djangoproject.com/en/4.1/ref/settings/#format-module-path Currently we do not expose this and frankly I think it's a bad UX to have to create formats.py for each language you want to control localization for. It is also not great for people running containerized as it forces either mounts or building a custom image. Maybe there's a better way I'm missing. My suggestion is to revert the `USE_L10N` and `LocaleMiddleware` changes until we have a better solution for all the above problems. Django 5 is not slated to come out until december 2023, so we have plenty of time. Currently I do not see any benefits to the changes. An alternative to reverting would be allowing the disabling of the `LocaleMiddleware` by a netbox setting. ### Justification Without these changes we can not turn on internationalization or support other languages.
adam closed this issue 2025-12-29 20:24:30 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Apr 14, 2023):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Apr 14, 2023): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@DanSheps commented on GitHub (Apr 19, 2023):

Currently we do not expose this and frankly I think it's a bad UX to have to create formats.py for each language you want to control localization for. It is also not great for people running containerized as it forces either mounts or building a custom image. Maybe there's a better way I'm missing. My suggestion is to revert the USE_L10N and LocaleMiddleware changes until we have a better solution for all the above problems. Django 5 is not slated to come out until december 2023, so we have plenty of time. Currently I do not see any benefits to the changes.

In internationalization, you would need to create a language pack for each language anyways, adding additional files for the formats I don't think is much more of a burden.

IMO, we should start working on building out our language packs

(Also blocking this so the bot doesn't close it, as this is for tracking purposes and not specifically to resolve anything yet)

@DanSheps commented on GitHub (Apr 19, 2023): > Currently we do not expose this and frankly I think it's a bad UX to have to create formats.py for each language you want to control localization for. It is also not great for people running containerized as it forces either mounts or building a custom image. Maybe there's a better way I'm missing. My suggestion is to revert the USE_L10N and LocaleMiddleware changes until we have a better solution for all the above problems. Django 5 is not slated to come out until december 2023, so we have plenty of time. Currently I do not see any benefits to the changes. In internationalization, you would need to create a language pack for each language anyways, adding additional files for the formats I don't think is much more of a burden. IMO, we should start working on building out our language packs (Also blocking this so the bot doesn't close it, as this is for tracking purposes and not specifically to resolve anything yet)
Author
Owner

@jeremystretch commented on GitHub (May 2, 2023):

There is a whole mess of things to unpack here. What are the intended next steps for this issue?

Also blocking this so the bot doesn't close it, as this is for tracking purposes and not specifically to resolve anything yet

Please use the status: accepted label to indicate this, rather than status: blocked.

@jeremystretch commented on GitHub (May 2, 2023): There is a whole mess of things to unpack here. What are the intended next steps for this issue? > Also blocking this so the bot doesn't close it, as this is for tracking purposes and not specifically to resolve anything yet Please use the `status: accepted` label to indicate this, rather than `status: blocked`.
Author
Owner

@arthanson commented on GitHub (May 3, 2023):

@jeremystretch updated the title and description a bit, the next step is to re-enable USE_L10N and LocaleMiddleware, however there are several underlying issues that need to be checked / corrected before this can be done. The rest of the description is to track these issues.

@arthanson commented on GitHub (May 3, 2023): @jeremystretch updated the title and description a bit, the next step is to re-enable USE_L10N and LocaleMiddleware, however there are several underlying issues that need to be checked / corrected before this can be done. The rest of the description is to track these issues.
Author
Owner

@github-actions[bot] commented on GitHub (Aug 16, 2023):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Aug 16, 2023): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@arthanson commented on GitHub (Aug 18, 2023):

closing this as the individual issues have been addressed in separate tickets.

@arthanson commented on GitHub (Aug 18, 2023): closing this as the individual issues have been addressed in separate tickets.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7512