pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.54k stars 659 forks source link

It seems impossible to change the default language used on the login page #5692

Open fnicollet opened 1 year ago

fnicollet commented 1 year ago

Describe the bug

When running pgAdmin4 in server mode, the login page is always in english

To Reproduce

Steps to reproduce the behavior:

  1. Go to pgAdmin4
  2. Labels read "Login" or "Forgotten your password"

Expected behavior

In my docker-compose.yml file, I tried setting the environment variable:

PGADMIN_DEFAULT_LANGUAGE=fr

I also tried adding to the "config_system.py" the following line:

DEFAULT_SERVER_LANGUAGE = 'fr'

I tried removing all the other languages, except french in the config_system.py file:

LANGUAGES = {
    'fr': 'French',
#    'en': 'English',
}

The list contains only one option, but the rest of the UI is still in English: image

I use the latest "dpage/pgadmin4" docker image

Additional context

I think that once you are connected, the language of the UI can be changed, but I would like to change the language of the default landing page as well.

It seems that those strings are hardcoded in the source code: https://github.com/pgadmin-org/pgadmin4/blob/master/web/pgadmin/templates/security/login_user.html#L23

So it might be more of a feature request ?

Thanks, Fabien

akshay-joshi commented 1 year ago

@fnicollet

We don't have parameters PGADMIN_DEFAULT_LANGUAGE and DEFAULT_SERVER_LANGUAGE. I am considering this as a feature request.

fnicollet commented 1 year ago

Yep, it's just (bad) information i found online, as the strings of the login page are currently hard-coded, this is more of a feature request

Thanks

dpage commented 1 year ago

We may have to infer the preferred language on the login page from the browsers preferred languages, and then allow overriding of that with the combo box. If the user has previously selected a language from the combo, then we can default to that from the cookie (which I'm assuming we set).

bbohard commented 3 weeks ago

As I am also asked to set default language for web interface (as in independant of user request), I would find useful to have some configuration variable (such as DEFAULT_SERVER_LANGUAGE or PGADMIN_DEFAULT_LANGUAGE) we could use in function get_locale in web/pgadmin/init.py. In my case, we use the deb package from the repository then use templating engine to generate config_local.py and customize the instance. But to set default language as asked, we resort to overwriting init.py which is not a so good idea (debsums reminds us of that).

Thanks

adityatoshniwal commented 2 weeks ago

As I am also asked to set default language for web interface (as in independant of user request), I would find useful to have some configuration variable (such as DEFAULT_SERVER_LANGUAGE or PGADMIN_DEFAULT_LANGUAGE) we could use in function get_locale in web/pgadmin/init.py. In my case, we use the deb package from the repository then use templating engine to generate config_local.py and customize the instance. But to set default language as asked, we resort to overwriting init.py which is not a so good idea (debsums reminds us of that).

Thanks

DEFAULT_LANGUAGE can be used as a new config var.