Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I set HTMLLanguage per session or form?
#5
Thanks,

WebApplication.Language was the kind of property I was looking for. As I have tested this I have noticed that the property value does not seem persistent. After setting the property the first time for a session, I successfully get the correct language in the generated page, but when I check the property value again in the next server event handler for the session I see that it is empty again. So I ended up adding code like this to make it work:

Code:
procedure TBaseClientServerController.IWServerControllerBaseBeforeRender(
  ASession: TIWApplication; AForm: TIWBaseForm; var VNewForm: TIWBaseForm);
begin
  if Assigned(ASession) and (ASession.Data is TMyBaseUserSession) then
    ASession.Language := TMyBaseUserSession(ASession.Data).HTMLLanguage;
end;

where HTMLLanguage is a property I added in my base class for our user sessions which is populated with a language code based on settings for the account the session belongs to. This works fine, but I just wanted to check if this is the way it's intended to be used?
Reply


Messages In This Thread
RE: How can I set HTMLLanguage per session or form? - by magosk - 12-12-2023, 12:35 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)