-
Notifications
You must be signed in to change notification settings - Fork 75
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
Application language support #8483
Application language support #8483
Conversation
Thx:) We'll process this PR, and related PR's, as soon as possible. |
Once again, thank you so much for contributing an entire epic!
We will as soon as possible get back to you with more local review on the related pull requests. |
src/Altinn.Platform/Altinn.Platform.Storage/Storage.Interface/Models/ApplicationLanguage.cs
Outdated
Show resolved
Hide resolved
…onLanguage + bumpet versjon av storage interface
1e0ce33
to
d9e7dd9
Compare
d9e7dd9
to
260b4b7
Compare
....Platform/Altinn.Platform.Storage/Storage.Interface/Altinn.Platform.Storage.Interface.csproj
Outdated
Show resolved
Hide resolved
@ZuperNova I've started some preliminary testing of this feature. What I've done so far is:
Anything else I need to do to get this up and running? Currently I don't see the language selector, nor do I see any language requests from the frontend so I've probably missed something. |
You also need to include some text resources (nb.json, en.json). Without this the frontend won't render the selector. |
Sorry, forgot to mention that but I created text resources in the above setup already. So I have resource.en.json, resource.nb.json and resource.nn.json - all with appName and one additional label translated. I see that your service work as expected because I created a dynamic options passing in the IApplicationLanguage interface and used that to create options for a dropdown list. Which is then populated with en, nb and nn. |
Okay, I understand. Have you also included the different attributes in the text resources that the selector use?
{
"id": "language.selector.label",
"value": "Språk"
},
{
"id": "language.full_name.nb",
"value": "Norsk bokmål"
},
{
"id": "language.full_name.en",
"value": "Engelsk"
}
{
"id": "language.selector.label",
"value": "Language"
},
{
"id": "language.full_name.en",
"value": "English"
},
{
"id": "language.full_name.nb",
"value": "Norwegian bokmål"
} |
I'm suspecting that it's not triggering as I see no requests from the frontend to the new api. My settings.json looks like this: {
"$schema": "https://altinncdn.no/schemas/json/layout/layoutSettings.schema.v1.json",
"pages": {
"order": [
"FormLayout",
"Side2"
]
},
"showLanguageSelector": true
} Anything else I've missed? |
The {
"$schema": "https://altinncdn.no/schemas/json/layout/layoutSettings.schema.v1.json",
"pages": {
"order": [
"FormLayout",
"Side2"
],
"showLanguageSelector": true
}
} |
Sigh, seem like I need to brush up my reading skills. Thx for your patience:) Up and running now. |
Hehe, no worries! Glad it worked out 😄 |
Application language support
Added support for changing the language in the application.
Description
This pull request contains an implementation that makes it possible to fetch the supported languages in an application.
Altinn-studio
Added a new model for application language.
Thoughts:
The TextResources-model is using the same attribute as the new model ApplicationLanguage. The attribute
language
should be renamed tolanguageCode
so that it is a more descriptive name. This also enables the oppertunity to rename the attributelanguageDescription
tolanguage
in ApplicationLanguage. Doing this requires renaming throughout the project.app-frontend-react
Expanded the
NavBar.tsx
to contain theDropdownComponent
.The dropdown used in this pull request is a the same component used within the application (
DropdownComponent
). This component is made reusable.The attribute
showLanguageDropdown
insettings.json
is used to determin if the dropdown menu should be visible or not.The chosen language is stored in the local storage.
The urlAppHelper contains the new exposed enpoint for fetching the supported languages for an application.
There has been created a new saga for application language.
Both of the sagas for
options
andtextResouce
has gotten some changes so that it uses the language from the dropdown.Tests have been added and updated.
app-template-dotnet
A new controller is added specifically for the application language. There is now one endpoint that exposes the supported languages of the specific application. The functionality behind this is introduced in the AppResorucesSI. Here it has been added a new function that traversers through every file in the text resource directory. While traversing it is looking for three attributes in the resource file, "language", "languageDescription" and "dropdownLabel". These are mapped over to the new model created in the Altinn-Studio Repo, ApplicationLanguage and added to the list. The function returns a list of ApplicationLanguages when done executing. There is also added validation that when fails returns an empty list.
Example:
resource.nb.json
resource.en.json
The function will then return:
Altinn-cdn
Added schema-description for
showLanguageDropdown
and also added the missing schema-description forhideCloseButton
.Altinn-studio-docs
Added documentation for the application translator.
Known bugs/missing elements
Error handling is not present at the moment in the frontend.When refreshing the page the dropdown dissapears.The PR is created even though we are awear of the issues mentioned above to give you a look and to comment on it.
Linked PRs
Altinn-studio-docs: Altinn/altinn-studio-docs#516
app-frontend-react: Altinn/app-frontend-react#83
Altinn-cdn: Altinn/altinn-cdn#96
app-template-dotnet: Altinn/app-template-dotnet#85
Fixes
Verification
Documentation