Implement complete multi-language support with Romanian/English

- Added next-intl for internationalization with Romanian as default locale
- Restructured app directory with [locale] routing (/ro, /en)
- Created comprehensive translation files for both languages
- Fixed Next.js 15 async params compatibility in layout components
- Updated all components to use proper i18n hooks and translations
- Configured middleware for locale routing and fallbacks
- Fixed FloatingChat component translation array handling
- Restored complete home page with internationalized content
- Fixed Material-UI Slide component prop error (mountOnExit → unmountOnExit)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
andupetcu
2025-09-20 15:43:51 +03:00
parent dd5e1102eb
commit a0969e88df
21 changed files with 695 additions and 123 deletions

View File

@@ -40,6 +40,7 @@ export async function getEmbedding(text: string): Promise<number[]> {
export async function searchBibleSemantic(
query: string,
language: string = 'ro',
limit: number = 10
): Promise<BibleVerse[]> {
try {
@@ -52,11 +53,11 @@ export async function searchBibleSemantic(
SELECT ref, book, chapter, verse, text_raw,
1 - (embedding <=> $1) AS similarity
FROM bible_passages
WHERE embedding IS NOT NULL
WHERE embedding IS NOT NULL AND lang = $3
ORDER BY embedding <=> $1
LIMIT $2
`,
[JSON.stringify(queryEmbedding), limit]
[JSON.stringify(queryEmbedding), limit, language]
)
return result.rows
@@ -71,11 +72,15 @@ export async function searchBibleSemantic(
export async function searchBibleHybrid(
query: string,
language: string = 'ro',
limit: number = 10
): Promise<BibleVerse[]> {
try {
const queryEmbedding = await getEmbedding(query)
// Use appropriate text search configuration based on language
const textConfig = language === 'ro' ? 'romanian' : 'english'
const client = await pool.connect()
try {
const result = await client.query(
@@ -83,25 +88,25 @@ export async function searchBibleHybrid(
WITH vector_search AS (
SELECT id, 1 - (embedding <=> $1) AS vector_sim
FROM bible_passages
WHERE embedding IS NOT NULL
WHERE embedding IS NOT NULL AND lang = $4
ORDER BY embedding <=> $1
LIMIT 100
),
text_search AS (
SELECT id, ts_rank(tsv, plainto_tsquery('romanian', $3)) AS text_rank
SELECT id, ts_rank(tsv, plainto_tsquery($5, $3)) AS text_rank
FROM bible_passages
WHERE tsv @@ plainto_tsquery('romanian', $3)
WHERE tsv @@ plainto_tsquery($5, $3) AND lang = $4
)
SELECT bp.ref, bp.book, bp.chapter, bp.verse, bp.text_raw,
COALESCE(vs.vector_sim, 0) * 0.7 + COALESCE(ts.text_rank, 0) * 0.3 AS combined_score
FROM bible_passages bp
LEFT JOIN vector_search vs ON vs.id = bp.id
LEFT JOIN text_search ts ON ts.id = bp.id
WHERE vs.id IS NOT NULL OR ts.id IS NOT NULL
WHERE (vs.id IS NOT NULL OR ts.id IS NOT NULL) AND bp.lang = $4
ORDER BY combined_score DESC
LIMIT $2
`,
[JSON.stringify(queryEmbedding), limit, query]
[JSON.stringify(queryEmbedding), limit, query, language, textConfig]
)
return result.rows