Atozed Forums
Browser Language - Printable Version

+- Atozed Forums (https://www.atozed.com/forums)
+-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html)
+--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html)
+---- Forum: English (https://www.atozed.com/forums/forum-16.html)
+----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html)
+----- Thread: Browser Language (/thread-2629.html)



Browser Language - Michael - 01-25-2022

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


RE: Browser Language - Jose Nilton Pace - 01-25-2022

Hi Michael, maybe you can use UserAgent to do that ???
Code:
WebApplication.Request.UserAgent;
or
WebApplication.Browser.UserAgent;



RE: Browser Language - Michael - 01-26-2022

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


RE: Browser Language - jeroen.rottink - 01-26-2022

Hi Michael,

Can't you use WebApplication.Request.AcceptLanguage?

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language


RE: Browser Language - Michael - 02-02-2022

(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/Web/HTTP/Headers/Accept-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


RE: Browser Language - kudzu - 02-25-2022

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.