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

Allow type translations #54

Open
siavashkavousi opened this issue Sep 10, 2017 · 8 comments
Open

Allow type translations #54

siavashkavousi opened this issue Sep 10, 2017 · 8 comments

Comments

@siavashkavousi
Copy link

Hi,

I think there should some way to translate prop.type and things like that.

Thanks.

@epoberezkin
Copy link
Member

@siavashkavousi can you please clarify.

@siavashkavousi
Copy link
Author

if we have the following message in en and my locale (fa)
en: should be {{=e.params.type}}
fa: 'فیلد باید {{=e.params.type}} باشد'

then I got
فیلد باید number باشد
like in english
should be number

as you can see number can be localized as well :)

@epoberezkin
Copy link
Member

Makes sense for type names. So it would require a map of type names for each language (and by default english will be used, if the map is not provided).

@epoberezkin
Copy link
Member

What do you mean by "and more"?

@siavashkavousi
Copy link
Author

I didn't quite integrate it in my application, but one more thing which I think can be localized is property names.
I mean by passing title instead of property name, messages looks better (in my application) which I think is not general.

@epoberezkin
Copy link
Member

That's definitely more complex, it has to be somehow passed via ajv. Maybe ajv-errors can be extended to support i18n.

@epoberezkin epoberezkin changed the title Allow type translation and more Allow type translations Oct 22, 2017
@epoberezkin epoberezkin added this to the 3.0.0 milestone Oct 22, 2017
@epoberezkin epoberezkin removed this from the 3.0.0 milestone Jan 7, 2018
@adefrutoscasado
Copy link

Same problem here, is there any workaround? Being able to pass a translate function would be nice

@FedeTommi
Copy link

FedeTommi commented Apr 26, 2024

I have the same problem too.

I had a look at the jtd.js and index.js and it seems like the problem is solved for the languages fi, nb, nl and pl.
Here a proposal for the languages German and Italian:

de: '{{#def.t}}muss {{? t == "number" }}eine Zahl{{?? t == "integer"}}eine ganze Zahl{{?? t == "string"}}ein Text{{?? t == "boolean"}} boolescher Wert{{??}}{{=t}}{{?}}{{=n}} sein',

it: '{{#def.t}}deve essere {{? t == "number" }}un numero{{?? t == "integer"}}un numero intero{{?? t == "string"}}un testo{{?? t == "boolean"}} booleano{{??}}{{=t}}{{?}}{{=n}}',

Would it be possible to add these?

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

No branches or pull requests

4 participants