-
-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If i pass multiple parameters to useTranslation hook it doesn't works #1285
Comments
What do you mean it doesn't work? How doesn't it work? Does it work when you pass Are you passing export const getServerSideProps: GetServerSideProps = async (context) => ({
props: {
...(await serverSideTranslations(context.locale, ['groups', 'translation'])),
},
}); |
@codeBelt yes it works when I pass useTranslation(‘groups’) or useTranslation(‘translation’). Yes I am passing |
I just started using |
After dig a little about this subject. I can enhance the example code. The question from @shivika24 is about using the multiple files. For future reference here:
And call like that: @codeBelt I can enhance the sample file with that example. :) What do you think? |
You are going to have to create a public Github repo with a simple example of What you are showing me should work: const SomePage = () => {
const { t } = useTranslation(['common', 'home']);
return (
<>
<div>{t('title')}</div>
<div>{t('home:h1')}</div>
</>
);
};
export const getServerSideProps = async (context) => ({
props: {
...(await typedServerSideTranslations(context.locale, ['common', 'home'])),
},
});
export default SomePage; |
@codeBelt Can I fork your simple example and enhance over there? This will allow us to have just one source of truth. |
Sure for my example branch https://github.com/codeBelt/my-next.js-starter/tree/next-i18next |
@codeBelt Sure. Will do. :) |
@codeBelt After analyze your code, I think it's more than clear the example about how to use. I think it is a matter of You're authorizing, I can make that change. |
When you say:
Are you a contributor of I would say don't link to my example because I am just playing around and I would need to clean it up. Maybe I will write an article about my example which may help other people. |
@codeBelt I don't! I would suggest an PR :) Awesome idea! Have a good one, then. Just trying to help <3 |
We don't need to add a new example, but blogs and further documentation are always great. Thanks! |
const { t } = useTranslation(['groups','translation'])
Here groups and translation are both json files.
The text was updated successfully, but these errors were encountered: