Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language selector options are not translated #1043

Closed
lasseklovstad opened this issue Mar 24, 2023 · 10 comments
Closed

Language selector options are not translated #1043

lasseklovstad opened this issue Mar 24, 2023 · 10 comments
Labels
kind/bug Something isn't working

Comments

@lasseklovstad
Copy link
Contributor

Description of the bug

If you have added custom language files their translations are not shown. If the app is stateless it helps to refresh the page for some reason. It seemes to be related to this issue i think: digdir/designsystemet#180

Steps To Reproduce

  1. Go to an app with translations
  2. Open the language selector
  3. the options are not translated

Additional Information

image

The textresources are probably fetched after the languageSelector has been rendered so the options will only use the key instead of the textresources value.

@lasseklovstad lasseklovstad added the kind/bug Something isn't working label Mar 24, 2023
@bjosttveit
Copy link
Member

Huh, the component should rerender if the textresources change. Do you have an app with custom languages I can take a look at?

@lasseklovstad
Copy link
Contributor Author

@bjosttveit if you want to see the behavior: https://udir.apps.tt02.altinn.no/udir/pbu-test-anonym and username: t-gangs-105 password: srxn9

@bjosttveit
Copy link
Member

Ahh, so it shows up when selected but not in the dropdown, weird!
image

@lasseklovstad
Copy link
Contributor Author

I changed the version of react app frontend to 3.58.0 and that works:
image

@bjosttveit
Copy link
Member

Yeah that component was recently switched out to use digdir/designsystem

@bjosttveit
Copy link
Member

Weird, I managed to reproduce this in my own app. But only by omitting the language name in some resource files. It worked for me as long as each language name was defined in all of the resource files.

@lasseklovstad
Copy link
Contributor Author

Interessting I can try that!

@lasseklovstad
Copy link
Contributor Author

lasseklovstad commented Mar 24, 2023

That doesn't seem to help for me... It seems wierd that it has to be defined in all the resourcefiles because it just fetches one language resource file at a time?

It could behave different in local development. Our demoapplication (stateless) show it correct after a refresh: https://udir.apps.tt02.altinn.no/udir/pbu-test-demo?survey=survey-5-aarstrinn5

@bjosttveit
Copy link
Member

That link worked without refresh for me

@lasseklovstad
Copy link
Contributor Author

This seemes to be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants