Get to know MDN better
Esta página foi traduzida do inglês pela comunidade. Saiba mais e junte-se à comunidade MDN Web Docs.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since setembro de 2017.
* Some parts of this feature may have varying levels of support.
O objeto Intl é o namespace para a API de Internacionalização do ECMAScript , que fornece comparação de string sensível à línguagem, formatação de números, e formatação de data e hora. Os construtores para os objetos Collator, NumberFormat, e DateTimeFormat são propriedades do objecto Intl. Esta página documenta essas propriedades, bem como funcionalidades comuns aos construtores de internacionalização e outras funções sensíveis de linguagem.
Construtor para collators, objetos que permitem comparação de string sensível a linguagem.
Intl.DateTimeFormatConstrutor para objetos que permitem formatação de data e hora sensível a linguagem.
Intl.NumberFormatConstrutor para objetos que permitem formatação de número sensível a linguagem.
Retorna os nomes canônicos de local (ex.: en-US, pt-BR).
Os construtores de internacionalização, assim como diversos métodos de outros construtores que são sensíveis a idioma (listados em Veja também) usam um padrão comum para identificar locais e determinar qual será utilizado: todos aceitam argumentos locales e options e negociam o(s) local(is) requisitado entre os locais suportados usando um algoritmo especificado na propriedade options.localeMatcher.
O argumento locales deve ser uma string contendo uma tag de linguagem BCP 47 ou um array dessas tags. Se o argumento locales não for passado ou estiver indefinido, será utilizado o local padrão do runtime.
Uma tag de linguagem BCP 47 identifica um idioma ou local (a diferença entre ambos neste caso é difusa). Em sua forma mais comum, ela pode conter, nesta ordem: um código de idioma, um código de escrita e um código de país, todos eparados por hífen. Exemplos:
As subtags identificando idiomas, escritas, países (regiões) e (raramente utilizadas) variantes nas tags de linguagem BCP 47 podem ser consultadas no Registro de Subtags de Linguagem da IANA.
BCP 47 também permite extensões, e uma delas é relevante para as funções JavaScript de internacionalização: a extensão "u" (Unicode). Ela pode ser utilizada para requisitar uma customização do comportamento específico local de um objeto Collator, NumberFormat, ou DateTimeFormat. Exemplos:
The locales argument, after stripping off all Unicode extensions, is interpreted as a prioritized request from the application. The runtime compares it against the locales it has available and picks the best one available. Two matching algorithms exist: the "lookup" matcher follows the Lookup algorithm specified in BCP 47; the "best fit" matcher lets the runtime provide a locale that's at least, but possibly more, suited for the request than the result of the Lookup algorithm. If the application doesn't provide a locales argument, or the runtime doesn't have a locale that matches the request, then the runtime's default locale is used. The matcher can be selected using a property of the options argument (see below).
If the selected language tag had a Unicode extension substring, that extension is now used to customize the constructed object or the behavior of the function. Each constructor or function supports only a subset of the keys defined for the Unicode extension, and the supported values often depend on the language tag. For example, the "co" key (collation) is only supported by Collator, and its "phonebk" value is only supported for German.
The options argument must be an object with properties that vary between constructors and functions. If the options argument is not provided or is undefined, default values are used for all properties.
One property is supported by all language sensitive constructors and functions: The localeMatcher property, whose value must be a string "lookup" or "best fit" and which selects one of the locale matching algorithms described above.
| ECMAScript® 2027 Internationalization API Specification # intl-object |
Enable JavaScript to view this browser compatibility table.
Introduction: The ECMAScript Internationalization API
Constructors
Methods
This page was last modified on 24 de jun. de 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.