Skip to content

Add an i18n functionality to change language using a dropdown in real time. #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Mar 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add locale to Redux
  • Loading branch information
JasonYCHuang committed Feb 8, 2017
commit 1e5df80a58e1c2f93c49f0b5b542264d19a93f83
7 changes: 7 additions & 0 deletions client/app/bundles/comments/actions/commentsActionCreators.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,10 @@ export function submitComment(comment) {
);
};
}

export function setLocale(locale) {
return {
type: actionTypes.SET_LOCALE,
locale,
};
}
2 changes: 2 additions & 0 deletions client/app/bundles/comments/constants/commentsConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ export const MESSAGE_RECEIVED = 'MESSAGE_RECEIVED';

export const SET_IS_FETCHING = 'SET_IS_FETCHING';
export const SET_IS_SAVING = 'SET_IS_SAVING';

export const SET_LOCALE = 'SET_LOCALE';
9 changes: 8 additions & 1 deletion client/app/bundles/comments/reducers/commentsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ export const $$initialState = Immutable.fromJS({
submitCommentError: null,
isFetching: false,
isSaving: false,
locale: null,
});

export default function commentsReducer($$state = $$initialState, action = null) {
const { type, comment, comments, error } = action;
const { type, comment, comments, error, locale } = action;

switch (type) {

Expand Down Expand Up @@ -75,6 +76,12 @@ export default function commentsReducer($$state = $$initialState, action = null)
});
}

case actionTypes.SET_LOCALE: {
return $$state.merge({
locale,
});
}

default: {
return $$state;
}
Expand Down