Files
recycled-ni-neutrino/data/locale/create-locals-update.pl
mrcolor bcecfb6585 our current experimental Neutrino branch
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@27 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: bc5bd4154e
Author: mrcolor <mrcolor@e54a6e83-5905-42d5-8d5c-058d10e6a962>
Date: 2009-12-08 (Tue, 08 Dec 2009)



------------------
This commit was generated by Migit
2009-12-08 11:05:11 +00:00

51 lines
1.4 KiB
Raku
Executable File

#! /usr/bin/perl
# This proggie takes a (possibly outdated) locale file as its (only)
# argument, and creates a new version, with `-work` appended. The thus
# created tile contains all keys of the master file, and is intended
# to, after manual editing, replace the outdated locale file.
# Written by Barf on 2005-12-10.
$masterfilename = "deutsch.locale";
$#ARGV == 0 || die("Usage: create-locals-update.pl file.locale.");
$no_errors = 0;
$last_was_ok = 1;
$localefilename = @ARGV[0];
$outfilename = $localefilename . "-work";
open(masterfile, $masterfilename) || die("Could not open master file");
open(localefile, $localefilename) || die("Could not open locale file");
open(outfile, ">" . $outfilename) || die("Could not open output file");
while (<masterfile>) {
$masterline = $_;
($masterkey) = /([^ ]+)/;
($junk, $mastertext) = /([^ ]+)[ ]+([^\n]+)/;
if ($last_was_ok) {
$localeline = <localefile>;
chop $localeline;
($localekey) = ($localeline =~ /([^ ]+)/,$localline);
($junk, $localetext) = ($localeline =~ /([^ ]+)[ ]+([^\n]+)/);
};
if ($masterkey eq $localekey) {
print outfile $localeline, "\n";
$last_was_ok = 1;
} else {
$no_errors++;
#print "|", $masterkey, "|", $mastertext, "|", $localekey, "|", $localetext, "|\n";
print outfile $masterkey, " TRANSLATE ", $mastertext, "\n";
$last_was_ok = 0;
}
}
close(outfile);
print "There were ", $no_errors, " error(s).\n";
if ($no_errors == 0) {
unlink($outfilename);
}