Replies: 1 comment 2 replies
-
Did you try #1887 (comment) ? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi next-i18next team,
I applied the steps described into this :
https://github.com/adrserr/adrserr.com/blob/main/data/posts/en/i18n-typescript-next.mdx
but it does not seem to work on my application. So wondering if I am missing something in importing the json resources bundle ?
@adrai please could you help?
Here is the code block
{
"update-infos": "Update My Information",
"credentials" : "Credentials",
"payment-methods": "Payment Methods",
"my-orders":"My Orders",
"my-messages": "My Messages",
"addresses" : "Addresses"
}
// import the original type declarations
import 'react-i18next'
// import all namespaces (for the default language, only)
import { Resources as LocaleResources } from "@custom-types/locales";
declare module 'react-i18next' {
// and extend them!
interface Resources extends LocaleResources {}
}
''''
_import { Router, useRouter } from "next/router";
import { useTranslation } from "next-i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import Resources from "react-i18next"
interface Props {
selectedIndex:Number
selectedStyle:String
}
type ClickFunction = (event: React.MouseEvent<Element, MouseEvent>)=>void
type ClickableElement = {
name:string
clickFunction:ClickFunction
}
export default function SideMenu({selectedIndex,selectedStyle}:Props):JSX.Element{
const { t } = useTranslation('settings');
const router = useRouter();
const items:ClickableElement[] = [
{
name: t('settings.update-infos'),
clickFunction:(e)=>router.push("/user/settings")
},
{
name: t('settings.credentials'),
clickFunction:(e)=>router.push("/user/credentials")
},
name: t('settings.my-messages'),
clickFunction:(e)=>router.push("/user/my-messages")
},
{
name: t('settings.addresses'),
clickFunction:(e)=>router.push("/user/addresses")
}
]
return(
{items.map((item,k)=>(
export const getStaticProps = async ({ locale }: {locale : string}) => ({
},
});_
''''
Beta Was this translation helpful? Give feedback.
All reactions