jsoneditor icon indicating copy to clipboard operation
jsoneditor copied to clipboard

How to display Chinese in valid message

Open season886 opened this issue 4 years ago • 5 comments

1.I set schema but how to display Chinese in valid message(can integrated i18n?) 2.How to add a new button to the menu & call custom function(form mode,not onCreateMenu)

season886 avatar Mar 28 '20 02:03 season886

  1. There is a Chinese translation already available. See docs on language and languages https://github.com/josdejong/jsoneditor/blob/develop/docs/api.md. There is also an example showing how to create your own translation. Is that what you mean?

  2. Which menu do you mean? The main menu (on top) or the context menu that you can open for every node?

josdejong avatar Mar 29 '20 09:03 josdejong

  1. display Chinese translation like schema vaild message in ajv error tips,It is better to synchronize with the jsoneditor language attribute.
  2. I want to add a save button on main menu , no attribute to do this.
  3. when i set schema like "app_key" : {[ "type":"string", "minLength":1 ]} input number of value,call getText() method can auto change the value to string? now getText : {app_key:123}
    hope getText: {app_key:"123"}

all about in form mode,Thanks

season886 avatar Mar 30 '20 01:03 season886

  1. That's an interesting idea. I did have a short look, there is support for it via ajv-i18n. Anyone interested to look into hooking up ajv-i18n with the jsoneditor localization?
  2. There is indeed no API for it, though after creating the JSONEditor you can quite easily find the menu div (has a class jsoneditor-menu) using a querySelector, and then append (or prepend) your own button there with plain JavaScript.
  3. Yes, that would indeed be nice. I think a solution for this idea is discussed in #862, is that correct?

josdejong avatar Apr 04 '20 17:04 josdejong

That's an interesting idea. I did have a short look, there is support for it via ajv-i18n. Anyone interested to look into hooking up ajv-i18n with the jsoneditor localization?

I have made this PR - #1244.

askalione avatar Feb 15 '21 14:02 askalione

Thanks @askalione 👍

josdejong avatar Feb 17 '21 20:02 josdejong