Skip to content

Commit

Permalink
#58 translate "save" and "cancel" (buttons in StoryEditForm.js
Browse files Browse the repository at this point in the history
  • Loading branch information
xeronimus@gmail.com authored and xeronimus@gmail.com committed Jun 23, 2020
1 parent 47c48a8 commit 96ce92f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 3 additions & 1 deletion client/app/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
"restore": "Wiederherstellen",
"trash": "Papierkorb",
"noActiveStories": "Keine Stories im Backlog...",
"trashEmpty": "Papierkorb ist leer..."
"trashEmpty": "Papierkorb ist leer...",
"save": "Speichern",
"cancel": "Abbrechen"
}
4 changes: 3 additions & 1 deletion client/app/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@
"restore": "Restore",
"trash": "Trash",
"noActiveStories": "There are currently no stories in the estimation backlog...",
"trashEmpty": "Trash is empty..."
"trashEmpty": "Trash is empty...",
"save": "Save",
"cancel": "Cancel"
}
15 changes: 9 additions & 6 deletions client/app/components/StoryEditForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {getAllMatchingPendingCommands} from '../services/queryPendingCommands';
/**
* If a story is in "editMode" this form is displayed (in the backlog)
*/
const StoryEditForm = ({story, changeStory, cancelEditStory, pendingChangeCommands}) => {
const StoryEditForm = ({t, story, changeStory, cancelEditStory, pendingChangeCommands}) => {
const classes = classnames('story story-edit-mode', {
waiting: pendingChangeCommands.find((cmd) => cmd.payload.storyId === story.id)
});
Expand Down Expand Up @@ -37,7 +37,7 @@ const StoryEditForm = ({story, changeStory, cancelEditStory, pendingChangeComman
/>
</fieldset>

<StoryEditFormButtonGroup onSave={triggerChange} onCancel={triggerCancel} />
<StoryEditFormButtonGroup t={t} onSave={triggerChange} onCancel={triggerCancel} />
</div>
</div>
);
Expand All @@ -60,6 +60,7 @@ const StoryEditForm = ({story, changeStory, cancelEditStory, pendingChangeComman
};

StoryEditForm.propTypes = {
t: PropTypes.func.isRequired,
story: PropTypes.object,
changeStory: PropTypes.func,
cancelEditStory: PropTypes.func,
Expand All @@ -68,16 +69,17 @@ StoryEditForm.propTypes = {

export default connect(
(state) => ({
t: state.translator,
pendingChangeCommands: getAllMatchingPendingCommands(state, 'changeStory')
}),
{changeStory, cancelEditStory}
)(StoryEditForm);

const StoryEditFormButtonGroup = ({onSave, onCancel}) => (
const StoryEditFormButtonGroup = ({t, onSave, onCancel}) => (
<div className="pure-g button-group">
<div className="pure-u-1-2">
<button type="button" className="pure-button pure-input-1" onClick={onCancel}>
Cancel
{t('cancel')}
<i className="fa fa-times button-icon-right"></i>
</button>
</div>
Expand All @@ -87,14 +89,15 @@ const StoryEditFormButtonGroup = ({onSave, onCancel}) => (
className="pure-button pure-input-1 pure-button-primary"
onClick={onSave}
>
Save
<i className="fa fa-pencil button-icon-right"></i>
{t('save')}
<i className="fa fa-save button-icon-right"></i>
</button>
</div>
</div>
);

StoryEditFormButtonGroup.propTypes = {
t: PropTypes.func.isRequired,
onSave: PropTypes.func,
onCancel: PropTypes.func
};

0 comments on commit 96ce92f

Please sign in to comment.