I made a dash app and implemented translation options using gettext. I use a def to set the locales directory, initiate and install the gettext translations. When I set the initial language to any of the languages, the app loads in the corresponding language and the translations show perfectly. But I wonder how I can get the user to change the language. I created a dropdown and use a callback to set the the new language based on user selection but this does not work as the whole layout would need to reload based on the new language. I tried to use dcc.Location which enables a reload upon dropdown selection but this still does not do the trick. It looks like once gettext translations are installed, the only way to change is to restart the server, and even then., the same initial language is loaded. Current structure:
import gettext
def update language(): #gettext gets loaded
def… #incl. items to be translated
def… #incl. items to be translated
set initial language
call update language()
app = Dash…
app.layout…
…
callbacks
app.run.server
I would very much appreciate any solutions or ideas as to how to structure the app and/or what tools to use to enable user selected translation options!