Skip to content

Instantly share code, notes, and snippets.

@ryandrewjohnson
Last active July 1, 2018 00:50
Show Gist options
  • Select an option

  • Save ryandrewjohnson/2e222d5a12a4598b827a8ffeef968174 to your computer and use it in GitHub Desktop.

Select an option

Save ryandrewjohnson/2e222d5a12a4598b827a8ffeef968174 to your computer and use it in GitHub Desktop.
react-localize-redux - setLanguages.js
import React from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { withLocalize } from "react-localize-redux";
import globalTranslations from "./translations/global.json";
class Main extends React.Component {
constructor(props) {
super(props);
this.props.initialize({
languages: [
{ name: "English", code: "en" },
{ name: "French", code: "fr" }
],
translation: globalTranslations,
options: { renderToStaticMarkup }
});
}
render() {
// render Main layout component
}
}
export default withLocalize(Main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment