Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Browser Language
#1
Hello,

is there a way to read the language of the user browser?

I want to create a multilingual program, but so that you do not have to constantly choose your language, I would like to read the browser language in advance and set the language.

Thanks,
Michael
Reply
#2
Hi Michael, maybe you can use UserAgent to do that ???
Code:
WebApplication.Request.UserAgent;
or
WebApplication.Browser.UserAgent;
Reply
#3
Thanks, but from the information you can not read the set language.

I have now found a solution, but I don't think it is the best way. Big Grin

I have inserted an IWEdit and an IWTimer on the Form.
The procedure IWAppFormCreate gets the following two lines:

AddToInitProc('document.getElementById("IWEDIT1").value=navigator.language;');
AddToInitProc('AddChangedControl("IWEDIT1");');

At IWTimer1AsyncTimer I can then read the text from the IWEdit and set my program to the language.
Maybe there is a way to write the navigator.language directly into a variable of the form instead of into an IWEdit. Huh
Reply
#4
Hi Michael,

Can't you use WebApplication.Request.AcceptLanguage?

See https://developer.mozilla.org/en-US/docs...t-Language
Reply
#5
(01-26-2022, 02:38 PM)jeroen.rottink Wrote: Hi Michael,

Can't you use WebApplication.Request.AcceptLanguage?

See https://developer.mozilla.org/en-US/docs...t-Language

Hi,

that I have also already discovered and pleased. Big Grin

Unfortunately, all available languages are listed here and not which is currently selected. Sad
Reply
#6
Templates would be very useful in addition but not necessary.

If you look in the browser agent I believe it has the language. One of the headers does.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)