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

Einav Cohen ecohen at redhat.com
Thu Sep 11 13:04:23 UTC 2014


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. 

----
Regards, 
Einav



More information about the Devel mailing list