Skip to content

Commit

Permalink
[xprototype#4/fix] Use i18n transparently in label of actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wilcorrea committed Mar 29, 2019
1 parent e0c7bff commit d64200f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/app/Prototype/Contracts/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ export default {
return action
})
}

const label = this.$lang([
`domains.${this.domain}.actions.${button.$key}.label`,
`prototype.actions.${button.$key}.label`
])
if (label) {
button.attrs.label = label
}

buttons[button.$key] = button
return buttons
},
Expand Down
6 changes: 6 additions & 0 deletions src/domains/Example/Test/en-us.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ export default {
id: 'Id',
name: 'Name',
age: 'Age',
active: 'Active',
gender: 'Gender',
description: 'Description'
},
gender: {
male: 'Male',
female: 'Female'
},
actions: {
goToTest: 'Go to Test'
},
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/en-us/prototype/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export default {
},
components: {
},
operation: {
operations: {
create: {
success: 'Record created successfully'
},
update: {
success: 'Record updated successfully'
}
},
action: {
actions: {
save: {
label: 'Save',
validation: 'Check the fields'
Expand Down

0 comments on commit d64200f

Please sign in to comment.