Zenika / alpine-chrome

Chrome Headless docker images built upon alpine official image
https://hub.docker.com/r/zenika/alpine-chrome
Apache License 2.0
1.78k stars 239 forks source link

How to configure supported locales for Intl apis #233

Closed kushuh closed 11 months ago

kushuh commented 11 months ago

I'm trying to use the Intl DateTimeFormat API from the chromium browser, but only the "en-US" locale seems supported.

new Intl
    .DateTimeFormat("fr", { year: "numeric", month: "long", day: "numeric" })
    .format(new Date())

Expected: 16 août 2023

Got: August 16, 2023

I tried to override the default implementation with a polyfill, with no success, by including this tag (I tried both in head and at the beginning of the body). But it didn't work:

<script src="https://polyfill.io/v3/polyfill.min.js?features=Intl,Intl.Locale,Intl.GetCanonicalLocales,Intl.PluralRules,Intl.PluralRules.~locale.fr,Intl.NumberFormat,Intl.NumberFormat.~locale.fr,Intl.DateTimeFormat,Intl.DateTimeFormat.~locale.fr&flags=always"></script>

Is it possible to configure the available locales and have many loaded at once ?

This is the configuration I am using:

image: zenika/alpine-chrome:102
command:
  [
    chromium-browser,
    "--single-process",
    "--no-zygote",
    "--no-sandbox",
    "--disable-dev-shm-usage",
    "--hide-scrollbars",
    "--headless",
    "--disable-gpu",
  ]