Fix: Fallback to English (not German) for unsupported languages
When a language like PT, FR, IT is selected but has no translation in exerciseTranslations.ts, the system now falls back to English instead of German. English is more universally understood. Applies to: exercise explanations, button labels, instructions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,6 +68,7 @@ export function ExerciseLayout({
|
|||||||
const typeKey = exerciseType || title.toLowerCase()
|
const typeKey = exerciseType || title.toLowerCase()
|
||||||
const explanation = exerciseExplanation
|
const explanation = exerciseExplanation
|
||||||
|| explanations[typeKey]?.[nativeLang]
|
|| explanations[typeKey]?.[nativeLang]
|
||||||
|
|| explanations[typeKey]?.['en']
|
||||||
|| explanations[typeKey]?.['de']
|
|| explanations[typeKey]?.['de']
|
||||||
|| ''
|
|| ''
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export function NativeLanguageProvider({ children }: { children: React.ReactNode
|
|||||||
const t = useCallback((key: ExerciseKey): string => {
|
const t = useCallback((key: ExerciseKey): string => {
|
||||||
const entry = exerciseT[key]
|
const entry = exerciseT[key]
|
||||||
if (!entry) return key
|
if (!entry) return key
|
||||||
return (entry as Record<string, string>)[nativeLang] || entry.de || key
|
return (entry as Record<string, string>)[nativeLang] || entry.en || entry.de || key
|
||||||
}, [nativeLang])
|
}, [nativeLang])
|
||||||
|
|
||||||
const wordInNative = useCallback((translations?: Record<string, any>): string => {
|
const wordInNative = useCallback((translations?: Record<string, any>): string => {
|
||||||
|
|||||||
Reference in New Issue
Block a user