feat(i18n): Update language handling and remove unused imports for improved performance

This commit is contained in:
wei840222 2025-08-17 22:53:19 +08:00
parent f8896b0f7b
commit 7b30992971
10 changed files with 13 additions and 49 deletions

View file

@ -1,5 +1,5 @@
import { searchSearxng } from '@/lib/searxng';
import { getLocale } from 'next-intl/server';
import { DEFAULT_LOCALE } from '@/i18n/locales';
const websitesForTopic = {
tech: {
@ -38,10 +38,6 @@ export const GET = async (req: Request) => {
let data = [];
// derive base language from current locale (e.g., zh-TW -> zh)
const locale = await getLocale();
const searxLanguage = 'en';
if (mode === 'normal') {
const seenUrls = new Set();
@ -53,7 +49,7 @@ export const GET = async (req: Request) => {
await searchSearxng(`site:${link} ${query}`, {
engines: ['google news', 'bing news'],
pageno: 1,
language: searxLanguage,
language: DEFAULT_LOCALE,
})
).results;
}),
@ -75,7 +71,7 @@ export const GET = async (req: Request) => {
{
engines: ['google news', 'bing news'],
pageno: 1,
language: searxLanguage,
language: DEFAULT_LOCALE,
},
)
).results;