Aaltuj / VxFormGenerator

The library contains a component, that nests itself into the Blazor EditForm instead of a wrapper around the EditForm. The component is able to generate a form based on a POCO or a ExpandoObject. Because of this architecture the library provides the developer flexibility and direct usage of the EditForm.
MIT License
119 stars 36 forks source link

Add internationalization support #17

Closed Levvy055 closed 3 years ago

Levvy055 commented 3 years ago

The DisplayAttribute and other non-ValidationAttributes are not localised. It would be nice to have something to make it available.

Aaltuj commented 3 years ago

Hi @Levvy055 ,

I tested that the formgenerator works fine with translated DataAttributes and ValidationAttributes. Just add some resources, and follow this.

       [Display(ResourceType = typeof(Resources.Address), Name = nameof(Resources.Address.FIRSTNAME_LABEL))]
        // Add element to row 1 with automatic width based on number of items in a row
        [VxFormElementLayout(RowId = 1)]
        public string SurName { get; set; }
        [Display(Name = "Street")]
        // Add element to row 2 and set the width to 9 of 12 columns
        [VxFormElementLayout(RowId = 2, ColSpan = 9)]
        [MinLength(5, ErrorMessage = nameof(Resources.Address.FIRSTNAME_LABEL), ErrorMessageResourceType = typeof(Resources.Address))]
        public string Street { get; set; }

See image, where Firstname is translated to Voornaam in Dutch. image

if you have any other remark, please let me know

Aaltuj commented 3 years ago

I'm closing this, because there is no activity and the internationalization is not an issue related to the component (at this moment).