mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 07:31:19 +00:00
fix: ns (#5211)
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { useTranslation as useNextTranslation } from 'next-i18next';
|
||||
import type { I18nNsType } from '../i18n/i18next';
|
||||
import { I18N_NAMESPACES_MAP } from '../i18n/constants';
|
||||
|
||||
export function useTranslation(ns?: I18nNsType[0] | I18nNsType) {
|
||||
const { t: originalT, ...rest } = useNextTranslation(ns);
|
||||
export function useTranslation() {
|
||||
const { t: originalT, ...rest } = useNextTranslation();
|
||||
|
||||
const t = (key: string | undefined, ...args: any[]): string => {
|
||||
if (!key) return '';
|
||||
|
||||
if (!I18N_NAMESPACES_MAP[key as any]) {
|
||||
const ns = key.split(':')[0];
|
||||
if (!I18N_NAMESPACES_MAP[ns as any]) {
|
||||
return key;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user