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

How to display Chinese in valid message #947

Open
season886 opened this issue Mar 28, 2020 · 5 comments
Open

How to display Chinese in valid message #947

season886 opened this issue Mar 28, 2020 · 5 comments
Labels

Comments

@season886
Copy link

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)

@josdejong
Copy link
Owner

  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?

@season886
Copy link
Author

season886 commented Mar 30, 2020

  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

@josdejong
Copy link
Owner

  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 Explicit strings in editor #862, is that correct?

@askalione
Copy link

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.

@josdejong
Copy link
Owner

Thanks @askalione 👍

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

No branches or pull requests

3 participants