Zum Hauptinhalt springen

Intl.getCanonicalLocales

Inoffizielle Beta-Übersetzung

Diese Seite wurde von PageTurner AI übersetzt (Beta). Nicht offiziell vom Projekt unterstützt. Fehler gefunden? Problem melden →

Ein spezifikationskonformes Polyfill/Ponyfill für Intl.getCanonicalLocales, getestet durch das offizielle ECMAScript-Konformitätstest-Suite

npm Version size

Installation

npm i @formatjs/intl-getcanonicallocales

Verwendung

Über polyfill-fastly.io

Mit dem polyfill-fastly.io URL Builder können Sie ein Polyfill-Script-Tag für Intl.GetCanonicalLocales erstellen. Beispiel:

<!-- Polyfill Intl.GetCanonicalLocales & its dependencies -->
<script src="https://polyfill-fastly.io/v3/polyfill.min.js?features=Intl.GetCanonicalLocales"></script>

Einfach

import '@formatjs/intl-getcanonicallocales/polyfill'

Dynamischer Import + Funktionserkennung

import {shouldPolyfill} from '@formatjs/intl-getcanonicallocales/should-polyfill'
async function polyfill() {
// This platform already supports Intl.getCanonicalLocales
if (shouldPolyfill()) {
await import('@formatjs/intl-getcanonicallocales/polyfill')
}
// Alternatively, force the polyfill regardless of support
await import('@formatjs/intl-getcanonicallocales/polyfill-force')
}

Tests

Diese Bibliothek ist test262-konform.