On 4/11/19 6:58 AM, Daniel P. Berrangé wrote:
On Mon, Apr 08, 2019 at 11:48:19AM -0400, Cole Robinson wrote:
> Add string labels to all VIR_ENUM_IMPL calls, which will be used
> to eventually raise errors from virEnum*String functions.
>
> I roughly tried to follow these rules:
>
> 1) If it's an internal only enum, try to uniquely describe it
> 2) If it's for user XML values, make the label match the XML value
> names, defaulting to '$elementname $attrname'. For example,
> virDomainVirtType gets 'domain type' because it maps to the
> <domain type=X> attribute.
> 3) If #2 is too ambiguous like for similar XML but for different
> devices, insert the device name too.
>
> Not everything fits cleanly though
>
> Note: this patch will be combined with the previous patch when pushing
>
> Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
> diff --git a/src/access/viraccessperm.c b/src/access/viraccessperm.c
> index 67f751ef9c..1772eea287 100644
> --- a/src/access/viraccessperm.c
> +++ b/src/access/viraccessperm.c
> @@ -23,7 +23,7 @@
> #include "viraccessperm.h"
>
>
> -VIR_ENUM_IMPL(virAccessPermConnect,
> +VIR_ENUM_IMPL(virAccessPermConnect, "access connect",
So it has saved translater time by not translating any of the
strings here.
The vast majority of these strings should not be translated IMO because
they are referencing specific XML names which are always in english.
virDomainVirtTypeToString will raise
invalid argument: Unknown 'domain type' value 'zzzz'
'domain type' here is referring to <domain type=X> XML, so IMO it's
correct not to translate.
I don't think this access/ case should be translated either. 'access' is
the specific prefix we use for access control config (access_* in
libvirtd), and 'connect' is specifically referencing access control for
virConnectPtr objects and that's the string we use in at least the
polkit namespace (ex: org.libvirt.api.connect.getattr).
- Cole