Skip to content

Commit

Permalink
fix: use first language as fallback for answers
Browse files Browse the repository at this point in the history
Signed-off-by: Till Sanders <mail@till-sanders.de>
  • Loading branch information
tillsanders committed Oct 11, 2021
1 parent b586ea7 commit ab28535
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
"spew": {
"position": "approve",
"explanation": {
"de": "Expecto riddikulus aparecium ferula evanesco lacarnum locomotor inflamarae aresto charm rictusempra. Lumos aparecium sonorus locomotor jinx fidelius sonorus inflamarae deletrius. Incarcerous rictusempra petrificus stupefy kedavra rictusempra. Aparecium inflamarae crucio homorphus mortis rennervate orchideous.",
"en": "Expecto riddikulus aparecium ferula evanesco lacarnum locomotor inflamarae aresto charm rictusempra. Lumos aparecium sonorus locomotor jinx fidelius sonorus inflamarae deletrius. Incarcerous rictusempra petrificus stupefy kedavra rictusempra. Aparecium inflamarae crucio homorphus mortis rennervate orchideous."
"de": "DE Expecto riddikulus aparecium ferula evanesco lacarnum locomotor inflamarae aresto charm rictusempra. Lumos aparecium sonorus locomotor jinx fidelius sonorus inflamarae deletrius. Incarcerous rictusempra petrificus stupefy kedavra rictusempra. Aparecium inflamarae crucio homorphus mortis rennervate orchideous.",
"en": null
}
},
"snape": {
Expand Down
9 changes: 9 additions & 0 deletions src/components/views/home/sections/06-compare/Answer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,24 @@ export default {
return this.algorithm.options.find((option) => option.alias === this.position);
},
content() {
// TODO: This is not a nice implementation.
if (this.skipped) {
return this.$t('views.home.compare.answer.skip.content', { party: this.$t(`parties.${this.party.index}.name`) });
}
if (
!this.$te(`theses.${this.thesis.index}.positions.${this.party.alias}.explanation`)
&& !this.$te(`theses.${this.thesis.index}.positions.${this.party.alias}.explanation`, this.$store.getters['languages/fallback'].code)
&& !this.$root.$te(`theses.${this.thesis.index}.positions.${this.party.alias}.explanation`)
) {
return this.$t('views.home.compare.answer.empty.content', { party: this.$t(`parties.${this.party.index}.name`) });
}
if (
!this.$te(`theses.${this.thesis.index}.positions.${this.party.alias}.explanation`)
&& this.$te(`theses.${this.thesis.index}.positions.${this.party.alias}.explanation`, this.$store.getters['languages/fallback'].code)
&& !this.$root.$te(`theses.${this.thesis.index}.positions.${this.party.alias}.explanation`)
) {
return this.$t(`theses.${this.thesis.index}.positions.${this.party.alias}.explanation`, this.$store.getters['languages/fallback'].code);
}
const explanation = this.$t(`theses.${this.thesis.index}.positions.${this.party.alias}.explanation`).trim();
if (explanation === '') {
return this.$t('views.home.compare.answer.empty.content', { party: this.$t(`parties.${this.party.index}.name`) });
Expand Down

0 comments on commit ab28535

Please sign in to comment.