Open violaguttorm opened 1 day ago
Correct that it is missing on DataCreation
. It's somewhat hard to update interfaces (we need to have an update script for apps, but we only do that on major releases), but we could at least send the data from frontend, so you can get it from _httpContextAccessor.HttpContext.Request.Query.TryGetValue("language", out var language);
.
For the UserActionContext
, I think the issues should be fixed in the latest versions. What versions of frontend and backend are you using?
As far as I read the current main
app-frontend-react code, we already send ?language=nb
as a query parameter, so getting it from httpContext should work.
@ivarne I am stuck on front-end version 4.8.2
because of an unrelated issue (https://github.com/Altinn/app-frontend-react/issues/2755), but I can confirm the language parameter is there if I force the newest version. So the instantiation problem is solved as soon as we figure out the other issue! :blush:
The UserActionContext
still doesn't work however. It has a parameter for Language (context.Language
), but it always becomes null
, at least when I test locally. I updated Altinn.App.Api
and Altinn.App.Core
from version 8.2.4
to version 8.3.8
(what NuGet recommended), but it still didn't work. The "actions" call also does not contain a language query parameter even on the newest (default) front-end. I haven't tried the preview ones.
Am I doing something wrong?
Here is the code where I try to print the language code to no avail (excuse the test code around it, I have also taken a look with more sophisticated debugging tools however, and can confirm it is indeed null
): https://altinn.studio/repos/brg/rrh-innrapportering/src/branch/560-engelsk-nynorsk/App/logic/Actions/FnrSearchAction.cs#L73
Here is the place I use this for a button in the layout: https://altinn.studio/repos/brg/rrh-innrapportering/src/branch/560-engelsk-nynorsk/App/ui/rrh-form/layouts/rrh_utfylling.json#L183
Description of the bug
I need the language parameter for these as I need to store certain values in the datamodel in the correct language for the user.
IInstantiationProcessor->DataCreation
does not have any parameters for language at all.IUserAction->HandleAction
has a parameter of the typeUserActionContext
, which has a Language-parameter, but this one is alwaysnull
.According to the Network-tab in the browser, at least HandleAction does not even send language as part of the HTTP-request, so there in no way I can get it.
Steps To Reproduce
IUserAction->HandleAction
.Additional Information
No response