-
Notifications
You must be signed in to change notification settings - Fork 13
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
Is it possible to get "better" labels by default without using .properties files? #15
Comments
Hi skinkie, what is your solution/template engine to generate markup of your forms (or are you using FormRenderer class)? In provided demo, you can see translation of form field names within: But generally, you can make your custom solution for translations based on labelKey attribute of form fields. As stated in http://www.formio.net/documentation/configuration/: Default message bundle name (also used by FormRenderer) is derived from the class of edited object. If com.example.Registration class is edited, com/example/Registration bundle (Registration.properties in package com.example) is searched. If translation in message bundle is not found, ??? is written to output. When using FormRenderer for automatic form rendering, FormRenderer.getMessageTranslator can be overriden to provide custom message translator that does not use properties files. |
I am using the FormRenderer class.
Maybe I don't understand something. What I would expect is that the attribute names would be extracted from the classes, at least to give a sane default. Maybe camelCases rewriten to "Camel Cases" label. As developer I don't want to do this manually for an XSD schema. |
You can see example of FormRenderer usage in https://github.com/beranradek/formio-demo/blob/master/src/main/java/net/formio/demo/forms/CarForm.java. Translation properties associated with Car object are: https://github.com/beranradek/formio-demo/blob/master/src/main/resources/net/formio/demo/domain/car/Car.properties (file corresponding to class name is taken by default, letter case is important, I assume). As I stated above, method FormRenderer.getMessageTranslator (or probably FormRenderer.renderMarkupFieldLabel) can be overriden (see the implementation of renderMarkupFieldLabel) if default usage of .properties file does not suit for you. |
I have set up a properties file to map between:
Is there any way that I could do for example programmatically instruct to render this in a better way than:
The text was updated successfully, but these errors were encountered: