[MGNLFORM-50] i18n-problem with custom validation-error-messages Created: 24/Jun/10  Updated: 08/Feb/11  Resolved: 10/Nov/10

Status: Closed
Project: Magnolia Form Module
Component/s: None
Affects Version/s: 1.1.1
Fix Version/s: 1.2

Type: Improvement Priority: Major
Reporter: Hans Tobler Assignee: Ondrej Chytil
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File MGNLFORM-50.patch    
Issue Links:
relation
is related to MGNLFORM-79 Cannot (easily) provide custom error ... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

In the magnolia-form-module i did run into a i18n-Problem.
When you submit a mail and you have required fields which you did not fill out you get an error-Message, e.g.
<autor-defined error-message> Name: is required
'Name' is the field-name of the form-element
'is required' is the label "form.user.errorMessage.mandatory" from messages_en.properties-file

The Problem is that this message ('is required') which is displayed to the end-user is not translated to the languages (de, it, fr) we have on the website.
As a workaround I thought i could use our own messages-files by changing the attribute "i18nBasename" from the form-paragraph in the config.
But this does not work. The reason is that the message-file is hard-coded in info.magnolia.module.form.util.FormUtil.java to "info.magnolia.module.form.messages".
FormModel.addErrorMessage() uses FormUtil

Suggestion for improvement: The form-module code is changed so it is possible to use custom-defined-messages-files.



 Comments   
Comment by Tobias Mattsson [ 05/Nov/10 ]

Shouldn't we take the i18nbasename from the paragraph that is issuing the message? (And get rid of FormUtil completely)

Comment by Ondrej Chytil [ 08/Nov/10 ]

Reopened because error messages still not working properly.

Comment by Tobias Mattsson [ 09/Nov/10 ]

Ondrej, see the attached patch. I think this is how it should be solved. It uses the i18nbasename from the paragraph. Note that I haven't tested it.

Generated at Mon Feb 12 05:36:22 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.