actions.js 478 B

1234567891011121314151617
  1. exports.getLanguage = function getLanguage() {
  2. return function(dispatch) {
  3. dispatch({ type: '[CLIENT]:GET_LANGUAGE:START' });
  4. try {
  5. const lang = ipc.sendSync('backendAction_getLanguage');
  6. i18n.changeLanguage(lang);
  7. TAPi18n.setLanguage(lang);
  8. dispatch({
  9. type: '[CLIENT]:GET_LANGUAGE:SUCCESS',
  10. payload: { i18n: lang }
  11. });
  12. } catch (error) {
  13. dispatch({ type: '[CLIENT]:GET_LANGUAGE:FAILURE', error });
  14. }
  15. };
  16. };