mirror of
https://codeberg.org/SafeTwitch/safetwitch.git
synced 2025-01-24 13:18:50 -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 {
|
||||
setup() {
|
||||
return {
|
||||
langs: ['en', 'es'],
|
||||
langs: ['en-US', 'es-ES'],
|
||||
names: ['English', 'Español']
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const langs = ['en', 'es']
|
||||
const savedLocale = localStorage.getItem("language")
|
||||
if (savedLocale != null && langs.includes(savedLocale)) {
|
||||
if (savedLocale != null && this.langs.includes(savedLocale)) {
|
||||
this.$i18n.locale = savedLocale
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onChange() {
|
||||
localStorage.setItem("language", this.$i18n.locale)
|
||||
window.location.reload()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import es from '@/locales/es.json'
|
|||
|
||||
export default createI18n({
|
||||
legacy: false,
|
||||
locale: import.meta.env.VUE_APP_I18N_LOCALE || 'en',
|
||||
fallbackLocale: import.meta.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en',
|
||||
locale: import.meta.env.VUE_APP_I18N_LOCALE || 'en-US',
|
||||
fallbackLocale: import.meta.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en-US',
|
||||
globalInjection: true,
|
||||
messages: {
|
||||
'en': en,
|
||||
'es': es
|
||||
'en-US': en,
|
||||
'es-ES': es
|
||||
}
|
||||
})
|
||||
|
|
|
@ -22,7 +22,7 @@ export async function getEndpoint(endpoint: string) {
|
|||
let data
|
||||
let language = localStorage.getItem("language")
|
||||
if (language === null) {
|
||||
language = "en"
|
||||
language = "en-US"
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -15,11 +15,19 @@ export default {
|
|||
inject: ["rootBackendUrl"],
|
||||
async setup() {
|
||||
const route = useRoute()
|
||||
const username = route.params.username
|
||||
const data = ref<StreamerData>()
|
||||
const status = ref<"ok" | "error">()
|
||||
const rootBackendUrl = inject('rootBackendUrl')
|
||||
const videoOptions = {
|
||||
autoplay: true,
|
||||
controls: true,
|
||||
sources: [
|
||||
{
|
||||
src: `${rootBackendUrl}/proxy/stream/${username}/hls.m3u8`,
|
||||
type: 'application/vnd.apple.mpegurl'
|
||||
}
|
||||
],
|
||||
fluid: true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue