mirror of
https://github.com/HugeFrog24/shakethefrog.git
synced 2026-03-02 00:14:33 +00:00
RCE fix
This commit is contained in:
30
i18n/request.ts
Normal file
30
i18n/request.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { getRequestConfig } from 'next-intl/server';
|
||||
|
||||
// Can be imported from a shared config
|
||||
export const locales = ['en', 'de', 'ru', 'ka', 'ar'] as const;
|
||||
export const defaultLocale = 'en' as const;
|
||||
|
||||
export type Locale = typeof locales[number];
|
||||
|
||||
export default getRequestConfig(async ({ requestLocale }) => {
|
||||
// This typically corresponds to the `[locale]` segment
|
||||
let locale = await requestLocale;
|
||||
|
||||
// Ensure that a valid locale is used
|
||||
if (!locale || !locales.includes(locale as Locale)) {
|
||||
locale = defaultLocale;
|
||||
}
|
||||
|
||||
// Load messages from both ui and character directories
|
||||
// Read how to split localization files here:
|
||||
// https://next-intl.dev/docs/usage/configuration#messages-split-files
|
||||
const messages = {
|
||||
ui: (await import(`../messages/ui/${locale}.json`)).default,
|
||||
character: (await import(`../messages/character/${locale}.json`)).default
|
||||
};
|
||||
|
||||
return {
|
||||
locale,
|
||||
messages
|
||||
};
|
||||
});
|
||||
23
i18n/routing.ts
Normal file
23
i18n/routing.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { defineRouting } from 'next-intl/routing';
|
||||
import { createNavigation } from 'next-intl/navigation';
|
||||
|
||||
export const routing = defineRouting({
|
||||
// A list of all locales that are supported
|
||||
locales: ['en', 'de', 'ru', 'ka', 'ar'],
|
||||
|
||||
// Used when no locale matches
|
||||
defaultLocale: 'en',
|
||||
|
||||
// The `pathnames` object holds pairs of internal and
|
||||
// external paths. Based on the locale, the external
|
||||
// paths are rewritten to the shared, internal ones.
|
||||
pathnames: {
|
||||
// If all locales use the same pathname, a single
|
||||
// external path can be provided for all locales
|
||||
'/': '/',
|
||||
}
|
||||
});
|
||||
|
||||
// Lightweight wrappers around Next.js' navigation APIs
|
||||
// that will consider the routing configuration
|
||||
export const { Link, redirect, usePathname, useRouter } = createNavigation(routing);
|
||||
Reference in New Issue
Block a user