How to use the react-jhipster.TranslatorContext.setLocale function in react-jhipster

To help you get started, we’ve selected a few react-jhipster examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dongyanghe / eikesi / x-im-web / src / main / webapp / app / shared / reducers / locale.ts View on Github external
export default (state: LocaleState = initialState, action): LocaleState => {
  switch (action.type) {
    case ACTION_TYPES.SET_LOCALE:
      const currentLocale = action.locale;
      if (state.currentLocale !== currentLocale) {
        Storage.session.set('locale', currentLocale);
        TranslatorContext.setLocale(currentLocale);
      }
      return {
        currentLocale
      };
    default:
      return state;
  }
};
github jhipster / jhipster-sample-app-react / src / main / webapp / app / shared / reducers / locale.ts View on Github external
export default (state: LocaleState = initialState, action): LocaleState => {
  switch (action.type) {
    case ACTION_TYPES.SET_LOCALE: {
      const currentLocale = action.locale;
      if (state.currentLocale !== currentLocale) {
        TranslatorContext.setLocale(currentLocale);
      }
      return {
        currentLocale
      };
    }
    default:
      return state;
  }
};