locale: move scripts to subdir 'helpers/'

Origin commit data
------------------
Branch: ni/coolstream
Commit: f0bfe2167c
Author: vanhofen <vanhofen@gmx.de>
Date: 2012-10-24 (Wed, 24 Oct 2012)

Origin message was:
------------------
- locale: move scripts to subdir 'helpers/'

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2012-10-24 15:45:57 +02:00
parent 8d82a008c7
commit 8f54d552d3
6 changed files with 7 additions and 7 deletions

View File

@@ -0,0 +1,50 @@
#! /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 = "english.locale";
$#ARGV == 0 || die("Usage: create-locals-work 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);
}