feat: optimize i18n implementation for better localization (#2062)
* feat: optimize i18n implementation for better localization * delete i18n-ally-custom-framework.yml * update common key
This commit is contained in:
@@ -10,7 +10,11 @@ export const useCopyData = () => {
|
||||
const { toast } = useToast();
|
||||
|
||||
const copyData = useCallback(
|
||||
async (data: string, title: string | null = t('common.Copy Successful'), duration = 1000) => {
|
||||
async (
|
||||
data: string,
|
||||
title: string | null = t('common:common.Copy Successful'),
|
||||
duration = 1000
|
||||
) => {
|
||||
try {
|
||||
if (navigator.clipboard) {
|
||||
await navigator.clipboard.writeText(data);
|
||||
|
||||
@@ -78,7 +78,7 @@ export const useEditTitle = ({
|
||||
({
|
||||
maxLength = 30,
|
||||
iconSrc = 'modal/edit',
|
||||
closeBtnText = t('common.Close')
|
||||
closeBtnText = t('common:common.Close')
|
||||
}: {
|
||||
maxLength?: number;
|
||||
iconSrc?: string;
|
||||
@@ -110,7 +110,7 @@ export const useEditTitle = ({
|
||||
</Button>
|
||||
)}
|
||||
<Button onClick={runAsync} isLoading={loading}>
|
||||
{t('common.Confirm')}
|
||||
{t('common:common.Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
|
||||
@@ -54,7 +54,7 @@ export const useSpeech = (props?: OutLinkChatAuthProps & { appId?: string }) =>
|
||||
if (!navigator?.mediaDevices?.getUserMedia) {
|
||||
return toast({
|
||||
status: 'warning',
|
||||
title: t('common.speech.not support')
|
||||
title: t('common:common.speech.not support')
|
||||
});
|
||||
}
|
||||
try {
|
||||
@@ -116,7 +116,7 @@ export const useSpeech = (props?: OutLinkChatAuthProps & { appId?: string }) =>
|
||||
} catch (error) {
|
||||
toast({
|
||||
status: 'warning',
|
||||
title: getErrText(error, t('common.speech.error tip'))
|
||||
title: getErrText(error, t('common:common.speech.error tip'))
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { I18nNsType } from '@/types/i18n';
|
||||
import { I18nNsType } from '@/types/i18next';
|
||||
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
|
||||
|
||||
export const LANG_KEY = 'NEXT_LOCALE_LANG';
|
||||
|
||||
@@ -62,7 +62,7 @@ export const useAudioPlay = (props?: OutLinkChatAuthProps & { ttsConfig?: AppTTS
|
||||
const data = await response.json();
|
||||
toast({
|
||||
status: 'error',
|
||||
title: getErrText(data, t('core.chat.Audio Speech Error'))
|
||||
title: getErrText(data, t('common:core.chat.Audio Speech Error'))
|
||||
});
|
||||
return Promise.reject(data);
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export const useAudioPlay = (props?: OutLinkChatAuthProps & { ttsConfig?: AppTTS
|
||||
if (!MediaSource) {
|
||||
toast({
|
||||
status: 'error',
|
||||
title: t('core.chat.Audio Not Support')
|
||||
title: t('common:core.chat.Audio Not Support')
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ export const useAudioPlay = (props?: OutLinkChatAuthProps & { ttsConfig?: AppTTS
|
||||
} catch (error) {
|
||||
toast({
|
||||
status: 'error',
|
||||
title: getErrText(error, t('core.chat.Audio Speech Error'))
|
||||
title: getErrText(error, t('common:core.chat.Audio Speech Error'))
|
||||
});
|
||||
reject(error);
|
||||
}
|
||||
@@ -215,7 +215,7 @@ export const useAudioPlay = (props?: OutLinkChatAuthProps & { ttsConfig?: AppTTS
|
||||
if (!MediaSource) {
|
||||
return toast({
|
||||
status: 'error',
|
||||
title: t('core.chat.Audio Not Support')
|
||||
title: t('common:core.chat.Audio Not Support')
|
||||
});
|
||||
}
|
||||
cancelAudio();
|
||||
|
||||
Reference in New Issue
Block a user