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

Rework i18n support in JSON Forms core #1825

Merged
merged 1 commit into from
Oct 27, 2021
Merged

Conversation

sdirix
Copy link
Member

@sdirix sdirix commented Oct 26, 2021

Labels, descriptions and error messages can now be translated via
special translation functions handed over to JSON Forms.

The translations are automatically handed within the default
mapping functions and are therefore available in all renderer sets.
This includes a key-determination algorithm, allowing to either rely
on using labels as keys or specifying 'i18n' keys in UI Schema options
or directly within the JSON Schema. Errors are handled separately to
allow for maximum flexibility.

Includes test cases for the most common mapping functions.

Also AJV is set to non-strict by default to not throw errors when
handing over JSON Schemas containing 'i18n' keys.

@sdirix sdirix requested a review from max-elia October 26, 2021 14:10
Labels, descriptions and error messages can now be translated via
special translation functions handed over to JSON Forms.

The translations are automatically handed within the default
mapping functions and are therefore available in all renderer sets.
This includes a key-determination algorithm, allowing to either rely
on using labels as keys or specifying 'i18n' keys in UI Schema options
or directly within the JSON Schema. Errors are handled separately to
allow for maximum flexibility.

Includes test cases for the most common mapping functions.

Also AJV is set to non-strict by default to not throw errors when
handing over JSON Schemas containing 'i18n' keys.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 89.377% when pulling b3d5af5 on sdirix:i18n into 81e4dd6 on eclipsesource:master.

@sdirix sdirix marked this pull request as ready for review October 26, 2021 20:54
@max-elia
Copy link
Contributor

Tested and reviewed the code.
Everything works and looks good to me.

@sdirix sdirix merged commit 2778f01 into eclipsesource:master Oct 27, 2021
@sdirix sdirix deleted the i18n branch October 27, 2021 12:52
@andresgutgon
Copy link
Contributor

@sdirix could you put an example here with i18n keys in the schema or uischema? I don't find the right way of setting this in the case of enums

@yaffol
Copy link
Contributor

yaffol commented Feb 1, 2022

@andresgutgon There is an example in the Vue2-Vuetify renderer set for the 'basic' example (see under the 'schema' tab) https://jsonforms-vuetify-renderers.netlify.app/#/example/basic

That has i18n keys and also an enum, maybe that will be helpful.

@sdirix
Copy link
Member Author

sdirix commented Feb 1, 2022

The enums actually have a bug right now in the React Material renderers (Angular and Vue are fine). They will render correctly with the first locale selection but will not update their labels when the translator is changed without an additional schema change. This will be fixed here: #1879

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

Successfully merging this pull request may close these issues.

5 participants