-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Using translations in a ts file #60
Comments
Hi @galkatz373, I assume you are using the library inside a 'react' application. Is this correct? import type { TranslationFunctions } from './i18n/i18n-types'
export const required = (LL: TranslationFunctions, value: string | undefined) => {
if (!value || value.length === 0) {
return LL.REQUIRED()
}
} Hope this helps :) |
I thought about it, but then I have to pass the translation object each time I call the validation function. |
It's hard to tell what exactly could work for you without seeing the code. But you could wrap it like this:
You would make sure to call |
The last solution is better, thanks for the help! |
First I have to say the library is amazing.
Making my website for multiple languages, never been easier.
However I'm trying the use the translations inside a seperate .ts file for validations, and I can't figure out to do it properly.
An example:
I'm trying to replace the string at the end with my translation.
Thanks in advance.
The text was updated successfully, but these errors were encountered: