Verified Commit 1abd6d83 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Enable localisation in sagas

parent 929eca3c
bundle.js bundle.js
app/locales
...@@ -6,5 +6,6 @@ const reacti18next = jest.genMockFromModule('react-i18next'); ...@@ -6,5 +6,6 @@ const reacti18next = jest.genMockFromModule('react-i18next');
const withTranslation = () => Component => props => <Component t={s => s} {...props} />; const withTranslation = () => Component => props => <Component t={s => s} {...props} />;
reacti18next.withTranslation = withTranslation; reacti18next.withTranslation = withTranslation;
reacti18next.initReactI18next = {};
module.exports = reacti18next; module.exports = reacti18next;
module.exports = {
hasNotch: () => false,
getDeviceLocale: () => 'en',
};
...@@ -3,10 +3,24 @@ ...@@ -3,10 +3,24 @@
exports[`translations should expose the translations 1`] = ` exports[`translations should expose the translations 1`] = `
Object { Object {
"nl": Object { "nl": Object {
"components/errorScreen/ErrorScreen": Object { "app": Object {
"Dismiss": "Sluiten",
"Open": "Openen",
},
"sagas/registration": Object {
"Registration successful!": "Registratie succesvol!",
"Successfully cancelled registration": "Afmelding succesvol",
"Successfully updated registration": "Registratie succesvol bijgewerkt",
},
"sagas/session": Object {
"Login failed": "Inloggen mislukt",
"Login successful": "Succesvol ingelogd",
"Logout successful": "Succesvol uitgelogd",
},
"ui/components/errorScreen/ErrorScreen": Object {
"Try again later.": "Probeer het later opnieuw.", "Try again later.": "Probeer het later opnieuw.",
}, },
"components/sidebar/Sidebar": Object { "ui/components/sidebar/Sidebar": Object {
"Are you sure you want to log out?": "Weet je zeker dat je wilt uitloggen?", "Are you sure you want to log out?": "Weet je zeker dat je wilt uitloggen?",
"Calendar": "Agenda", "Calendar": "Agenda",
"Log out?": "Uitloggen?", "Log out?": "Uitloggen?",
...@@ -17,7 +31,7 @@ Object { ...@@ -17,7 +31,7 @@ Object {
"Welcome": "Welkom", "Welcome": "Welkom",
"Yes": "Ja", "Yes": "Ja",
}, },
"components/standardHeader/StandardHeader": Object { "ui/components/standardHeader/StandardHeader": Object {
"Calendar": "Agenda", "Calendar": "Agenda",
"Event": "Evenement", "Event": "Evenement",
"Pizza": "Pizza", "Pizza": "Pizza",
...@@ -27,16 +41,16 @@ Object { ...@@ -27,16 +41,16 @@ Object {
"Settings": "Instellingen", "Settings": "Instellingen",
"Welcome": "Welkom", "Welcome": "Welkom",
}, },
"screens/events/CalendarItem": Object { "ui/screens/events/CalendarItem": Object {
"From": "Tot", "From": "Tot",
"Until": "Van", "Until": "Van",
}, },
"screens/events/CalendarScreen": Object { "ui/screens/events/CalendarScreen": Object {
"No events found!": "Geen evenementen gevonden!", "No events found!": "Geen evenementen gevonden!",
"Sorry, we couldn't load any data.": "Sorry, we konden geen gegevens laden.", "Sorry, we couldn't load any data.": "Sorry, we konden geen gegevens laden.",
"day": "dag", "day": "dag",
}, },
"screens/events/EventAdminScreen": Object { "ui/screens/events/EventAdminScreen": Object {
"CARD": "PIN", "CARD": "PIN",
"CASH": "CONTANT", "CASH": "CONTANT",
"Could not load the event...": "Kon het evenement niet laden...", "Could not load the event...": "Kon het evenement niet laden...",
...@@ -50,7 +64,7 @@ Object { ...@@ -50,7 +64,7 @@ Object {
"Present": "Aanwezig", "Present": "Aanwezig",
"Registrations": "Inschrijvingen", "Registrations": "Inschrijvingen",
}, },
"screens/events/EventScreen": Object { "ui/screens/events/EventScreen": Object {
", that you understand them and that you agree to be bound by them.": "hebt gelezen, dat je ze begrijpt en dat je accepteert eraan gebonden te zijn.", ", that you understand them and that you agree to be bound by them.": "hebt gelezen, dat je ze begrijpt en dat je accepteert eraan gebonden te zijn.",
"Are you sure you want to cancel your registration?": "Weet je je zeker dat je je wilt afmelden?", "Are you sure you want to cancel your registration?": "Weet je je zeker dat je je wilt afmelden?",
"By registering, you confirm that you have read the": "Door te registreren, bevestig je dat je de", "By registering, you confirm that you have read the": "Door te registreren, bevestig je dat je de",
...@@ -86,26 +100,26 @@ Object { ...@@ -86,26 +100,26 @@ Object {
"registrations": "aanmeldingen", "registrations": "aanmeldingen",
"terms and conditions": "voorwaarden", "terms and conditions": "voorwaarden",
}, },
"screens/events/RegistrationScreen": Object { "ui/screens/events/RegistrationScreen": Object {
"Save": "Aanpassen", "Save": "Aanpassen",
"Sorry! We couldn't load any data.": "Sorry! We konden geen gegevens laden.", "Sorry! We couldn't load any data.": "Sorry! We konden geen gegevens laden.",
"This field is required and must be an integer.": "Dit veld is verplicht en moet een getal zijn.", "This field is required and must be an integer.": "Dit veld is verplicht en moet een getal zijn.",
"This field is required.": "Dit veld is verplicht.", "This field is required.": "Dit veld is verplicht.",
}, },
"screens/login/LoginScreen": Object { "ui/screens/login/LoginScreen": Object {
"Become a member": "Lid worden", "Become a member": "Lid worden",
"Forgot password?": "Wachtwoord vergeten?", "Forgot password?": "Wachtwoord vergeten?",
"LOGIN": "INLOGGEN", "LOGIN": "INLOGGEN",
"Password": "Wachtwoord", "Password": "Wachtwoord",
"Username": "Gebruikersnaam", "Username": "Gebruikersnaam",
}, },
"screens/memberList/MemberListScreen": Object { "ui/screens/memberList/MemberListScreen": Object {
"Couldn't find any members...": "Er zijn geen leden gevonden...", "Couldn't find any members...": "Er zijn geen leden gevonden...",
"Find a member": "Zoek een lid", "Find a member": "Zoek een lid",
"Member List": "Ledenlijst", "Member List": "Ledenlijst",
"Sorry! We couldn't load any data.": "Sorry, we konden geen gegevens laden.", "Sorry! We couldn't load any data.": "Sorry, we konden geen gegevens laden.",
}, },
"screens/pizza/PizzaScreen": Object { "ui/screens/pizza/PizzaScreen": Object {
"Changing your order": "Bestelling bewerken", "Changing your order": "Bestelling bewerken",
"Current order": "Huidige bestelling", "Current order": "Huidige bestelling",
"Order pizza for {{title}}": "Bestelling voor {{title}}", "Order pizza for {{title}}": "Bestelling voor {{title}}",
...@@ -115,17 +129,17 @@ Object { ...@@ -115,17 +129,17 @@ Object {
"There is currently no event for which you can order food.": "Er is geen evenement waarvoor je eten kunt bestellen.", "There is currently no event for which you can order food.": "Er is geen evenement waarvoor je eten kunt bestellen.",
"You did not place an order.": "Je hebt nog geen bestelling geplaatst.", "You did not place an order.": "Je hebt nog geen bestelling geplaatst.",
}, },
"screens/profile/AchievementSection": Object { "ui/screens/profile/AchievementSection": Object {
"Achievements for Thalia": "Verdiensten voor Thalia", "Achievements for Thalia": "Verdiensten voor Thalia",
"Chair": "Voorzitter", "Chair": "Voorzitter",
"Societies": "Gezelschappen", "Societies": "Gezelschappen",
"today": "heden", "today": "heden",
}, },
"screens/profile/DescriptionSection": Object { "ui/screens/profile/DescriptionSection": Object {
"About": "Over", "About": "Over",
"This member has not written a description yet.": "Dit lid heeft nog geen beschrijving geschreven.", "This member has not written a description yet.": "Dit lid heeft nog geen beschrijving geschreven.",
}, },
"screens/profile/PersonalInfoSection": Object { "ui/screens/profile/PersonalInfoSection": Object {
"Birthday": "Verjaardag", "Birthday": "Verjaardag",
"Cohort": "Cohort", "Cohort": "Cohort",
"Computing science": "Informatica", "Computing science": "Informatica",
...@@ -134,19 +148,19 @@ Object { ...@@ -134,19 +148,19 @@ Object {
"Study programme": "Studie", "Study programme": "Studie",
"Website": "Website", "Website": "Website",
}, },
"screens/profile/ProfileScreen": Object { "ui/screens/profile/ProfileScreen": Object {
"Sorry! We couldn't load any data.": "Sorry! We konden geen gegevens laden.", "Sorry! We couldn't load any data.": "Sorry! We konden geen gegevens laden.",
}, },
"screens/settings/NotificationsSection": Object { "ui/screens/settings/NotificationsSection": Object {
"(required)": "(verplicht)", "(required)": "(verplicht)",
"Notifications": "Notificaties", "Notifications": "Notificaties",
"Notifications settings could not be loaded.": "De instellingen voor notificaties konden niet worden geladen.", "Notifications settings could not be loaded.": "De instellingen voor notificaties konden niet worden geladen.",
}, },
"screens/welcome/EventDetailCard": Object { "ui/screens/welcome/EventDetailCard": Object {
"MORE INFO": "MEER INFO", "MORE INFO": "MEER INFO",
"PIZZA": "PIZZA", "PIZZA": "PIZZA",
}, },
"screens/welcome/WelcomeScreen": Object { "ui/screens/welcome/WelcomeScreen": Object {
"No events found!": "Geen evenementen gevonden!", "No events found!": "Geen evenementen gevonden!",
"SHOW THE ENTIRE AGENDA": "TOON DE GEHELE AGENDA", "SHOW THE ENTIRE AGENDA": "TOON DE GEHELE AGENDA",
"Sorry! We couldn't load any data.": "Sorry! We konden geen gegevens laden.", "Sorry! We couldn't load any data.": "Sorry! We konden geen gegevens laden.",
......
...@@ -4,10 +4,11 @@ import { expectSaga } from 'redux-saga-test-plan'; ...@@ -4,10 +4,11 @@ import { expectSaga } from 'redux-saga-test-plan';
import Snackbar from 'react-native-snackbar'; import Snackbar from 'react-native-snackbar';
import { select } from 'redux-saga/effects'; import { select } from 'redux-saga/effects';
import * as registrationActions from '../../app/actions/registration'; import * as registrationActions from '../../app/actions/registration';
import registrationSaga, { eventSelector } from '../../app/sagas/registration'; import registrationSaga from '../../app/sagas/registration';
import { apiRequest } from '../../app/utils/url'; import { apiRequest } from '../../app/utils/url';
import * as eventActions from '../../app/actions/event'; import * as eventActions from '../../app/actions/event';
import { tokenSelector } from '../../app/selectors/session'; import { tokenSelector } from '../../app/selectors/session';
import { currentEventSelector } from '../../app/selectors/events';
jest.mock('react-native-snackbar', () => ({ jest.mock('react-native-snackbar', () => ({
LENGTH_LONG: 100, LENGTH_LONG: 100,
...@@ -26,7 +27,7 @@ jest.mock('../../app/utils/url', () => ({ ...@@ -26,7 +27,7 @@ jest.mock('../../app/utils/url', () => ({
describe('event selector', () => { describe('event selector', () => {
it('should select the event pk', () => { it('should select the event pk', () => {
expect(eventSelector({ event: { data: { pk: 2 } } })).toEqual(2); expect(currentEventSelector({ event: { data: { pk: 2 } } })).toEqual(2);
}); });
}); });
...@@ -160,7 +161,7 @@ describe('registration saga', () => { ...@@ -160,7 +161,7 @@ describe('registration saga', () => {
it('should put a fetching action', () => expectSaga(registrationSaga) it('should put a fetching action', () => expectSaga(registrationSaga)
.provide([ .provide([
[select(tokenSelector), 'token'], [select(tokenSelector), 'token'],
[select(eventSelector), 1], [select(currentEventSelector), 1],
[matchers.call.like({ fn: apiRequest, args: ['registrations/1'] })], [matchers.call.like({ fn: apiRequest, args: ['registrations/1'] })],
]) ])
.dispatch(registrationActions.cancel(1)) .dispatch(registrationActions.cancel(1))
...@@ -170,7 +171,7 @@ describe('registration saga', () => { ...@@ -170,7 +171,7 @@ describe('registration saga', () => {
it('should show a snackbar on success', () => expectSaga(registrationSaga) it('should show a snackbar on success', () => expectSaga(registrationSaga)
.provide([ .provide([
[select(tokenSelector), 'token'], [select(tokenSelector), 'token'],
[select(eventSelector), 1], [select(currentEventSelector), 1],
[matchers.call.like({ fn: apiRequest, args: ['registrations/1'] })], [matchers.call.like({ fn: apiRequest, args: ['registrations/1'] })],
]) ])
.dispatch(registrationActions.cancel(1)) .dispatch(registrationActions.cancel(1))
...@@ -184,7 +185,7 @@ describe('registration saga', () => { ...@@ -184,7 +185,7 @@ describe('registration saga', () => {
it('should put event action when the request succeeds', () => expectSaga(registrationSaga) it('should put event action when the request succeeds', () => expectSaga(registrationSaga)
.provide([ .provide([
[select(tokenSelector), 'token'], [select(tokenSelector), 'token'],
[select(eventSelector), 1], [select(currentEventSelector), 1],
[matchers.call.fn(apiRequest), {}], [matchers.call.fn(apiRequest), {}],
]) ])
.dispatch(registrationActions.cancel(1)) .dispatch(registrationActions.cancel(1))
...@@ -194,7 +195,7 @@ describe('registration saga', () => { ...@@ -194,7 +195,7 @@ describe('registration saga', () => {
it('should put event action when the request fails', () => expectSaga(registrationSaga) it('should put event action when the request fails', () => expectSaga(registrationSaga)
.provide([ .provide([
[select(tokenSelector), 'token'], [select(tokenSelector), 'token'],
[select(eventSelector), 1], [select(currentEventSelector), 1],
[matchers.call.fn(apiRequest), throwError(error)], [matchers.call.fn(apiRequest), throwError(error)],
]) ])
.dispatch(registrationActions.cancel(1)) .dispatch(registrationActions.cancel(1))
...@@ -203,7 +204,7 @@ describe('registration saga', () => { ...@@ -203,7 +204,7 @@ describe('registration saga', () => {
it('should not show snackbar when the request fails', () => expectSaga(registrationSaga) it('should not show snackbar when the request fails', () => expectSaga(registrationSaga)
.provide([ .provide([
[select(tokenSelector), 'token'], [select(tokenSelector), 'token'],
[select(eventSelector), 1], [select(currentEventSelector), 1],
[matchers.call.fn(apiRequest), throwError(error)], [matchers.call.fn(apiRequest), throwError(error)],
]) ])
.dispatch(registrationActions.cancel(1)) .dispatch(registrationActions.cancel(1))
...@@ -215,7 +216,7 @@ describe('registration saga', () => { ...@@ -215,7 +216,7 @@ describe('registration saga', () => {
it('should do a DELETE request', () => expectSaga(registrationSaga) it('should do a DELETE request', () => expectSaga(registrationSaga)
.provide([ .provide([
[select(tokenSelector), 'token'], [select(tokenSelector), 'token'],
[select(eventSelector), 1], [select(currentEventSelector), 1],
]) ])
.dispatch(registrationActions.cancel(2)) .dispatch(registrationActions.cancel(2))
.silentRun() .silentRun()
...@@ -270,7 +271,7 @@ describe('registration saga', () => { ...@@ -270,7 +271,7 @@ describe('registration saga', () => {
it('should put event failure action when the request fails', () => expectSaga(registrationSaga) it('should put event failure action when the request fails', () => expectSaga(registrationSaga)
.provide([ .provide([
[select(tokenSelector), 'token'], [select(tokenSelector), 'token'],
[select(eventSelector), 1], [select(currentEventSelector), 1],
[matchers.call.fn(apiRequest), throwError(error)], [matchers.call.fn(apiRequest), throwError(error)],
]) ])
.dispatch(eventActions.failure()) .dispatch(eventActions.failure())
......
...@@ -7,8 +7,3 @@ NativeModules.RNFirebase = { ...@@ -7,8 +7,3 @@ NativeModules.RNFirebase = {
NativeModules.RNShare = { NativeModules.RNShare = {
}; };
jest.mock('react-native-device-info', () => ({
hasNotch: () => false,
getDeviceLocale: () => 'en',
}));
This source diff could not be displayed because it is too large. You can view the blob instead.
import i18n from '../../app/utils/i18n'; import i18n from '../../app/utils/i18n';
jest.mock('react-i18next', () => ({
initReactI18next: {},
}));
describe('i18n helper', () => { describe('i18n helper', () => {
it('should export the correct i18n helper', () => { it('should export the correct i18n helper', () => {
expect(i18n).toMatchSnapshot(); expect(i18n).toMatchSnapshot();
......
...@@ -124,4 +124,4 @@ Main.propTypes = { ...@@ -124,4 +124,4 @@ Main.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
}; };
export default withTranslation('app/App')(Main); export default withTranslation('app')(Main);
...@@ -17,26 +17,32 @@ files['app/ui/screens/login/LoginScreenNL'] = require('./nl/app/ui/screens/login ...@@ -17,26 +17,32 @@ files['app/ui/screens/login/LoginScreenNL'] = require('./nl/app/ui/screens/login
files['app/ui/components/sidebar/SidebarNL'] = require('./nl/app/ui/components/sidebar/Sidebar.json'); files['app/ui/components/sidebar/SidebarNL'] = require('./nl/app/ui/components/sidebar/Sidebar.json');
files['app/ui/components/standardHeader/StandardHeaderNL'] = require('./nl/app/ui/components/standardHeader/StandardHeader.json'); files['app/ui/components/standardHeader/StandardHeaderNL'] = require('./nl/app/ui/components/standardHeader/StandardHeader.json');
files['app/ui/components/errorScreen/ErrorScreenNL'] = require('./nl/app/ui/components/errorScreen/ErrorScreen.json'); files['app/ui/components/errorScreen/ErrorScreenNL'] = require('./nl/app/ui/components/errorScreen/ErrorScreen.json');
files['app/sagas/sessionNL'] = require('./nl/app/sagas/session.json');
files['app/sagas/registrationNL'] = require('./nl/app/sagas/registration.json');
files['app/appNL'] = require('./nl/app/app.json');
export default { export default {
nl: { nl: {
'screens/settings/NotificationsSection': files['app/ui/screens/settings/NotificationsSectionNL'], 'ui/screens/settings/NotificationsSection': files['app/ui/screens/settings/NotificationsSectionNL'],
'screens/welcome/EventDetailCard': files['app/ui/screens/welcome/EventDetailCardNL'], 'ui/screens/welcome/EventDetailCard': files['app/ui/screens/welcome/EventDetailCardNL'],
'screens/welcome/WelcomeScreen': files['app/ui/screens/welcome/WelcomeScreenNL'], 'ui/screens/welcome/WelcomeScreen': files['app/ui/screens/welcome/WelcomeScreenNL'],
'screens/memberList/MemberListScreen': files['app/ui/screens/memberList/MemberListScreenNL'], 'ui/screens/memberList/MemberListScreen': files['app/ui/screens/memberList/MemberListScreenNL'],
'screens/profile/ProfileScreen': files['app/ui/screens/profile/ProfileScreenNL'], 'ui/screens/profile/ProfileScreen': files['app/ui/screens/profile/ProfileScreenNL'],
'screens/profile/AchievementSection': files['app/ui/screens/profile/AchievementSectionNL'], 'ui/screens/profile/AchievementSection': files['app/ui/screens/profile/AchievementSectionNL'],
'screens/profile/DescriptionSection': files['app/ui/screens/profile/DescriptionSectionNL'], 'ui/screens/profile/DescriptionSection': files['app/ui/screens/profile/DescriptionSectionNL'],
'screens/profile/PersonalInfoSection': files['app/ui/screens/profile/PersonalInfoSectionNL'], 'ui/screens/profile/PersonalInfoSection': files['app/ui/screens/profile/PersonalInfoSectionNL'],
'screens/events/CalendarItem': files['app/ui/screens/events/CalendarItemNL'], 'ui/screens/events/CalendarItem': files['app/ui/screens/events/CalendarItemNL'],
'screens/events/RegistrationScreen': files['app/ui/screens/events/RegistrationScreenNL'], 'ui/screens/events/RegistrationScreen': files['app/ui/screens/events/RegistrationScreenNL'],
'screens/events/EventAdminScreen': files['app/ui/screens/events/EventAdminScreenNL'], 'ui/screens/events/EventAdminScreen': files['app/ui/screens/events/EventAdminScreenNL'],
'screens/events/CalendarScreen': files['app/ui/screens/events/CalendarScreenNL'], 'ui/screens/events/CalendarScreen': files['app/ui/screens/events/CalendarScreenNL'],
'screens/events/EventScreen': files['app/ui/screens/events/EventScreenNL'], 'ui/screens/events/EventScreen': files['app/ui/screens/events/EventScreenNL'],
'screens/pizza/PizzaScreen': files['app/ui/screens/pizza/PizzaScreenNL'], 'ui/screens/pizza/PizzaScreen': files['app/ui/screens/pizza/PizzaScreenNL'],
'screens/login/LoginScreen': files['app/ui/screens/login/LoginScreenNL'], 'ui/screens/login/LoginScreen': files['app/ui/screens/login/LoginScreenNL'],
'components/sidebar/Sidebar': files['app/ui/components/sidebar/SidebarNL'], 'ui/components/sidebar/Sidebar': files['app/ui/components/sidebar/SidebarNL'],
'components/standardHeader/StandardHeader': files['app/ui/components/standardHeader/StandardHeaderNL'], 'ui/components/standardHeader/StandardHeader': files['app/ui/components/standardHeader/StandardHeaderNL'],
'components/errorScreen/ErrorScreen': files['app/ui/components/errorScreen/ErrorScreenNL'], 'ui/components/errorScreen/ErrorScreen': files['app/ui/components/errorScreen/ErrorScreenNL'],
'sagas/session': files['app/sagas/sessionNL'],
'sagas/registration': files['app/sagas/registrationNL'],
app: files['app/appNL'],
}, },
}; };
{ {
"Dismiss": "Sluiten", "Dismiss": "Sluiten",
"Open": "Openen" "Open": "Openen"
} }
\ No newline at end of file
{
"Registration successful!": "Registratie succesvol!",
"Successfully updated registration": "Registratie succesvol bijgewerkt",
"Successfully cancelled registration": "Afmelding succesvol"
}
{
"Login failed": "Inloggen mislukt",
"Logout successful": "Succesvol uitgelogd",
"Login successful": "Succesvol ingelogd"
}
...@@ -4,16 +4,16 @@ import { ...@@ -4,16 +4,16 @@ import {
} from 'redux-saga/effects'; } from 'redux-saga/effects';
import Snackbar from 'react-native-snackbar'; import Snackbar from 'react-native-snackbar';
import { Sentry } from 'react-native-sentry'; import { Sentry } from 'react-native-sentry';
import i18next from '../utils/i18n';
import { apiRequest } from '../utils/url'; import { apiRequest } from '../utils/url';
import * as eventActions from '../actions/event'; import * as eventActions from '../actions/event';
import * as registrationActions from '../actions/registration'; import * as registrationActions from '../actions/registration';
import { tokenSelector } from '../selectors/session'; import { tokenSelector } from '../selectors/session';
import { currentEventSelector } from '../selectors/events';
const t = i18next.getFixedT(undefined, 'sagas/registration');
export const eventSelector = state => state.event.data.pk;
const register = function* register(action) { const register = function* register(action) {
const { event } = action.payload; const { event } = action.payload;
...@@ -37,7 +37,7 @@ const register = function* register(action) { ...@@ -37,7 +37,7 @@ const register = function* register(action) {
if (registration.fields) { if (registration.fields) {
yield put(registrationActions.retrieveFields(registration.pk)); yield put(registrationActions.retrieveFields(registration.pk));
} }
Snackbar.show({ title: 'Registration successful!' }); Snackbar.show({ title: t('Registration successful!') });
} catch (error) { } catch (error) {
Sentry.captureException(error); Sentry.captureException(error);
yield put(eventActions.failure()); yield put(eventActions.failure());
...@@ -70,7 +70,7 @@ const update = function* update(action) { ...@@ -70,7 +70,7 @@ const update = function* update(action) {
yield call(apiRequest, `registrations/${registration}`, data); yield call(apiRequest, `registrations/${registration}`, data);
yield put(registrationActions.success()); yield put(registrationActions.success());
yield delay(50); yield delay(50);
Snackbar.show({ title: 'Successfully updated registration' }); Snackbar.show({ title: t('Successfully updated registration') });
} catch (error) { } catch (error) {
Sentry.captureException(error); Sentry.captureException(error);
yield put(registrationActions.failure()); yield put(registrationActions.failure());
...@@ -80,7 +80,7 @@ const update = function* update(action) { ...@@ -80,7 +80,7 @@ const update = function* update(action) {
const cancel = function* cancel(action) { const cancel = function* cancel(action) {
const { registration } = action.payload; const { registration } = action.payload;
const token = yield select(tokenSelector); const token = yield select(tokenSelector);
const event = yield select(eventSelector); const event = yield select(currentEventSelector);
yield put(eventActions.fetching()); yield put(eventActions.fetching());
...@@ -95,7 +95,7 @@ const cancel = function* cancel(action) { ...@@ -95,7 +95,7 @@ const cancel = function* cancel(action) {
try { try {
yield call(apiRequest, `registrations/${registration}`, data); yield call(apiRequest, `registrations/${registration}`, data);
Snackbar.show({ title: 'Successfully cancelled registration' }); Snackbar.show({ title: t('Successfully cancelled registration') });
} catch (error) { } catch (error) {
Sentry.captureException(error); Sentry.captureException(error);
} }
......
...@@ -5,6 +5,7 @@ import { delay } from 'redux-saga'; ...@@ -5,6 +5,7 @@ import { delay } from 'redux-saga';
import { AsyncStorage } from 'react-native'; import { AsyncStorage } from 'react-native';
import Snackbar from 'react-native-snackbar'; import Snackbar from 'react-native-snackbar';
import { Sentry } from 'react-native-sentry'; import { Sentry } from 'react-native-sentry';
import i18next from '../utils/i18n';
import { apiRequest } from '../utils/url'; import { apiRequest } from '../utils/url';
import * as sessionActions from '../actions/session'; import * as sessionActions from '../actions/session';
...@@ -23,6 +24,8 @@ const pairsToObject = (obj, pair) => { ...@@ -23,6 +24,8 @@ const pairsToObject = (obj, pair) => {
return obj2; return obj2;
}; };
const t = i18next.getFixedT(undefined, 'sagas/session');
function* init() { function* init() {
try { try {
const result = yield call([AsyncStorage, 'multiGet'], [ const result = yield call([AsyncStorage, 'multiGet'], [
...@@ -77,7 +80,7 @@ function* signIn(action) { ...@@ -77,7 +80,7 @@ function* signIn(action) {
yield put(sessionActions.signedIn(user, token)); yield put(sessionActions.signedIn(user, token));
yield put(sessionActions.fetchUserInfo()); yield put(sessionActions.fetchUserInfo());
yield put(pushNotificationsActions.register()); yield put(pushNotificationsActions.register());
Snackbar.show({ title: 'Login successful' }); Snackbar.show({ title: t('Login successful') });
} catch (e) { } catch (e) {
// Delay failure to make sure animation is finished // Delay failure to make sure animation is finished
const now = Date.now(); const now = Date.now();
...@@ -87,7 +90,7 @@ function* signIn(action) { ...@@ -87,7 +90,7 @@ function* signIn(action) {
yield put(sessionActions.tokenInvalid());