+17
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import { I18n } from '../lib';
|
||||
import Greeter from './greeter';
|
||||
|
||||
const locale = window.locale || 'en';
|
||||
const messages = {
|
||||
"hello_name": "Hello, %{name}.",
|
||||
"num_cars": "%{smart_count} car |||| %{smart_count} cars",
|
||||
}
|
||||
|
||||
render(
|
||||
<I18n locale={locale} messages={messages}>
|
||||
<Greeter name="Batsy" />
|
||||
</I18n>,
|
||||
document.getElementById('app')
|
||||
);
|
||||
+21487
File diff suppressed because it is too large
Load Diff
+8
@@ -0,0 +1,8 @@
|
||||
import React from 'react';
|
||||
import { translate } from '../lib';
|
||||
|
||||
const Greeter = ({ name, t }) => (
|
||||
<h3>{t('hello_name', { name })}</h3>
|
||||
);
|
||||
|
||||
export default translate()(Greeter);
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>react-polygot demo</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="dist.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user