
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@oursky/react-messageformat
Advanced tools
$ npm install --save @oursky/react-messageformat
$ yarn add @oursky/react-messageformat
import * as React from "react";
import * as ReactDOM from "react-dom";
import { LocaleProvider, FormattedMessage } from "@oursky/react-messageformat";
const MESSAGES = {
"my.message": "Hello World",
};
function Page() {
return (
<FormattedMessage id="my.message" />
);
}
function App() {
return (
<LocaleProvider locale="en" messageByID={MESSAGES}>
<Page />
</LocaleProvider>
);
}
ReactDOM.render(<App />, document.getElementById("root"));
{ARG}
{GENDER, select, male{He} female{She} other{They}}
{ORD, selectordinal, one{#st} two{#nd} few{#rd} other{#th}}
{NUM, plural, one{1 apple} other{# apples}}
{a, react, href{http://www.example.com} children{a link}}
string
, number
and React Element.This library is a replacement of react-intl
const React = require("react");
const ReactDOMServer = require("react-dom/server");
const ReactIntl = require("react-intl");
const ReactMessageFormat = require("@oursky/react-messageformat");
const a = ReactDOMServer.renderToString(
React.createElement(
ReactIntl.IntlProvider,
{ locale: "en", textComponent: props => props.children },
React.createElement(ReactIntl.FormattedMessage, {
id: "a",
values: { A: "true" },
defaultMessage: "{A, select, true{} other{}}",
})
)
);
console.log("react-intl", a);
// react-intl will emit a warning complaining that it cannot parse the message.
// And it will render the unparsed message as plain string.
const b = ReactDOMServer.renderToString(
React.createElement(
ReactMessageFormat.LocaleProvider,
{ locale: "en", messageByID: { a: "{A, select, true{} other{}}" } },
React.createElement(ReactMessageFormat.FormattedMessage, {
id: "a",
values: { A: "true" },
})
)
);
console.log("react-messageformat", b);
// b is an empty string.
FAQs
## Installation
The npm package @oursky/react-messageformat receives a total of 198 weekly downloads. As such, @oursky/react-messageformat popularity was classified as not popular.
We found that @oursky/react-messageformat demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.