Janik von Rotz

2 min read

Make your Redux React app multilingual

For my current React app in development I’m using Redux to manage the client state. As this is the first time using Redux I’m not quite sure what to put in the store yet. But I’ve decided to give the multilingual labels and wordings a try. Below you’ll find a simple approach on how I made my app multilingual using the Redux client state to store the translated content. I assume you are familiar with Redux and React.

The i18n state reducer contains all translation and puts the default language content into the store.


let phrases = {
  de: {
    button: {
      remove: 'Löschen',
      update: 'Speichern',
      commit: 'Neue Version',
      add_router: 'Router hinzufügen',
      search: 'Suche',
      cancel: 'Abrechen',
  en: {
    button: {
      remove: 'Delete',
      update: 'Save',
      commit: 'Commit',
      add_router: 'Add Router'

export default (state = phrases.de, action) => {
  switch (action.type) {
      return phrases[action.language]
      return state

To get f.g. the translated button labels simply map the i18n state as prop on the component.


import React from 'react'
import { connect } from 'react-redux'

class RouterSearch extends React.Component {


  render() {
    let { i18n } = this.props

    return <Card>

        floatingLabelText={ i18n.button.search }



const mapStateToProps = (state) => {
  return {
    i18n: state.i18n,
export default connect(mapStateToProps)(RouterSearch)

Switching the language is easily done by setting the language state.


export const switchLanguage = (language) => {
  return {
    type: 'SWITCH_LANGUAGE',

Obviously the are a lot cons to this method. First, there is no fallback for not translated content as you access to i18n state directly. Second, putting multilingual content into the store is probably not a good idea in the first place. What do you think? Are there better options?

Categories: JavaScript development
Tags: internationalization , multilanguage , react , redux
Improve this page
Show statistic for this page