mirror of
https://codeberg.org/SafeTwitch/safetwitch.git
synced 2025-01-25 21:58:44 -05:00
Complete translation support
This commit is contained in:
parent
5b046024b6
commit
877a567a15
4 changed files with 16 additions and 8 deletions
|
@ -12,20 +12,20 @@
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
langs: ['en', 'es'],
|
langs: ['en-US', 'es-ES'],
|
||||||
names: ['English', 'Español']
|
names: ['English', 'Español']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
const langs = ['en', 'es']
|
|
||||||
const savedLocale = localStorage.getItem("language")
|
const savedLocale = localStorage.getItem("language")
|
||||||
if (savedLocale != null && langs.includes(savedLocale)) {
|
if (savedLocale != null && this.langs.includes(savedLocale)) {
|
||||||
this.$i18n.locale = savedLocale
|
this.$i18n.locale = savedLocale
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onChange() {
|
onChange() {
|
||||||
localStorage.setItem("language", this.$i18n.locale)
|
localStorage.setItem("language", this.$i18n.locale)
|
||||||
|
window.location.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@ import es from '@/locales/es.json'
|
||||||
|
|
||||||
export default createI18n({
|
export default createI18n({
|
||||||
legacy: false,
|
legacy: false,
|
||||||
locale: import.meta.env.VUE_APP_I18N_LOCALE || 'en',
|
locale: import.meta.env.VUE_APP_I18N_LOCALE || 'en-US',
|
||||||
fallbackLocale: import.meta.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en',
|
fallbackLocale: import.meta.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en-US',
|
||||||
globalInjection: true,
|
globalInjection: true,
|
||||||
messages: {
|
messages: {
|
||||||
'en': en,
|
'en-US': en,
|
||||||
'es': es
|
'es-ES': es
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -22,7 +22,7 @@ export async function getEndpoint(endpoint: string) {
|
||||||
let data
|
let data
|
||||||
let language = localStorage.getItem("language")
|
let language = localStorage.getItem("language")
|
||||||
if (language === null) {
|
if (language === null) {
|
||||||
language = "en"
|
language = "en-US"
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -15,11 +15,19 @@ export default {
|
||||||
inject: ["rootBackendUrl"],
|
inject: ["rootBackendUrl"],
|
||||||
async setup() {
|
async setup() {
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const username = route.params.username
|
||||||
const data = ref<StreamerData>()
|
const data = ref<StreamerData>()
|
||||||
const status = ref<"ok" | "error">()
|
const status = ref<"ok" | "error">()
|
||||||
|
const rootBackendUrl = inject('rootBackendUrl')
|
||||||
const videoOptions = {
|
const videoOptions = {
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
controls: true,
|
controls: true,
|
||||||
|
sources: [
|
||||||
|
{
|
||||||
|
src: `${rootBackendUrl}/proxy/stream/${username}/hls.m3u8`,
|
||||||
|
type: 'application/vnd.apple.mpegurl'
|
||||||
|
}
|
||||||
|
],
|
||||||
fluid: true
|
fluid: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue