Skip to content

Commit

Permalink
Revert: Skip language change & font loading
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed Sep 23, 2023
1 parent 0304ddc commit e41ae70
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 23 deletions.
7 changes: 5 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
</template>

<script setup>
const lang = this.$root.$i18n.locale
import { useHead } from '@vueuse/head';
import { detectLanguage } from '@/support'
const lang = detectLanguage()
useHead({
htmlAttrs: {
Expand All @@ -19,7 +22,7 @@ useHead({
@font-face {
font-family: WorkSans;
src: url('/fonts/WorkSans-Regular.woff2') format('woff2');
// src: url('/fonts/WorkSans-Regular.woff2') format('woff2');
}
html, body, #app {
Expand Down
5 changes: 4 additions & 1 deletion src/components/InfoScreen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<script>
import Navigation from '@/components/Navigation.vue'
import i18nStrings from '@/i18nStrings'
import { detectLanguage } from '@/support'
const lang = detectLanguage()
export default {
components: {
Expand All @@ -38,7 +41,7 @@ export default {
},
computed: {
infoPage() {
return i18nStrings[this.$root.$i18n.locale].infoPages.filter((ip) => ip.id === this.page)[0] || {}
return i18nStrings[lang].infoPages.filter((ip) => ip.id === this.page)[0] || {}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/components/LanguageSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
class="language-switcher"
@click="switchLanguage"
>
<span :aria-label="$t('switchLanguageAlt')">{{ $root.$i18n.locale }}</span>
<!-- <span :aria-label="$t('switchLanguageAlt')">{{ $root.$i18n.locale }}</span> -->
</button>
</template>

<script>
// Introduce vueuse
export default {
methods: {
switchLanguage() {
this.$root.$i18n.locale = this.$root.$i18n.locale === 'de' ? 'en' : 'de'
// this.$root.$i18n.locale = this.$root.$i18n.locale === 'de' ? 'en' : 'de'
},
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/components/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

<script>
import i18nStrings from '@/i18nStrings'
import { detectLanguage } from '@/support'
const lang = detectLanguage()
export default {
props: {
Expand All @@ -35,7 +38,7 @@ export default {
},
computed: {
infoPages() {
return i18nStrings[this.$root.$i18n.locale].infoPages.filter((ip) => ip.linked !== false)
return i18nStrings[lang].infoPages.filter((ip) => ip.linked !== false)
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/components/Party.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
@click="switchLanguage"
v-if="controlsActive"
>
<span :aria-label="$t('switchLanguageAlt')">{{ $root.$i18n.locale }}</span>
<!-- <span :aria-label="$t('switchLanguageAlt')">{{ $root.$i18n.locale }}</span> -->
</button>
</transition>

Expand Down Expand Up @@ -165,6 +165,10 @@ import Peer from "@/components/Peer.vue"
import config from '@/config'
// import { detectLanguage } from '@/support'
// const lang = detectLanguage()
export default {
props: ["peers", "localPeer"],
data() {
Expand Down Expand Up @@ -281,8 +285,8 @@ export default {
},
// Maybe vueuse has some language handling as well?
switchLanguage() {
this.$root.$i18n.locale = this.$root.$i18n.locale === 'de' ? 'en' : 'de'
this.$refs.switchLanguage.blur()
// this.$root.$i18n.locale = this.$root.$i18n.locale === 'de' ? 'en' : 'de'
// this.$refs.switchLanguage.blur()
},
// TODO: Use vueuse here
toggleMicrophone() {
Expand Down
1 change: 1 addition & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import messages from './i18nStrings'
import { detectLanguage } from './support'

const language = detectLanguage()
// Not sure if below is working as expected?
const locale = language && language.startsWith('de') ? 'de' : config.defaultLocale

const i18n = createI18n({
Expand Down
3 changes: 2 additions & 1 deletion src/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export function fancyNumber(n) {

// Detect user's browser language
export function detectLanguage() {
return navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage)
return "de"
// return navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage)
}

// Escapes a regex
Expand Down
5 changes: 4 additions & 1 deletion src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ import yyid from 'yyid'
import { browserCanUseWebrtc } from '@/webrtc'
import LanguageSwitcher from '@/components/LanguageSwitcher.vue'
import i18nStrings from '@/i18nStrings'
import { detectLanguage } from '@/support'
const lang = detectLanguage()
export default {
components: {
Expand All @@ -117,7 +120,7 @@ export default {
return browserCanUseWebrtc() && this.$route.query.supported !== "0"
},
infoPages() {
return i18nStrings[this.$root.$i18n.locale].infoPages.filter((ip) => ip.linked !== false)
return i18nStrings[lang].infoPages.filter((ip) => ip.linked !== false)
}
},
mounted() {
Expand Down
10 changes: 4 additions & 6 deletions src/views/InfoPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import LanguageSwitcher from '@/components/LanguageSwitcher.vue'
import Logo from '@/components/Logo.vue'
import Navigation from '@/components/Navigation.vue'
import i18nStrings from '@/i18nStrings'
import { detectLanguage } from '@/support'
const lang = detectLanguage()
export default {
components: {
Expand All @@ -33,12 +36,7 @@ export default {
},
computed: {
infoPage() {
return i18nStrings[this.$root.$i18n.locale].infoPages.filter((ip) => ip.id === this.page)[0] || {}
}
},
metaInfo() {
return {
title: this.infoPage.title,
return i18nStrings[lang].infoPages.filter((ip) => ip.id === this.page)[0] || {}
}
},
}
Expand Down
12 changes: 6 additions & 6 deletions src/views/Room.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import { Session } from "palava-client"
import config from "@/config"
import logger from "@/logger"
import { fancyNumber } from "@/support"
// import { fancyNumber } from "@/support"
import UserMediaConfigurator from "@/components/UserMediaConfigurator.vue"
import ScreenMessage from "@/components/ScreenMessage.vue"
Expand Down Expand Up @@ -254,11 +254,11 @@ export default {
this.infoPage = page
}
},
metaInfo() {
return {
title: `${fancyNumber(this.peers.length) || this.$t("room.emptyTitle")} | ${decodeURIComponent(this.$route.params.roomId)}`,
}
},
// metaInfo() {
// return {
// title: `${fancyNumber(this.peers.length) || this.$t("room.emptyTitle")} | ${decodeURIComponent(this.$route.params.roomId)}`,
// }
// },
}
</script>

Expand Down

0 comments on commit e41ae70

Please sign in to comment.