Localization - running in linux container
Describe the bug
This bug is really a difference between platforms. When running on my debug machine (windows), localization works great. When I containerize, the .net runtime isn't able to find the localization files and I'm left with a website showing me the localization labels instead of what they're supposed to resolve to. I'm not sure what can fix this, but I renamed all of the *.en.resx files to *.resx and they successfully serve as the default language.
To Reproduce
Containerize and run
If I'm messing something up, perhaps not setting an environment variable, I'd love to understand what I'm doing wrong.
@cculver , not sure from what version of templates you used to scaffold your project, but just in case...
Few things I would recommend to look at...
- Check whether your scaffolded *.Admin project is using nuget package
Skoruba.Duende.IdentityServer.Admin.UI. If it is, get source code and use it as project reference instead.
If still having problems Make sure that all of resx files in Skoruba.Duende.IdentityServer.Admin.UI project are marked as embedded resource for build action.
I don't remember the default behavior with empty configuration, but just in case, your scaffolded *.Admin project configuration has CultureConfiguration section. You would need to configure the Cultures array with the list of 2 char cultures that you want to support (to drive the language selection dropdown) and then you'd also provide value for DefaultCulture.
Since you mentioned that you renamed *.en.resx files, your CultureConfiguration config section in appsettings.json would look similar to:
"CultureConfiguration": {
"Cultures": [ "en" ],
"DefaultCulture": "en"
}
Make sure to update the configuration provider your containerized app is using (if other than appsettings.json).
FWIW, we are using the project in custom linux containers (not using provided Dockerfiles and removed the calls to DockerHelpers.ApplyDockerConfiguration(configuration); in all 3 projects (Admin, API and STS).
Thanks, I completely missed doing this through configuration and expected it to, for some reason, work out of the box automatically detecting language. If you don't hear back, that was the answer.