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

Be able to extract translations from strings and not only from t(string) #193

Open
alanszp opened this issue May 25, 2021 · 2 comments
Open

Comments

@alanszp
Copy link

alanszp commented May 25, 2021

Is your feature request related to a problem? Please describe.

When using yup or other libraries, I want to give the library the translation path, but not the computed value, and then in the code use that path with the TFunction.

Ilustrative example:

yup.object({
    body: yup.string().required('errors.bodyIsRequired'),
})

Later on the code

t(errors.body)

In this case, i18next-extract won't know that errors.bodyIsRequired is a translation.

Describe the solution you'd like

Was thinking (but open to discussion) that if we can add a comment hint like // i18next-extract-string-is-translation or // i18next-extract-string-is-translation-next-line would help in this cases.

Describe alternatives you've considered

Was thinking how to configure customTransComponents for this case, but the problem is that there are many types and they are stored in node_modules. Woludn't be so sure how to make that work.

Additional context

@eric-burel
Copy link

This one seems covered by this documentation: https://i18next-extract.netlify.app/#/configuration?id=tfunctionnames
You can add relevant yup calls as function names, like "string().required" in your example.

@alanszp
Copy link
Author

alanszp commented Sep 17, 2021

Thanks for the comment! I think that it might be used, but can lead to potential errors if miss configured.
And also if the implementation of the yup call handles multiple firms, it may also lead to problems.

I think that this hint is still usefull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants