
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@getcircuit/intl-tools
Advanced tools
@getcircuit/intl-toolsPackage of i18n related tools for Circuit's web apps.
Circuit has its specific requirements regarding i18n. Our i18n approach is based react-intl, but we have a few additional requirements that are not supported natively by it.
@getcircuit/intl-tools is a wrapper around react-intl that provides a few additional features that will be explained in the following sections.
This package is supposed to work exactly like react-intl, so make sure to check out their documentation.
The main key differences are the following:
IntlToolsProvider instead of IntlProviderInstead of using IntlProvider from react-intl, use IntlToolsProvider from @getcircuit/intl-tools.
-import { IntlProvider } from 'react-intl'
+import { IntlToolsProvider } from '@getcircuit/intl-tools'
const App = () => {
return (
- <IntlProvider locale="en" messages={messages}>
+ <IntlToolsProvider locale="en" messages={messages} preferredHourFormat="24-hour">
<App />
+ </IntlToolsProvider>
- </IntlProvider>
)
}
useIntlTools instead of useIntlInstead of using intl from react-intl, use intlTools from @getcircuit/intl-tools.
-import { useIntl } from 'react-intl'
+import { useIntlTools } from '@getcircuit/intl-tools'
const MyComponent = () => {
- const intl = useIntl()
+ const intlTools = useIntlTools()
const { preferredHourFormat, formatEpochTime, formatEpochDate, formatCurrency } = intlTools
// ...
}
IntlToolsBag instead of IntlShapeThe object exposed by the IntlToolsProvider and read via useIntlTools is not the same as the one provided by react-intl. It's composed of a reduced version of the original IntlShape object, plus a few extra properties.
type IntlToolsBag = {
// Picked, original properties
locale: string
timeZone?: string
messages: Record<string, string>
textComponent: React.ElementType
formatDate
formatDateToParts
formatTime
formatTimeToParts
formatRelativeTime
formatNumber
formatPlural
formatMessage
formatList
// Extra properties
preferredHourFormat: '12-hour' | '24-hour'
formatEpochTime
formatEpochDate
formatCurrency
}
This decision was done to provide an easier-to-use API for Circuit's use case. We can always add more properties to the
IntlToolsBagobject if needed. What's important is that we have control over this object and we can add/remove properties as we see fit.
And that's it, really. The rest of the API is the same as react-intl.
@getcircuit/intl-tools provides the same components as react-intl, plusa few additional ones.
import {
// Original components
FormattedDate,
FormattedDateToParts,
FormattedTime,
FormattedTimeToParts,
FormattedNumber,
FormattedMessage,
FormattedList,
FormattedPlural,
FormattedRelativeTime,
// Additional components
FormattedCurrency,
} from '@getcircuit/intl-tools'
The original components documentation can be found in react-intl's page.
FormattedCurrencyFormats a number as the specified currency. It takes the same props as react-intl's FormattedNumber, but it also takes into account the user's preferences and some other Circuit specific requirements.
import { FormattedCurrency } from '@getcircuit/intl-tools'
const MyComponent = () => {
return (
<FormattedCurrency value={1000} currency="USD" currencyDisplay="symbol" />
)
}
FormattedEpochTimeFormats an epoch timestamp as time.
import { FormattedEpochTime } from '@getcircuit/intl-tools'
const MyComponent = () => {
return <FormattedEpochTime value={1679064790} /> // 15:53
}
FormattedEpochDateFormats an epoch timestamp as date.
import { FormattedEpochDate } from '@getcircuit/intl-tools'
const MyComponent = () => {
return <FormattedEpochDate value={1679064790} /> // 2023-03-17
}
FormattedSecondsTimeFormats a number of seconds as time.
import { FormattedSecondsTime } from '@getcircuit/intl-tools'
const MyComponent = () => {
return <FormattedSecondsTime value={3600} /> // 01:00
}
@getcircuit/intl-tools provides a few handy utilities.
getBrowserLocale()Returns the browser's locale.
import { getBrowserLocale } from '@getcircuit/intl-tools'
const locale = getBrowserLocale() // 'en-GB'
getBrowserTimeZoneReturns the browser's time zone.
import { getBrowserTimeZone } from '@getcircuit/intl-tools'
const timeZone = getBrowserTimeZone() // 'Europe/London'
getBrowserHourFormatReturns the browser's hour format in Circuit's 12-hour or 24-hour format.
Note ⚠️: this method doesn't work in Firefox. Make sure to provide a fallback value if you need to support Firefox.
import { getBrowserHourFormat } from '@getcircuit/intl-tools'
const hourFormat = getBrowserHourFormat() // '12-hour'
FAQs
Unknown package
We found that @getcircuit/intl-tools demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 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
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.