Docs
/Usage guide
/Runtime requirements & polyfills
Runtime requirements
This page outlines requirements for your environment to use next-intl
.
Browser
Based on the features you're using, you have to make sure your browser supports the following APIs:
- Basic usage:
Intl.Locale
(compatibility) - Date & time formatting:
Intl.DateTimeFormat
(compatibility) - Number formatting:
Intl.NumberFormat
(compatibility) - Pluralization:
Intl.PluralRules
(compatibility) - Relative time formatting:
Intl.RelativeTimeFormat
(compatibility)
If you target a browser that doesn't support all the required APIs, consider using polyfills. Polyfill.io is a valuable solution for this that helps you to load only the polyfills you need for a given locale.
Example:
import {useLocale} from 'next-intl';
import Script from 'next/script';
// Use this component in your Next.js custom `_app`
export default function IntlPolyfills() {
const locale = useLocale();
const polyfills = [
'Intl',
'Intl.Locale',
'Intl.DateTimeFormat',
`Intl.DateTimeFormat.~locale.${locale}`,
`Intl.NumberFormat`,
`Intl.NumberFormat.~locale.${locale}`,
'Intl.PluralRules',
`Intl.PluralRules.~locale.${locale}`,
'Intl.RelativeTimeFormat',
`Intl.RelativeTimeFormat.~locale.${locale}`
];
return (
<Script
strategy="beforeInteractive"
src={'https://polyfill.io/v3/polyfill.min.js?features=' + polyfills.join(',')}
/>
);
}
Node
The minimum required version is Node.js 13. Starting from this version, all required APIs are available.