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

@@ -122,12 +122,12 @@ usage (int status)
" %s [--options] cmd [: cmd : cmd ...]\n"
"Options:\n"
" -h|--cmd-help List available commands\n"
" -h|--cmd-help cmd Display detailed help on 'cmd'\n"
" -h|--cmd-help cmd Display detailed help on cmd\n"
" -a|--add image Add image\n"
" -c|--connect uri Specify libvirt URI for -d option\n"
" --csh Make --listen csh-compatible\n"
" -d|--domain guest Add disks from libvirt guest\n"
" --echo-keys Don't turn off echo for passphrases\n"
" --echo-keys Dont turn off echo for passphrases\n"
" -f|--file file Read commands from file\n"
" --format[=raw|..] Force disk format for -a option\n"
" --help Display brief help\n"
@@ -140,8 +140,8 @@ usage (int status)
" --network Enable network\n"
" -N|--new [filename=]type\n"
" Create prepared disk (test<N>.img or filename)\n"
" -n|--no-sync Don't autosync\n"
" --no-dest-paths Don't tab-complete paths from guest fs\n"
" -n|--no-sync Dont autosync\n"
" --no-dest-paths Dont tab-complete paths from guest fs\n"
" --pipe-error Pipe commands can detect write errors\n"
" --progress-bars Enable progress bars even when not interactive\n"
" --no-progress-bars Disable progress bars\n"
@@ -158,8 +158,10 @@ usage (int status)
"or\n"
" %s [--ro|--rw] -i -d name-of-libvirt-domain\n"
"\n"
"--ro recommended to avoid any writes to the disk image. If -i option fails\n"
"run again without -i and use 'run' + 'list-filesystems' + 'mount' cmds.\n"
"--ro is recommended to avoid any writes to the disk image.\n"
"\n"
"If -i option fails run again without -i and use run +\n"
"list-filesystems + mount cmds.\n"
"\n"
"For more information, see the manpage %s(1).\n"),
getprogname (), getprogname (),
@@ -683,9 +685,9 @@ script (int prompt)
"Welcome to guestfish, the guest filesystem shell for\n"
"editing virtual machine filesystems and disk images.\n"
"\n"
"Type: 'help' for help on commands\n"
" 'man' to read the manual\n"
" 'quit' to quit the shell\n"
"Type: help for help on commands\n"
" man to read the manual\n"
" quit to quit the shell\n"
"\n"));
if (inspector) {
@@ -893,7 +895,7 @@ parse_command_line (char *buf, int *exit_on_error_rtn)
} else
pend = &p[len];
} else {
fprintf (stderr, _("%s: internal error parsing string at '%s'\n"),
fprintf (stderr, _("%s: internal error parsing string at %s\n"),
getprogname (), p);
abort ();
}