Hi Andrew

Thank you, but it hangs forever and nothing happens.


Il giorno sab 22 apr 2017 alle 5:37, Andrew Bernard <andrew.bern...@gmail.com> ha scritto:
Hi Federico,

I believe you are trying to automate a set of translations, correct? If so, here's a way to do it in perl that avoids all the shell convolutions. I assume you do know perl. If not, always worth knowing for this sort of quick work.

Just add the translations to the hash table in the script. The virtue of this small tool is that it will tell you if you missed any.

Reads file from stdin. Outputs to stdout. You can figure how to process the whole directory. There's a hundred ways to do this. Some people like to open all the files in the perl script. I prefer to keep it simple.

Hope this may be useful for now and in the future.


Andrew

== snip

#!/usr/bin/perl

use strict;
use warnings;

my @ref;

# translation table
my %translations = (
    'Automatic beams' => 'Automatic Beams in Italian',
    'Stems' => 'Stems in Italian',
    );

while (<>) {
    if (@ref = /\@ref\{(.+)\}/) {
    if (exists $translations{$ref[0]}) {
        s/$ref[0]/$translations{$ref[0]}/;
    }
    else {
        print STDERR "no translation for $ref[0]", "\n";
    }
    }
    print;
}

== snip



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to