diff --git a/components/bible/bible-reader-app.tsx b/components/bible/bible-reader-app.tsx index 5d464be..a2e6f8f 100644 --- a/components/bible/bible-reader-app.tsx +++ b/components/bible/bible-reader-app.tsx @@ -1,5 +1,6 @@ 'use client' import { useState, useEffect } from 'react' +import { useLocale } from 'next-intl' import { Box, Typography, Button } from '@mui/material' import { BibleChapter, BibleVerse } from '@/types' import { getCachedChapter, cacheChapter } from '@/lib/cache-manager' @@ -17,6 +18,7 @@ interface BookInfo { } export function BibleReaderApp() { + const locale = useLocale() const [bookId, setBookId] = useState(1) // Genesis (numeric ID from search) const [chapter, setChapter] = useState(1) const [currentChapter, setCurrentChapter] = useState(null) @@ -30,10 +32,10 @@ export function BibleReaderApp() { const [error, setError] = useState(null) const [booksLoading, setBooksLoading] = useState(true) - // Load books on mount + // Load books on mount or when locale changes useEffect(() => { loadBooks() - }, []) + }, [locale]) // Load chapter when bookId or chapter changes useEffect(() => { @@ -47,7 +49,7 @@ export function BibleReaderApp() { setError(null) try { - const response = await fetch('/api/bible/books') + const response = await fetch(`/api/bible/books?locale=${locale}`) if (!response.ok) { throw new Error(`Failed to load books: ${response.status}`) } @@ -167,18 +169,14 @@ export function BibleReaderApp() { } return ( - + {/* Header with search */} {/* Reading area */} - + {!booksLoading && error ? ( {error}