Skip to content
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

Set default namespace when calling useTranslation #28

Open
stichiboi opened this issue Apr 24, 2022 · 0 comments
Open

Set default namespace when calling useTranslation #28

stichiboi opened this issue Apr 24, 2022 · 0 comments
Assignees
Labels
up for discussion discussion if this is going to be implemented

Comments

@stichiboi
Copy link

I'm writing my nested JSON strings to organize better and keep keys shorter.
The problem is that every time I use the translations, I have to write the full path of the nested key

const {t} = useTranslation();

const title = t("hero.title");
const description = t("hero.description")

My proposal: add optional parameter to useTranslation that lets you define a prefix path to all the keys you use

Example:

const {t} = useTranslation("hero");

const title = t("title");
const description = t("description")
@martinkr martinkr added the up for discussion discussion if this is going to be implemented label Apr 24, 2022
@martinkr martinkr self-assigned this Apr 24, 2022
@martinkr martinkr added this to the 2.2.1 milestone May 19, 2023
@martinkr martinkr removed this from the 2.2.1 milestone Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
up for discussion discussion if this is going to be implemented
Projects
None yet
Development

No branches or pull requests

2 participants