0
Fork 0
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:
dragongoose 2023-07-03 19:06:28 -04:00
parent 5b046024b6
commit 877a567a15
No known key found for this signature in database
GPG key ID: 50DB99B921579009
4 changed files with 16 additions and 8 deletions

View file

@ -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()
}
}
}

View file

@ -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
}
})

View file

@ -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 {

View file

@ -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
}