[ovirt-devel] [ATTN] Changing messages with variable placeholders

Einav Cohen ecohen at redhat.com
Thu Sep 11 13:31:32 UTC 2014


> ----- Original Message -----
> From: "Yedidyah Bar David" <didi at redhat.com>
> Sent: Thursday, September 11, 2014 9:12:32 AM
> 
> ----- Original Message -----
> > From: "Einav Cohen" <ecohen at redhat.com>
> > To: devel at ovirt.org
> > Sent: Thursday, September 11, 2014 4:04:23 PM
> > Subject: [ovirt-devel] [ATTN] Changing messages with variable placeholders
> > 
> > all,
> > 
> > in general, changing non-English messages in the code is forbidden,
> > as these are pulled automatically from the translation management
> > system (Zanata).
> >  
> > HOWEVER: changing non-English messages in the code is *a must*
> > in case not doing so will result in maven build failure.
> > 
> > this can happen when changing the quantity of variable placeholders
> > in localized messages.
> > 
> > example:
> > 
> > let's say that I have an English message:
> > "xxx {0} yyy {1}"
> > and the parallel non-English messages are:
> > "aaa {0} bbb {1}", "ccc ddd {0} {1}", "{1} eee fff {0}", etc.
> > 
> > If I am changing the English message to be:
> > "xxx {0}"
> > but leaving the parallel non-English messages as is:
> > "aaa {0} bbb {1}", "ccc ddd {0} {1}", "eee {1} fff {0}", etc.
> > 
> > now the messages for the same key in different locales have
> > different amounts of variable placeholders in them.
> > this would result in a mvn build error.
> > 
> > ** so whenever changing the quantity of variable placeholders in
> > an English message, you must change the parallel non-English
> > messages to match the new variable placeholders quantity. **
> > 
> > in the example above: the "{1}" placeholder (that was removed
> > from the English message) should be removed from the non-English
> > messages, so that the updated non-English messages would be:
> > "aaa {0} bbb", "ccc ddd {0}", "eee fff {0}", etc.
> > 
> > you don't need to worry about the correctness of the non-English
> > messages that you are changing; this will be taken care of in the
> > translation cycle that will follow your patch. you just need to
> > do the minimal changes necessary (remove placeholders / append
> > placeholders) so that build errors will not occur.
> > 
> > NOTE: this can be very easily missed, as this type of build error
> > will occur only when building the project with non-English locales
> > (e.g. with the "BUILD_LOCALES=1" parameter within the "make"
> > command in a devel env).
> > So please - pay extra attention when making this kind of messages
> > changes; if in doubt - build with "BUILD_LOCALES=1" and/or ask.
> > 
> > Let me know if you have any questions.
> > 
> > Many thanks in advance.
> 
> If the fix is really so simple, can't it be automated?

not sure exactly what you mean: automated how? once the developer 
changes an English message, when will the automatic change of the 
non-English messages occur? upon saving the English file? 
pre-compilation? and the developer still needs to be aware that 
non-English message files have been changes, so he won't forget 
to include them in the patch?...
in any case: everyone are more than welcome to send patches for 
an automated solution, if there is any; until then - need to pay 
attention. thanks. 

> --
> Didi
> 



More information about the Devel mailing list