[LANG-63] Page delete confirmation message in dialog is not correct processed Created: 21/Jun/16  Updated: 15/Feb/17  Resolved: 30/Nov/16

Status: Closed
Project: Language Bundles
Component/s: French, Italian
Affects Version/s: 1.0.7
Fix Version/s: 1.0.8

Type: Bug Priority: Neutral
Reporter: Frank Sommer Assignee: Hieu Nguyen Duc
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: 0d
Time Spent: 4d 1h
Original Estimate: 3d

Attachments: PNG File remove-dialog-french.png     PNG File remove-dialog-italian.png    
Issue Links:
Relates
relates to LANG-42 Correct i18n messages to be valid for... Closed
causality
duplicate
is duplicated by LANG-43 Fishy translation formatting for "con... 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)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Saigon 72
Story Points: 3

 Description   

The message in page delete confirmation dialog is not processed. The bug occurs at least for French and Italian users. German and English is fine. It is reproducible on Demoauthor instance.



 Comments   
Comment by Mercedes Iruela [ 22/Jun/16 ]

This error is produced due to characters are not been escaped properly (in this case the "'").
Actually, it should be a good idea to revise all the message bundle that we delivered in Magnolia in other to avoid this situation.

Comment by Viet Nguyen [ 14/Oct/16 ]

I am not very sure about the relationship between this ticket and SUPPORT-6742 however our messaging mechanism will need to be updated, remove some unnecessary escaping steps and include 1 decoration way (at least) for better user experience.

Comment by Hieu Nguyen Duc [ 08/Nov/16 ]

Root cause:
Confirmation message is formatted using MessageFormat but single quote is not represented correctly in resource bundle i.e. one single quote instead of two single quotes. This throws exception and logs in MessageFormatterUtils

WARN  nfo.magnolia.i18nsystem.util.MessageFormatterUtils: Inserting arguments into message '{0,choice,1#L'oggetto selezionato|1< {1} Gli oggetti selezionati} e tutti i {1,choice,1#suoi|1< loro} sotto-nodi saranno cancellati.' failed: 'Unmatched braces in the pattern.'.

MessageFormat docs say:

A single quote itself must be represented by doubled single quotes '' throughout a String

and

The rules for using quotes within message format patterns unfortunately have shown to be somewhat confusing. In particular, it isn't always obvious to localizers whether single quotes need to be doubled or not. Make sure to inform localizers about the rules, and tell them (for example, by using comments in resource bundle source files) which strings will be processed by MessageFormat. Note that localizers may need to use single quotes in translated strings where the original version doesn't have them.

Possible solution:
Fix the language bundles:
+ Appropriately represent a single quote by two single quotes for message resources that use patterns

For example:

{0,choice,1#l'objet|1< {1} les objets} et tous {1,choice,1#ses|1< leurs} sous-nœuds seront supprimés.

should be fixed into

{0,choice,1#l''objet|1< {1} les objets} et tous {1,choice,1#ses|1< leurs} sous-nœuds seront supprimés.
Comment by Hieu Nguyen Duc [ 09/Nov/16 ]

Bundled messages could be formatted using MessageFormatterUtils#format or not.
+ If yes, a single quote should be represented as two ones
+ If no, a single quote is enough

Another solution is we may double single quotes before MessageFormat#format and notify people not to put two quotes in message bundles.

Comment by Mikaël Geljić [ 22/Nov/16 ]

hieu.nguyen Check out the outcome of the discussion in linked page I18n Translations vs. MessageFormat.

  • Here we implement the SimpleTranslator lookup for keys suffixed with .formatted, and fallback on requested key.
  • We clean our own translations with application of this suffix and doubling of single-quotes (Use LANG-42, Close LANG-43)

Let's prepare this on a branch, we are yet to confirm how we approach compatibility.

Comment by Mikaël Geljić [ 30/Nov/16 ]

Thanks for the branch. Actually here the issue was slightly different, because MessageFormat is applied "manually" in ConfirmationAction, after translation is fetched via definition. In other words, suffixing is not an option. As translators should still know which keys go into MessageFormat and which don't, we will consider complementary options (could as well be to annotate/comment properties files where appropriate).

Meanwhile the ticket moves to LANG and we fix those messages by doubling the single-quotes, as mandated by the MessageFormat syntax.

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