Updated all application paths for locale

This commit is contained in:
Moritz Kröger 2017-08-15 22:59:50 +02:00
parent 873204f925
commit 80c985ac75
8 changed files with 71 additions and 14 deletions

View file

@ -65,18 +65,39 @@
},
computed: {
isGermanLocale () {
return this.$i18n.locale === 'de'
},
topMenu () {
return [
{ label: this.$t('topMenu.index'), route: { path: '/' } },
{ label: this.$t('topMenu.about'), route: { path: '/über-uns' } },
{ label: this.$t('topMenu.faq'), route: { path: '/faq' } },
{ label: this.$t('topMenu.press'), route: { path: '/presse' } }
{
label: this.$t('topMenu.index'),
route: { path: '/' }
},
{
label: this.$t('topMenu.about'),
route: { path: this.isGermanLocale ? '/über-uns' : '/about-us' }
},
{
label: this.$t('topMenu.faq'),
route: { path: '/faq' }
},
{
label: this.$t('topMenu.press'),
route: { path: this.isGermanLocale ? '/presse' : '/press' }
}
]
},
subMenu () {
return [
{ label: this.$t('subMenu.imprint'), route: { path: '/impressum' } },
{ label: this.$t('subMenu.privacy'), route: { path: '/datenschutz' } }
{
label: this.$t('subMenu.imprint'),
route: { path: this.isGermanLocale ? '/impressum' : '/imprint' }
},
{
label: this.$t('subMenu.privacy'),
route: { path: this.isGermanLocale ? '/datenschutz' : '/privacy' }
}
]
}
}

View file

@ -37,6 +37,12 @@
}
},
computed: {
isGermanLocale () {
return this.$i18n.locale === 'de'
}
},
methods: {
addThesisEmphasis (thesis, event) {
if (event.target.checked) {
@ -48,7 +54,10 @@
},
submitEmphasis () {
localStorage.setItem('euromat-emphasized', JSON.stringify(this.emphasized))
this.$router.push({ path: '/thesen/ergebnis' })
this.$router.push({ path: this.isGermanLocale
? '/thesen/ergebnis'
: '/theses/results'
})
}
}
}

View file

@ -56,6 +56,9 @@
},
computed: {
isGermanLocale () {
return this.$i18n.locale === 'de'
},
thesisTitle () {
if (this.currentThesis === this.thesesCount) {
return
@ -99,7 +102,10 @@
},
forwardToResults () {
localStorage.setItem('euromat-answers', JSON.stringify(this.answers))
this.$router.push({ path: '/thesen/gewichtung' })
this.$router.push({ path: this.isGermanLocale
? '/thesen/gewichtung'
: '/theses/emphasis'
})
}
}
}

View file

@ -6,7 +6,7 @@
<ul class="party-results">
<li v-for="party of parties">
<router-link :to="{ path: `/partei/${party.token.toLowerCase()}` }">
<router-link :to="{ path: getPartyPath(party.token.toLowerCase()) }">
<h2>{{ party.token }} ({{ getScorePercentage(party.score) }} %)</h2>
<!-- <svgicon :name="getPartyLogoName(item.token)" width="50" height="50" /> -->
<party-percentage
@ -55,7 +55,18 @@
}
},
computed: {
isGermanLocale () {
return this.$i18n.locale === 'de'
}
},
methods: {
getPartyPath (token) {
return this.isGermanLocale
? `/partei/${token}`
: `/party/${token}`
},
getPartyLogoName (token) {
return `${token.toLowerCase()}-logo`
},

View file

@ -3,7 +3,7 @@ import Imprint from './components/index'
export default [
{
path: '/impressum',
alias: 'imprint',
alias: '/imprint',
name: 'imprint',
component: Imprint
}

View file

@ -1,10 +1,12 @@
<template>
<section>
<h1>{{ $t('intro.headline') }}</h1>
<p v-for="txt of $t('intro.content')">
{{ txt }}
</p>
<router-link class="btn" :to="{ path: '/thesen' }">
<router-link class="btn" :to="{ path: thesesPath }">
{{ $t('intro.button') }}
</router-link>
</section>
@ -12,7 +14,15 @@
<script>
export default {
name: 'Intro'
name: 'Intro',
computed: {
thesesPath () {
return this.$i18n.locale === 'de'
? '/thesen'
: '/theses'
}
}
}
</script>

View file

@ -3,7 +3,7 @@ import Press from './components/index'
export default [
{
path: '/presse',
alias: 'press',
alias: '/press',
name: 'press',
component: Press
}

View file

@ -3,7 +3,7 @@ import Privacy from './components/index'
export default [
{
path: '/datenschutz',
alias: 'privacy',
alias: '/privacy',
name: 'privacy',
component: Privacy
}