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

Translate property names #92

Open
mduu opened this issue Dec 12, 2018 · 1 comment
Open

Translate property names #92

mduu opened this issue Dec 12, 2018 · 1 comment

Comments

@mduu
Copy link

mduu commented Dec 12, 2018

I generate JSON schemas based on thy applications metadata (Entity, Properties, Validation-Rules) etc. and then use ajv-i18n to get translated (german) messages out of AJV that get rendered into the otherwise translated UI.

This works great except that I don't see a way to translate the property names. I get messages like:

sollte das erforderliche Attribut firstName enthalten

The word "firstName" is English and should be "Vorname". I have this text already on hand when generating the JSON schema and even when validating.

How can I feed in my custom property name or let's better say "Property Caption" into the messages?

Btw: From PoV there are two things: a) propertyName (technical, internal) and b) propertyCaption (the thing to show to the user/message).

@smeijer
Copy link

smeijer commented Mar 5, 2019

I think it would indeed be usefull to enable the usage of property.title for the error message.

{
  "properties": {
    "firstName": {
      "type": "string",
      "title": "Vorname",
    }
  },
  "required": ["firstName"],
}
err: sollte das erforderliche Attribut 'Vorname' enthalten

But also an option to omit the key?

err: this property is required

Because often the error message is already positioned next to the field.

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

No branches or pull requests

3 participants