Use Unicode single quotes ‘’ in place of short single quoted strings throughout.

Only in end-user messages and documentation.  This change was done
mostly mechanically using the Perl script attached below.

I also changed don't -> don’t etc and made some other simple fixes.

See also: https://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

----------
 #!/usr/bin/perl -w

use strict;
use Locale::PO;

my $re = qr{'([-\w%.,=?*/]+)'};

my %files = ();

foreach my $filename ("po/libguestfs.pot", "po-docs/libguestfs-docs.pot") {
    my $poref = Locale::PO->load_file_asarray($filename);

    foreach my $po (@$poref) {
        if ($po->msgid =~ $re) {
            my @refs = split /\s+/, $po->reference;
            foreach my $ref (@refs) {
                my ($file, $lineno) = split /:/, $ref, 2;
                $file =~ s{^\.\./}{};
                if (exists $files{$file}) {
                    push @{$files{$file}}, $lineno;
                } else {
                    $files{$file} = [$lineno];
                }
            }
        }
    }
}

foreach my $file (sort keys %files) {
    unless (-w $file) {
        warn "warning: $file is probably generated\n"; # have to edit generator
        next;
    }
    my @lines = sort { $a <=> $b } @{$files{$file}};

    #print "editing $file at lines ", join (", ", @lines), " ...\n";
    open FILE, "<$file" or die "$file: $!";
    my @all = ();
    push @all, $_ while <FILE>;
    close FILE;

    my $ext = $file;
    $ext =~ s/^.*\.//;

    foreach (@lines) {
        # Don't mess with verbatim sections in POD files.
        next if $ext eq "pod" && $all[$_-1] =~ m/^ /;

        unless ($all[$_-1] =~ $re) {
            # this can happen for multi-line strings, have to edit it
            # by hand
            warn "warning: $file:$_ does not contain expected content\n";
            next;
        }
        $all[$_-1] =~ s/$re/‘$1’/g;
    }

    rename "$file", "$file.bak";
    open FILE, ">$file" or die "$file: $!";
    print FILE $_ for @all;
    close FILE;
    my $mode = (stat ("$file.bak"))[2];
    chmod ($mode & 0777, "$file");
}
This commit is contained in:
Richard W.M. Jones
2017-04-04 14:37:56 +01:00
parent cc162b49e6
commit ee206d7ba8
112 changed files with 393 additions and 390 deletions

View File

@@ -49,7 +49,7 @@ For a libvirt guest called "Guest" you could do:
guestmount -d Guest -i --ro /mnt
If you don't know what filesystems are contained in a guest or
If you dont know what filesystems are contained in a guest or
disk image, use L<virt-filesystems(1)> first:
virt-filesystems -d MyGuest
@@ -281,7 +281,7 @@ or if libguestfs misidentifies a filesystem.
=item B<--no-fork>
Don't daemonize (or fork into the background).
Dont daemonize (or fork into the background).
=item B<-n>

View File

@@ -117,13 +117,13 @@ main (int argc, char *argv[])
display_short_options (options);
else if (STREQ (long_options[option_index].name, "fd")) {
if (sscanf (optarg, "%d", &fd) != 1 || fd < 0)
error (EXIT_FAILURE, 0, _("cannot parse fd option '%s'"), optarg);
error (EXIT_FAILURE, 0, _("cannot parse fd option %s"), optarg);
} else if (STREQ (long_options[option_index].name, "no-retry")) {
retries = 0;
} else if (STREQ (long_options[option_index].name, "retry")) {
if (sscanf (optarg, "%zu", &retries) != 1 || retries >= 64)
error (EXIT_FAILURE, 0,
_("cannot parse retries option or value is too large '%s'"),
_("cannot parse retries option or value is too large %s"),
optarg);
} else
error (EXIT_FAILURE, 0,

View File

@@ -84,7 +84,7 @@ Display brief help and exit.
=item B<--quiet>
Don't display error messages from fusermount. The return status is
Dont display error messages from fusermount. The return status is
still set (see L</EXIT STATUS> below).
=item B<--no-retry>