netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.8k stars 2.54k forks source link

Language settings not applied correctly after logout #16512

Closed bone6000 closed 3 months ago

bone6000 commented 3 months ago

Deployment Type

Self-hosted

NetBox Version

v4.0.2

Python Version

3.10

Steps to Reproduce

  1. Changed language to "english" in user profile.
  2. All menus are changing to english correctly
  3. Logout and login again in netbox
  4. All menus are in spanish but in profile configuration language "english" is selected
  5. Pressing "Save" without changing profile config, changes the language back to english, but the issue reproduces if logout again

image

Expected Behavior

Language settings should not be "lost" when logout

Observed Behavior

Language changes to spanish (default machine language) when logging out but user profile settings is in english

wargbang commented 3 months ago

NetBox Version v4.0.5

Python Version 3.10

I see the same behavior with the language "German". But a little different.

  1. Changed language to "english" in user profile.
  2. All menus are changing to english correctly
  3. Logout and login again in netbox
  4. Language remains in the "English" setting.

However, the language does not reset when I "log out" and "log in" in my Case. After a period of time unknown to me, the language changes automatically back to "German". And then I have the same behaviour like bone6000:

All menus are in german but in profile configuration language "english" is selected

jeffgdotorg commented 3 months ago

Thanks for reporting a problem you're experiencing with NetBox.

In an attempt to reproduce this issue, I set up the following systems:

The server looks like this:

ubuntu@nb405-repro-16512:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.4 LTS"
ubuntu@nb405-repro-16512:~$ echo $LANG
C.UTF-8

And the desktop looks like this:

jeffg@el-jefe-u2404-es:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04 LTS"
jeffg@el-jefe-u2404-es:~$ echo $LANG
es_ES.UTF-8

image

As the screen recording below shows, I did not manage to reproduce the problem as described using this setup.

https://github.com/netbox-community/netbox/assets/1209268/ca5fda0a-59d9-4c22-af22-557795da2655

Can you please provide the equivalent details about your desktop and server systems? It seems plausible that the C locale on my server side might be responsible for US English being the default language that gets rendered. If your server side is set to an es locale, perhaps that's leading to Spanish being the default rendered language.

jeremystretch commented 3 months ago

I can reproduce this following these steps:

  1. Log in as a user with no preferred language. The UI shows English (for me, at least).
  2. Set your preferred language to Spanish and confirm that the UI is now in Spanish.
  3. Open a new private browser window and log in as the same user.
  4. The UI should be in Spanish, per the user's preference, but I see it in English. The user's preference page shows Spanish as the preferred language.
bone6000 commented 3 months ago

Hello,

My desktop is a Windows 11 in spanish language. The netbox server is a Centos 8 distribution with "es" locale configured

[usertst@netbox01]$ cat os-release NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8"

Regards