Skip to content

Commit

Permalink
[xprototype#4/feature] Expose lang in Prototype as $lang
Browse files Browse the repository at this point in the history
  • Loading branch information
wilcorrea committed Mar 28, 2019
1 parent 9ad9bd4 commit 149cd4e
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/app/Prototype/Prototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ export default class Prototype extends Skeleton {
.finally(callback)
}

/**
* @param {String|Array} key
* @param {string} [fallback]
* @returns {String|Object}
*/
$lang (key, fallback = '') {
return lang(key, fallback)
}

/**
* @override
*/
Expand Down Expand Up @@ -203,21 +212,21 @@ export default class Prototype extends Skeleton {
this.action('add')
.actionScopes(['index'])
.actionPositions(['table-top'])
.actionLabel(lang('prototype.action.add.label'))
.actionLabel(this.$lang('prototype.action.add.label'))
.actionIcon('add')
.actionColor('primary')

this.action('back')
.actionScopes(['index', 'create', 'read', 'update'])
.actionPositions(['form-footer'])
.actionLabel(lang('prototype.action.back.label'))
.actionLabel(this.$lang('prototype.action.back.label'))
.actionIcon('reply')

this.action('cancel')
.actionFloatRight()
.actionScopes(['index', 'create', 'read', 'update'])
.actionPositions(['form-footer'])
.actionLabel(lang('prototype.action.cancel.label'))
.actionLabel(this.$lang('prototype.action.cancel.label'))
.actionIcon('close')

this.action('refresh')
Expand All @@ -231,7 +240,7 @@ export default class Prototype extends Skeleton {
.actionScopes(['create', 'update'])
.actionPositions(['form-footer'])
.actionFloatRight()
.actionLabel(lang('prototype.action.save.label'))
.actionLabel(this.$lang('prototype.action.save.label'))
.actionIcon('save')
.actionColor('primary')
.actionOn('click', function () {
Expand All @@ -249,20 +258,20 @@ export default class Prototype extends Skeleton {
this.action('view')
.actionScopes(['index'])
.actionPositions(['table-top', 'table-cell'])
.actionLabel(lang('prototype.action.view.label'))
.actionLabel(this.$lang('prototype.action.view.label'))
.actionIcon('visibility')

this.action('edit')
.actionScopes(['index'])
.actionPositions(['table-top', 'table-cell'])
.actionLabel(lang('prototype.action.edit.label'))
.actionLabel(this.$lang('prototype.action.edit.label'))
.actionColor('primary')
.actionIcon('edit')

this.action('destroy')
.actionScopes(['index'])
.actionPositions(['table-top', 'table-cell'])
.actionLabel(lang('prototype.action.destroy.label'))
.actionLabel(this.$lang('prototype.action.destroy.label'))
.actionColor('negative')
.actionIcon('delete')
}
Expand Down

0 comments on commit 149cd4e

Please sign in to comment.