Skip to content

Instantly share code, notes, and snippets.

@StoneCypher
Created July 29, 2015 19:45
Show Gist options
  • Select an option

  • Save StoneCypher/9f24ce5573f4c437c300 to your computer and use it in GitHub Desktop.

Select an option

Save StoneCypher/9f24ce5573f4c437c300 to your computer and use it in GitHub Desktop.
var i18n = require('your lib of preference');
var stringTable = {
en: { 'hello world': 'Hello, world!', 'cancel': 'cancel' },
de: { 'hello world': 'Guten tag!', 'cancel': 'NEIN NEIN NEIN' }
};
var InitialProps = {
i8 : stringTable,
i18nHandler : i18n.whateverMethod,
lang : 'en'
};
var Top = react.createControl({
render: function() {
return <div>{this.props.i18nHandler(this.props.i8['lang']['hello world'])}</div>;
}
});
React.render(Top, InitialProps);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment