Skip to content

Commit

Permalink
PB-1327: Refactored 'DropdownItem' to translate the button title inte…
Browse files Browse the repository at this point in the history
…rnally.

This involves translating the title in the getter, such that when called, it is
up-to-date with the current language context in web-mapviewer.
  • Loading branch information
Sami Nouidri committed Jan 9, 2025
1 parent 0a3b72e commit 9b9729e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit 9b9729e

Please sign in to comment.