Skip to content

Commit

Permalink
Merge pull request #9714 from nextcloud/backport/9710/stable27
Browse files Browse the repository at this point in the history
[stable27] Fully translate aria-labels for predefined backgrounds
  • Loading branch information
Antreesy authored Jun 7, 2023
2 parents aa10f9c + 3c365a7 commit 12359f4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/components/MediaSettings/VideoBackgroundEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<button v-for="path in predefinedBackgroundsURLs"
:key="path"
:aria-label="ariaLabelForPredefinedBackground(path)"
:title="ariaLabelForPredefinedBackground(path)"
class="background-editor__element"
:class="{'background-editor__element--selected': selectedBackground === path}"
:style="{
Expand Down Expand Up @@ -96,6 +97,16 @@ import { findUniquePath } from '../../utils/fileUpload.js'

const canUploadBackgrounds = getCapabilities()?.spreed?.config?.call?.['can-upload-background']
const predefinedBackgrounds = getCapabilities()?.spreed?.config?.call?.['predefined-backgrounds']
const predefinedBackgroundLabels = {
'1_office': t('spreed', 'Select virtual office background'),
'2_home': t('spreed', 'Select virtual home background'),
'3_abstract': t('spreed', 'Select virtual abstract background'),
'4_beach': t('spreed', 'Select virtual beach background'),
'5_park': t('spreed', 'Select virtual park background'),
'6_theater': t('spreed', 'Select virtual theater background'),
'7_library': t('spreed', 'Select virtual library background'),
'8_space_station': t('spreed', 'Select virtual space station background'),
}

let picker

Expand Down Expand Up @@ -263,12 +274,9 @@ export default {
},

ariaLabelForPredefinedBackground(path) {
const removeFolders = (name) => name.includes('/') ? name.slice(name.lastIndexOf('/') + 1) : name
const removePositionNumber = (name) => name.includes('_') ? name.slice(name.indexOf('_') + 1) : name
const removeFileType = (name) => name.includes('.') ? name.slice(0, name.lastIndexOf('.')) : name
return t('spreed', 'Select virtual {atmosphere} background', {
atmosphere: removeFileType(removePositionNumber(removeFolders(path))).replaceAll('_', ' '),
})
const fileName = path.split('/').pop().split('.').shift()

return predefinedBackgroundLabels[fileName]
},
},
}
Expand Down

0 comments on commit 12359f4

Please sign in to comment.