This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { messages } from "./messages"; | |
import { injectIntl } from "react-intl"; | |
class InjectedGreeter extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {}; | |
} | |
render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { DummySubComponent } from "./DummySubComponent"; | |
import { FormattedMessage } from "react-intl"; | |
import { messages } from "./messages"; | |
const DummyComponent = () => ( | |
<div> | |
<FormattedMessage {...messages.title}> | |
{title => ( | |
<FormattedMessage {...messages.subTitle}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"greeter.simpleExample": "Hi, {name}", | |
"greeter.complexExample": "Hello, {name}! {status, select, busy {you have {taskCount, plural,=0 {no tasks} one {# task} other {# tasks}}.} idle {You are free today!}}", | |
"greeter.lastUpdated": "Last updated:", | |
"greeter.simpleInjectedExample": "Text only!", | |
"dummyComponent.title": "English Title", | |
"dummyComponent.subTitle": "English subtitle", | |
"dummyComponent.text": "English text" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineMessages } from "react-intl"; | |
export const messages = defineMessages({ | |
simpleExample: { | |
id: "greeter.simpleExample", | |
description: "Hello", | |
defaultMessage: "Hello, {name}!" | |
}, | |
simpleInjectedExample: { | |
id: "greeter.simpleInjectedExample", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { messages } from "./messages"; | |
import { FormattedMessage, FormattedRelative } from "react-intl"; | |
const Greeter = ({ name }) => { | |
const message1 = { name: name }; | |
const message2 = { name: "Developer A", status: "busy", taskCount: 5 }; | |
const message3 = { name: "Developer B", status: "busy", taskCount: 1 }; | |
const message4 = { name: "Developer C", status: "busy", taskCount: 0 }; | |
const message5 = { name: "Developer E", status: "idle" }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PureComponent } from "react"; | |
import { IntlProvider, addLocaleData } from "react-intl"; | |
import trLocaleData from "react-intl/locale-data/tr"; | |
const trTranslationMessages = require("../translations/tr.json"); | |
const enTranslationMessages = require("../translations/en.json"); | |
addLocaleData(trLocaleData); | |
const messages = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import "./index.css"; | |
import App from "./App"; | |
import IntlProviderComponent from "./IntlProviderComponent"; | |
ReactDOM.render( | |
<IntlProviderComponent> | |
<App /> | |
</IntlProviderComponent>, |