Emulate browser locale (including Accept-Language header, Intl APIs, and Navigator.language) #774
Labels
enhancement
New feature or request
module-emulation
Emulation module
needs-discussion
Issues to be discussed by the working group
It would be useful if BiDi clients could fully emulate the browser’s locale, including key functionalities such as:
Accept-Language
HTTP Headers:Accept-Language
header according to the emulated locale settings.JavaScript APIs (
Date
,Intl
):Intl
) reflect the correct locale-based formats (e.g., date, currency, numbers).Navigator.language
:navigator.language
value in the emulated environment.Expected Behavior:
The emulation should consistently apply the locale across:
Accept-Language
based on the locale.Intl
APIs for things like number and currency formatting.navigator.language
matches the emulated locale.Use Case:
Many modern web applications use locale information for rendering content, formatting dates/numbers, and providing localized experiences to users. Having full locale emulation is critical for testing applications in different regions and languages to ensure proper functionality.
Potential Implementation:
Accept-Language
Header:page.setExtraHTTPHeaders()
, but tied to the locale setting of the browser.Intl
andDate
APIs:Date
andIntl
APIs automatically reflect the locale and language settings passed during browser initialization (e.g.,page.setLocale()
).Navigator.language
:navigator.language
property so that it correctly reflects the locale setting (e.g.,en-US
,fr-FR
).Impact:
Implementing this feature would significantly improve localization and internationalization (i18n) testing for web applications, as it would allow a more realistic and complete emulation of how the browser behaves with respect to different locales.
The text was updated successfully, but these errors were encountered: