Browser Language

<< Click to Display Table of Contents >>

Navigation:  Forum >

Browser Language

Forum link

 


 

01-25-2022, 07:47 AM:

 

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

 


 

01-25-2022, 02:52 PM:

 

Hi Michael, maybe you can use UserAgent to do that ???

 

Code:

 

WebApplication.Request.UserAgent;

 

WebApplication.Browser.UserAgent;

 

 

 


 

01-26-2022, 10:40 AM:

 

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.

 

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.

 


 

01-26-2022, 02:38 PM:

 

Hi Michael,

 

Can't you use WebApplication.Request.AcceptLanguage?

 

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

 


 

02-02-2022, 05:09 AM:

 

(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.

 

Unfortunately, all available languages are listed here and not which is currently selected.

 


 

02-25-2022, 01:01 AM:

 

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.