diff options
author | Maksim Sukharev <antreesy.web@gmail.com> | 2023-06-06 17:37:00 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-06-07 09:58:48 +0000 |
commit | 3c365a7fccfa802df14c44a3c255bcec4818e9fe (patch) | |
tree | 852913d057d242ef451f99c1b800036785daf4d2 /src | |
parent | aa10f9c853812172f9263eb142adf203ba995f91 (diff) |
refactor method of getting the filename, hardcode array of translations
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/MediaSettings/VideoBackgroundEditor.vue | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/components/MediaSettings/VideoBackgroundEditor.vue b/src/components/MediaSettings/VideoBackgroundEditor.vue index 8a4391f97..1c9961a66 100644 --- a/src/components/MediaSettings/VideoBackgroundEditor.vue +++ b/src/components/MediaSettings/VideoBackgroundEditor.vue @@ -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="{ @@ -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 @@ -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] }, }, } |