Skip to content
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

PB-1327: Refactored 'DropdownItem' to translate the button title internally #1191

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions src/modules/menu/components/help/ReportProblemButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ const store = useStore()
const feedbackCategories = [
new DropdownItem(
'feedback_category_background_map',
i18n.t('feedback_category_background_map'),
'feedback_category_background_map',
'feedback_category_background_map'
),
new DropdownItem(
'feedback_category_thematic_map',
i18n.t('feedback_category_thematic_map'),
'feedback_category_thematic_map',
'feedback_category_thematic_map'
),
new DropdownItem(
'feedback_category_application_service',
i18n.t('feedback_category_application_service'),
'feedback_category_application_service',
'feedback_category_application_service'
),
new DropdownItem(
'feedback_category_other',
i18n.t('feedback_category_other'),
'feedback_category_other',
'feedback_category_other'
),
]
Expand Down
7 changes: 6 additions & 1 deletion src/utils/components/DropdownButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

<script>
import { Dropdown } from 'bootstrap'
import { useI18n } from 'vue-i18n'

import { useTippyTooltip } from '@/utils/composables/useTippyTooltip'
import { randomIntBetween } from '@/utils/numberUtils'
Expand All @@ -62,12 +63,16 @@ export class DropdownItem {
this._description = description
}

_translate(title) {
return useI18n().t(title)
}

get id() {
return this._id
}

get title() {
return this._title
return this._translate(this._title)
}
get value() {
return this._value
Expand Down
Loading