diff --git a/frontend/src/views/social/VocabLessonView.vue b/frontend/src/views/social/VocabLessonView.vue index 3c0f115..ede4a80 100644 --- a/frontend/src/views/social/VocabLessonView.vue +++ b/frontend/src/views/social/VocabLessonView.vue @@ -126,11 +126,11 @@

- {{ prepTargetLabel }} + {{ currentPrepTopLabel }}
{{ currentPrepItem.target }}
- {{ prepGlossLabel }} + {{ currentPrepBottomLabel }}
{{ currentPrepItem.gloss || '—' }}
@@ -1309,6 +1309,12 @@ export default { || this.$t('socialnetwork.vocab.courses.vocabPrepGlossLabel') ).toUpperCase(); }, + currentPrepTopLabel() { + return this._prepRowLabelFor('target'); + }, + currentPrepBottomLabel() { + return this._prepRowLabelFor('gloss'); + }, prepItems() { // Vorbereitung nur mit echten Paaren (Zielsprache + Übersetzung), // damit weder leere Gloss-Zeilen noch übergroße Listen entstehen. @@ -1812,6 +1818,33 @@ export default { } return { target: s, gloss: '' }; }, + _prepRowLabelFor(side = 'target') { + const item = this.currentPrepItem; + if (!item) { + return side === 'target' ? this.prepTargetLabel : this.prepGlossLabel; + } + const nativeHints = new Set( + (this.importantVocab || []) + .map((x) => this.normalizeLessonVocabTerm(x?.learning)) + .filter(Boolean) + ); + const targetHints = new Set( + (this.importantVocab || []) + .map((x) => this.normalizeLessonVocabTerm(x?.reference)) + .filter(Boolean) + ); + const targetNorm = this.normalizeLessonVocabTerm(item.target); + const glossNorm = this.normalizeLessonVocabTerm(item.gloss); + const targetLooksNative = nativeHints.has(targetNorm) && !targetHints.has(targetNorm); + const glossLooksTarget = targetHints.has(glossNorm) && !nativeHints.has(glossNorm); + const targetLooksTarget = targetHints.has(targetNorm) && !nativeHints.has(targetNorm); + const glossLooksNative = nativeHints.has(glossNorm) && !targetHints.has(glossNorm); + const shouldSwapLabels = targetLooksNative && glossLooksTarget && !(targetLooksTarget && glossLooksNative); + if (shouldSwapLabels) { + return side === 'target' ? this.prepGlossLabel : this.prepTargetLabel; + } + return side === 'target' ? this.prepTargetLabel : this.prepGlossLabel; + }, corePatternToDisplayString(p) { const n = this.normalizeCorePatternEntry(p); if (!n) return '';