Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-globalize
Advanced tools
Easy to use React components that provide internationalization features out of the box via Globalize. With a quick update of a value, variable or locale, you get instant UI updates.
Components are the heart of React and the whole point of react-globalize. These components provide simple, easily updatable elements in your page to display things like currency, dates, numbers and messages, formatted or translated to the current locale set by your application.
Default format with USD in English
<FormatCurrency locale="en" currency="USD" value={150} />
Result: $150.00
Accounting format with EUR in Portuguese
<FormatCurrency locale="pt-BR" currency="EUR" value={-150} options={{ style: "accounting" }} />
Result: (€150,00)
Simple string skeleton in English
<FormatDate locale="en" value={new Date()} pattern="GyMMMd" />
Result: Feb 27, 2015 AD
Medium length date and time in Portuguese
<FormatDate locale="pt-BR" value={new Date()} pattern={{ datetime: 'medium' }} />
Result: 27 de fev de 2015 11:17:10
Below message JSON used in these examples:
{
en: {
salutations: {
hi: "Hi",
bye: "Bye"
},
variables: {
hello: "Hello, {0} {1} {2}",
hey: "Hey, {first} {middle} {last}"
}
},
"pt-BR": {
salutations: {
hi: "Oi",
bye: "Tchau"
},
variables: {
hello: "Olá, {0} {1} {2}",
hey: "Ei, {first} {middle} {last}"
}
}
}
Hi in English: <FormatMessage locale="en" path="salutations/hi" />
Result: Hi
Hi in Portuguese: <FormatMessage locale="pt-BR" path="salutations/hi" />
Result: Oi
Array in English: <FormatMessage locale="en" path="variables/hello" variables={["Wolfgang", "Amadeus", "Mozart"]} />
Result: Hello, Wolfgang Amadeus Mozart
Object in Portuguese: <FormatMessage locale="pt-BR" path="variables/hey" variables={{first:"Wolfgang", middle:"Amadeus", last:"Mozart"}} />
Result: Ei, Wolfgang Amadeus Mozart
Default format pi in English
<FormatNumber locale="en" value={Math.PI} />
Result: 3.142
Show at least 2 decimal places in Portuguese
<FormatNumber locale="pt-BR" value={10000} options={{ minimumFractionDigits: 2 }} />
Result: 10.000,00
This project is distributed under the MIT license.
FAQs
Bringing the i18n functionality of Globalize, backed by CLDR, to React
The npm package react-globalize receives a total of 822 weekly downloads. As such, react-globalize popularity was classified as not popular.
We found that react-globalize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.