feat(i18n): Integrate next-intl, localize core UI, add regional locales and zh-TW Discover sources
**Overview** - Integrates next-intl (App Router, no i18n routing) with cookie-based locale and Accept-Language fallback. - Adds message bundles and regional variants; sets en-US as the default. **Key changes** - i18n foundation - Adds request-scoped config to load messages per locale and injects NextIntlClientProvider in [layout.tsx] - Adds/updates messages for: en-US, en-GB, zh-TW, zh-HK, zh-CN, ja, ko, fr-FR, fr-CA, de. Centralizes LOCALES, LOCALE_LABELS, and DEFAULT_LOCALE in [locales.ts] - Adds LocaleSwitcher (cookie-based) and [LocaleBootstrap] - Pages and components - Localizes Sidebar, Home (including metadata/manifest), Settings, Discover, Library. - Localizes common components: MessageInput, Attach, Focus, Optimization, MessageBox, MessageSources, SearchImages, SearchVideos, EmptyChat, NewsArticleWidget, WeatherWidget. - APIs - Weather API returns localized condition strings server-side. - UX and quality - Converts all remaining <img> to Next Image. - Updates browserslist/caniuse DB to silence warnings. - Security: Settings API Key inputs are now password fields and placeholders were removed.
This commit is contained in:
parent
0dc17286b9
commit
9a772d6abe
56 changed files with 3673 additions and 365 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { searchSearxng } from '@/lib/searxng';
|
||||
import { getLocale } from 'next-intl/server';
|
||||
|
||||
const websitesForTopic = {
|
||||
tech: {
|
||||
|
|
@ -37,6 +38,10 @@ 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();
|
||||
|
||||
|
|
@ -46,9 +51,9 @@ export const GET = async (req: Request) => {
|
|||
selectedTopic.query.map(async (query) => {
|
||||
return (
|
||||
await searchSearxng(`site:${link} ${query}`, {
|
||||
engines: ['bing news'],
|
||||
engines: ['google news', 'bing news'],
|
||||
pageno: 1,
|
||||
language: 'en',
|
||||
language: searxLanguage,
|
||||
})
|
||||
).results;
|
||||
}),
|
||||
|
|
@ -68,9 +73,9 @@ export const GET = async (req: Request) => {
|
|||
await searchSearxng(
|
||||
`site:${selectedTopic.links[Math.floor(Math.random() * selectedTopic.links.length)]} ${selectedTopic.query[Math.floor(Math.random() * selectedTopic.query.length)]}`,
|
||||
{
|
||||
engines: ['bing news'],
|
||||
engines: ['google news', 'bing news'],
|
||||
pageno: 1,
|
||||
language: 'en',
|
||||
language: searxLanguage,
|
||||
},
|
||||
)
|
||||
).results;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue