2018-08-25 10:12:33 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
2022-08-29 21:16:59 +00:00
|
|
|
<FAIcon
|
|
|
|
v-if="globeIcon"
|
|
|
|
icon="globe"
|
|
|
|
/>
|
|
|
|
{{ ' ' }}
|
2018-12-05 08:37:01 +00:00
|
|
|
<label for="interface-language-switcher">
|
2022-05-22 16:40:59 +00:00
|
|
|
{{ promptText }}
|
2018-12-05 08:37:01 +00:00
|
|
|
</label>
|
2022-03-23 14:15:05 +00:00
|
|
|
{{ ' ' }}
|
2021-03-11 14:11:44 +00:00
|
|
|
<Select
|
|
|
|
id="interface-language-switcher"
|
2022-05-22 16:40:59 +00:00
|
|
|
v-model="controlledLanguage"
|
2019-07-05 07:17:44 +00:00
|
|
|
>
|
2021-03-11 14:11:44 +00:00
|
|
|
<option
|
|
|
|
v-for="lang in languages"
|
|
|
|
:key="lang.code"
|
|
|
|
:value="lang.code"
|
2019-07-05 07:17:44 +00:00
|
|
|
>
|
2021-03-11 14:11:44 +00:00
|
|
|
{{ lang.name }}
|
|
|
|
</option>
|
|
|
|
</Select>
|
2018-08-25 10:12:33 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-01-20 20:49:34 +00:00
|
|
|
import localeService from '../../services/locale/locale.service.js'
|
2021-03-11 14:11:44 +00:00
|
|
|
import Select from '../select/select.vue'
|
2018-08-25 10:12:33 +00:00
|
|
|
|
2019-07-05 07:17:44 +00:00
|
|
|
export default {
|
2021-03-11 14:11:44 +00:00
|
|
|
components: {
|
|
|
|
Select
|
|
|
|
},
|
2022-05-22 16:40:59 +00:00
|
|
|
props: {
|
|
|
|
promptText: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
language: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
setLanguage: {
|
|
|
|
type: Function,
|
|
|
|
required: true
|
2022-08-29 21:16:59 +00:00
|
|
|
},
|
|
|
|
globeIcon: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
2022-05-22 16:40:59 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-05 07:17:44 +00:00
|
|
|
computed: {
|
2021-01-20 20:49:34 +00:00
|
|
|
languages () {
|
2022-05-22 16:40:59 +00:00
|
|
|
return localeService.languages
|
2019-07-05 07:17:44 +00:00
|
|
|
},
|
2018-08-25 10:12:33 +00:00
|
|
|
|
2022-05-22 16:40:59 +00:00
|
|
|
controlledLanguage: {
|
|
|
|
get: function () { return this.language },
|
2019-07-05 07:17:44 +00:00
|
|
|
set: function (val) {
|
2022-05-22 16:40:59 +00:00
|
|
|
this.setLanguage(val)
|
2018-08-25 10:12:33 +00:00
|
|
|
}
|
2019-07-05 07:17:44 +00:00
|
|
|
}
|
|
|
|
},
|
2019-05-29 05:31:03 +00:00
|
|
|
|
2019-07-05 07:17:44 +00:00
|
|
|
methods: {
|
|
|
|
getLanguageName (code) {
|
2022-05-22 16:40:59 +00:00
|
|
|
return localeService.getLanguageName(code)
|
2018-08-25 10:12:33 +00:00
|
|
|
}
|
|
|
|
}
|
2019-07-05 07:17:44 +00:00
|
|
|
}
|
2018-08-25 10:12:33 +00:00
|
|
|
</script>
|