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
| "scripts": { | |
| "build:translations": "react-intl-cra './src/**/*.js' -o ./build/messages/messages.json && babel scripts/translate.js | node", | |
| } |
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 { parse } from 'intl-messageformat-parser'; | |
| import * as fs from 'fs'; | |
| import { sync as globSync } from 'glob'; | |
| import { sync as mkdirpSync } from 'mkdirp'; | |
| const MESSAGES_PATTERN = './build/messages/**/*.json'; | |
| const LANG_DIR = './src/translations/temp/'; | |
| const ESCAPED_CHARS = { | |
| '\\' : '\\\\', |
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 { addLocaleData, IntlProvider } from 'react-intl'; | |
| import en from 'react-intl/locale-data/en'; | |
| import hu from 'react-intl/locale-data/hu'; | |
| import messagesHu from './translations/hu.json'; | |
| import messagesEn from './translations/en.json'; | |
| addLocaleData([...en, ...hu]); |
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 { FormattedMessage } from 'react-intl'; | |
| class TestComponent extends React.Component { | |
| render() { | |
| return( | |
| <FormattedMessage | |
| id="app.hello_world" | |
| defaultMessage="Hello World!" | |
| /> |
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 { intlShape, injectIntl, defineMessages } from 'react-intl'; | |
| const translations = defineMessages({ | |
| hello: { | |
| id: 'app.hello_world', | |
| defaultMessage: 'Hello World!', | |
| }, | |
| }); | |
| class TestComponent extends React.Component { |
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 { intlShape, injectIntl, defineMessages } from 'react-intl'; | |
| const translations = defineMessages({ | |
| hello: { | |
| id: 'app.hello_world', | |
| defaultMessage: 'Hello World!', | |
| }, | |
| }); | |
| class TestComponent extends React.Component { |
NewerOlder