Re: [PATCH v2] virsh-edit: Make force editing usable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 19, 2015 at 01:16:07PM -0700, Eric Blake wrote:
On 02/19/2015 12:26 PM, John Ferlan wrote:


On 02/19/2015 11:24 AM, Martin Kletzander wrote:
When editing a domain with 'virsh edit' and failing validation, the
usual message pops up:

  Failed. Try again? [y,n,f,?]:

Turning of validation can be ussable, mainly for testing (but other

s/of/off
s/ussable/useful

purposes too), so this patch adds support for relaxing definition in
virsh-edit and makes 'virsh edit <domain>' more usable.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
v2:
 - make a special case 'v' for turning off validation

Another choice 'i' "ignore validation" - only because when I see -v I
think "verbose" or "version" (just like -h is help)

I like the idea of 'i' instead of 'v' as well.


     while (true) {
         /* TRANSLATORS: For now, we aren't using LC_MESSAGES, and the user
-         * choices really are limited to just 'y', 'n', 'f' and '?'  */
-        vshPrint(ctl, "\r%s %s", msg, _("Try again? [y,n,f,?]:"));
+         * choices really are limited to just 'y', 'n', 'v', 'f' and '?'  */
+        vshPrint(ctl, _("\r%s Try again? %s: "), msg,
+                 relax_avail ? "[y,n,v,f,?]" : "[y,n,f,?]");

That doesn't translate very well.  You must NOT put \r in the string
marked for translation ('make dist' will spit out LOTS of these warnings):

libvirt.pot:30827: warning: internationalized messages should not
contain the '\r' escape sequence

Also, ?: can confuse xgettext, which in turn makes the .pot file harder
for translators to see.  Pre-patch, the .pot file has:

#. TRANSLATORS: For now, we aren't using LC_MESSAGES, and the user
#. * choices really are limited to just 'y', 'n', 'f' and '?'
#: tools/virsh.c:536
msgid "Try again? [y,n,f,?]:"
msgstr ""

post-patch, the .pot file would have:

#. TRANSLATORS: For now, we aren't using LC_MESSAGES, and the user
#. * choices really are limited to just 'y', 'n', 'v', 'f' and '?'
#: tools/virsh.c:536
#, c-format
msgid "\r%s Try again? %s: "
msgstr ""

but NO mention of a [y,n,...] string, which makes the comment weird.
But since the whole point of the comment was that we AREN'T allowing
translated option letters (for example, a Spanish user must still type
'y', rather than 's' for "si"), there's no need to translate the
options, and therefore no need for the comment.  So you should drop the
comment, and just use:

     vshPrint(ctl, "\r%s %s %s: ", msg, _("Try again?"),
              relax_avail ? "[y,n,v,f,?]" : "[y,n,f,?]");

(with 'i' instead of 'v' if we go that route)


I had no idea that comments before marked translations go to the .pot
file, that's great.  What I wanted to achieve is pretty much what you
wrote and for the same reason -- not allowing translators to change
the characters. "\r%s %s %s: " is definitely way better, I should've
thought about making translator lives easier ;)

And according to others, 'i' is more likeable, or at least it looks
like it.  v3 coming up.

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: pgp6gq96gdUDm.pgp
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]