Saltar al contenido principal

Intl.Locale

Traducción Beta No Oficial

Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →

Un polyfill/ponyfill compatible con la especificación para Intl.Locale, probado por el conjunto oficial de pruebas de conformidad ECMAScript

npm Version size

Instalación

npm i @formatjs/intl-locale

Requisitos

Uso

Mediante polyfill-fastly.io

Puedes usar el Constructor de URLs polyfill-fastly.io para crear una etiqueta de script polyfill para Intl.Locale. Por ejemplo:

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

Sencillo

import '@formatjs/intl-locale/polyfill'

Importación dinámica + detección de capacidades

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

Pruebas

Esta biblioteca cumple con los estándares de test262.