
Security News
CISA Extends MITRE Contract as Crisis Accelerates Alternative CVE Coordination Efforts
CISA extended MITREβs CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.
Minimal, but complete solution for managing internationalization in React apps.
A minimal, but complete solution for managing translations, date, time and number formatting in React apps.
children
as well as for attributes which expect strings.react-intl
).This library is based on the premise that messages can be grouped by namespaces (typically a component name).
// LatestFollower.js
import {useTranslations} from 'use-intl';
function LatestFollower({user}) {
const t = useTranslations('LatestFollower');
return (
<>
<Text>{t('latestFollower', {username: user.name})}</Text>
<IconButton aria-label={t('followBack')} icon={<FollowIcon />} />
</>
);
}
// en.json
{
"LatestFollower": {
"latestFollower": "{username} started following you",
"followBack": "Follow back"
}
}
npm install use-intl
import {IntlProvider} from 'use-intl';
// You can get the messages from anywhere you like. You can also
// fetch them from within a component and then render the provider
// along with your app once you have the messages.
const messages = {
"App": {
"hello": 'Hello {username}!'
}
};
function Root() {
return (
<IntlProvider messages={messages} locale="en">
<App user={{name: 'Jane'}} />
</IntlProvider>
);
}
function App({user}) {
const t = useTranslations('App');
return <h1>{t('hello', {username: user.name})}</h1>;
}
Have a look at the minimal setup example to explore a working app.
Please refer to the next-intl
usage docs for more advanced usage, but note that you should import from use-intl
instead of next-intl
.
FAQs
Internationalization (i18n) for React
The npm package use-intl receives a total of 464,566 weekly downloads. As such, use-intl popularity was classified as popular.
We found that use-intl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 0 open source maintainers 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
CISA extended MITREβs CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.
Product
Socket's Rubygems ecosystem support is moving from beta to GA, featuring enhanced security scanning to detect supply chain threats beyond traditional CVEs in your Ruby dependencies.
Research
The Socket Research Team investigates a malicious npm package that appears to be an Advcash integration but triggers a reverse shell during payment success, targeting servers handling transactions.