title: How to translate (i18n) error messages in actions with React, React Intl and Redux?
body: <p>I've a <code>performLogin</code> action, which triggers an API and tries to authenticate a user with the provided credentials. This API call can lead to errors. Her is my action:</p>
  
  <pre><code>export const performLogin = (email: string, password: string) =&gt; {
      return (dispatch) =&gt; {
          UsersAPI.login(email, password).then(response =&gt; {
              // [..]
          }).catch(error =&gt; {
              const definedError: Error = defaultError;
              switch (error.response.status) {
                  case 401:
                      definedError.message = 'Invalid email or password';
                      break;
                  default:
                      definedError.message = error.message;
              }
              dispatch(displayError(definedError));
          });
      };
  };
  </code></pre>
  
  <p>My question is, how can I internationalize <code>Invalid email or password</code>? </p>
  
  <p>I'm using <a href="https://github.com/yahoo/react-intl" rel="nofollow noreferrer">React Intl</a> so I have the infrastructure for i18n in the components. My idea is to define a error type, set it in the action and let the login component or a global error component decide, which error should be shown.</p>
  
  <p>What is the React-Redux way to do this?</p>