![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
This is an utility for internationalization of applications.
An example with NextJS will be as follows:
import withRouter, { WithRouterProps } from 'next/dist/client/with-router';
import buildTranslateFunction from 'intl-utils';
import translations from './translations';
function HomePage(props: WithRouterProps) {
const t = buildTranslateFunction(translations, props.router.locale);
return <p>{t('Hello World')}</p>
}
export default withRouter(HomePage);
Where translations.js
is as follows:
/* spellchecker: disable */
module.exports = {
"es": {
"Hello World": "Hola mundo"
},
"fr": {
"Hello World": "Bonjour le monde"
},
"it": {
"Hello World": "Ciao mondo"
},
"pt": {
"Hello World": "Olá, mundo"
}
}
The structure of the file is:
module.exports = {
LOCALE: {
KEY: TRANSLATED_KEY
}
}
Where TRANSLATED_KEY is the translation of KEY on LOCALE
Please note that intl-utils-aws-translate can help you to automatically generate the translation files using AWS Translate.
npm test
npm version patch
npm run build
npm publish
git push --tags && git push
FAQs
Utilities for internationalization
We found that intl-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.