mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 08:23:12 +01:00
68 lines
2.0 KiB
Plaintext
Executable File
68 lines
2.0 KiB
Plaintext
Executable File
#!/usr/bin/perl
|
|
#**************************************************************************#
|
|
# phpGroupWare #
|
|
# http://www.phpgroupware.org #
|
|
# -------------------------------------------- #
|
|
# This program is free software; you can redistribute it and/or modify it #
|
|
# under the terms of the GNU General Public License as published by the #
|
|
# Free Software Foundation; either version 2 of the License, or (at your #
|
|
# option) any later version. #
|
|
#**************************************************************************#
|
|
|
|
# $Id$ #
|
|
|
|
# sqltolang.pl (c) 2001 Miles Lott
|
|
# Take a file of sql commands for lang, create lang files from it
|
|
# Requires perl and the source sql file.
|
|
# May only work in bash also. Makes system calls to mkdir and cat.
|
|
# Takes one arg, the sql filename
|
|
|
|
# Adjust to taste, this is not intended to be perfect
|
|
|
|
sub trim
|
|
{
|
|
my @out = @_;
|
|
for (@out)
|
|
{
|
|
s/^\s+//;
|
|
s/\s+$//;
|
|
}
|
|
return wantarray ? @out : $out[0];
|
|
}
|
|
|
|
print "Working on: " . $ARGV[0] . "\n";
|
|
open(FILE,$ARGV[0]);
|
|
while (<FILE>)
|
|
{
|
|
# INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'common items','eldaptir','de','Common Items');
|
|
chomp $_;
|
|
if (/DELETE/)
|
|
{
|
|
next;
|
|
}
|
|
$line = $_;
|
|
$line =~ s/REPLACE INTO lang \(//g;
|
|
$line =~ s/INSERT INTO lang \(//g;
|
|
$line =~ s/VALUES\( \'//g;
|
|
$line =~ s/message_id\,//g;
|
|
$line =~ s/app_name,//g;
|
|
$line =~ s/lang,//g;
|
|
$line =~ s/content\)//g;
|
|
$line =~ s/','/\t/g;
|
|
$line =~ s/'\);//g;
|
|
|
|
($key,$appname,$lang,$content) = split("\t",$line);
|
|
$key = &trim($key);
|
|
$appname = &trim($appname);
|
|
$lang = &trim($lang);
|
|
$content = &trim($content);
|
|
|
|
if ($lang ne '')
|
|
{
|
|
$newline = $key . "\t" . $appname . "\t" . $lang . "\t" . $content;
|
|
my $cmd = 'echo "'. $newline . '" >> phpgw_' . $lang . ".lang";
|
|
system($cmd);
|
|
}
|
|
}
|
|
close(FILE);
|