[Engine-devel] Localization of canDoAction error messages

Martin Sivak msivak at redhat.com
Wed Oct 16 15:46:42 UTC 2013


Hi Einav,

I know about this procedure, but if you check closely what I am doing, I need to print a list of messages at once where each has a different content.

Something like this (again the strings are just an illustration):

------------- Error ----------------------
The VM net-A could not be started because
there was no fitting host available.

Host host-A failed constraint memory
Host host-B failed constraint cpu load
Host host-C failed constraint memory
------------------------------------------

I am pretty sure the replacing we have in VdcBllMessages does not support this as it cannot assign two or more different values to the same variable. 

--
Martin Sivák
msivak at redhat.com
Red Hat Czech
RHEV-M SLA / Brno, CZ

----- Original Message -----
> Hi Martin, please follow instructions in [1] for adding new messages to the
> system.
> [you should not add the English message to the canDoActionMessages collection
> - you
> should add a key from the AppErrors resource - look for other examples in the
> code
> that add items to a command's canDoActionMessages field]
> 
> ----
> Thanks,
> Einav
> 
> [1] http://www.ovirt.org/Engine_Adding_Messages
> 
> ----- Original Message -----
> > From: "Martin Sivak" <msivak at redhat.com>
> > To: "engine-devel" <engine-devel at ovirt.org>
> > Sent: Wednesday, October 16, 2013 11:22:02 AM
> > Subject: [Engine-devel] Localization of canDoAction error messages
> > 
> > Hi,
> > 
> > I am trying to improve the messages the user gets when scheduling fails.
> > But
> > I have found an interesting issue regarding localization. The texts here
> > are
> > simplified, but should demonstrate what I am trying to do.
> > 
> > So here is the flow:
> > 
> > - RunVmCommand's canDoAction fails because there is no host that fits the
> > constraints
> > - For each host I add a message to
> > getReturnValue().getCanDoActionMessages()
> > in the format of "Host XYZ failed constraint ABCD".
> > - I log the same message to the log
> > 
> > I expect the log to contain the strings in english and a localized version
> > to
> > be shown in the error popup that will be displayed by the webadmin.
> > 
> > And the question is.. how do I localize this? I looked at AppErrors and
> > AppMessages, but there is not way of using them from the backend side.
> > 
> > Any ideas?
> > 
> > --
> > Martin Sivák
> > msivak at redhat.com
> > Red Hat Czech
> > RHEV-M SLA / Brno, CZ
> > 
> > _______________________________________________
> > Engine-devel mailing list
> > Engine-devel at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/engine-devel
> > 
> > 
> >
> 



More information about the Engine-devel mailing list