-
Notifications
You must be signed in to change notification settings - Fork 60
Description
It would be useful if BiDi clients could fully emulate the browser’s locale, including key functionalities such as:
-
Accept-LanguageHTTP Headers:- Allow the browser to send the appropriate
Accept-Languageheader according to the emulated locale settings.
- Allow the browser to send the appropriate
-
JavaScript APIs (
Date,Intl):- Ensure that JavaScript Date and Internationalization APIs (
Intl) reflect the correct locale-based formats (e.g., date, currency, numbers).
- Ensure that JavaScript Date and Internationalization APIs (
-
Navigator.language:- Properly simulate the
navigator.languagevalue in the emulated environment.
- Properly simulate the
Expected Behavior:
The emulation should consistently apply the locale across:
- HTTP Headers: Emulating
Accept-Languagebased on the locale. - JS APIs: Reflecting the locale in Date formatting and
IntlAPIs for things like number and currency formatting. - Navigator Properties: Ensuring that
navigator.languagematches 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-LanguageHeader:- Similar to the ability to set custom HTTP headers via
page.setExtraHTTPHeaders(), but tied to the locale setting of the browser.
- Similar to the ability to set custom HTTP headers via
-
IntlandDateAPIs:- Ensure that JavaScript's
DateandIntlAPIs automatically reflect the locale and language settings passed during browser initialization (e.g.,page.setLocale()).
- Ensure that JavaScript's
-
Navigator.language:- Override the
navigator.languageproperty so that it correctly reflects the locale setting (e.g.,en-US,fr-FR).
- Override the
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.