X-Git-Url: https://git.treefish.org/fex.git/blobdiff_plain/7fa382617fbaccc0ce522b2b3adbbee9db5ad227..cdeb354c4dbb11b683f9f8c5db2861f3dc572c61:/locale/translate?ds=sidebyside diff --git a/locale/translate b/locale/translate index 041f4b7..8d581ec 100755 --- a/locale/translate +++ b/locale/translate @@ -34,6 +34,8 @@ use File::Copy; $> = $FEX[2]; $) = $FEX[3]; +umask 022; + $FEXHOME = $ENV{FEXHOME} || $FEX[7]; # require "$FEXHOME/lib/fex.pp" @@ -101,43 +103,47 @@ foreach $file (@trfiles) { print "$ft written\n"; } -foreach $file (@cpfiles) { - my $fs = "locale/$lang/$file"; - if (-e $fs) { - my $fd = "$FEXHOME/$fs"; - mkdirp(dirname($fd)); - if (-f $fs) { - $fd .= '_new' if -e $fd; - if (copy($fs,$fd)) { - chmod((stat $fs)[2],$fd); - print "$fd written\n"; - } - } else { - if (-f $fd) { - my $fds = $fd.'_save'; - my $fdn = $fd.'_new'; - system "rm -rf $fds $fdn"; - rename $fd,$fds; - system "tar cf - $fs | (cd $FEXHOME; tar xf -)"; - rename $fd,$fdn; - rename $fds,$fd; - print "$fdn written\n"; +if ($FEXHOME !~ /fexdev/) { + + foreach $file (@cpfiles) { + my $fs = "locale/$lang/$file"; + if (-e $fs) { + my $fd = "$FEXHOME/$fs"; + mkdirp(dirname($fd)); + if (-f $fs) { + $fd .= '_new' if -e $fd; + if (copy($fs,$fd)) { + chmod((stat $fs)[2],$fd); + print "$fd written\n"; + } } else { - system "tar cf - $fs | (cd $FEXHOME; tar xf -)"; - print "$fd written\n"; + if (-f $fd) { + my $fds = $fd.'_save'; + my $fdn = $fd.'_new'; + system "rm -rf $fds $fdn"; + rename $fd,$fds; + system "tar cf - $fs | (cd $FEXHOME; tar xf -)"; + rename $fd,$fdn; + rename $fds,$fd; + print "$fdn written\n"; + } else { + system "tar cf - $fs | (cd $FEXHOME; tar xf -)"; + print "$fd written\n"; + } } } } -} -foreach $fs (qw(fex.ph dop)) { - $fd = "$FEXHOME/locale/$lang/lib/$fs"; - symlink "../../../lib/$fs",$fd and print "$fd linked\n"; -} + foreach $fs (qw(fex.ph dop)) { + $fd = "$FEXHOME/locale/$lang/lib/$fs"; + symlink "../../../lib/$fs",$fd and print "$fd linked\n"; + } + + unless (-f "$FEXHOME/locale/$lang/htdocs/FAQ/meta.faq") { + unlink "$FEXHOME/locale/$lang/htdocs/FAQ/FAQ.html"; + rmdir "$FEXHOME/locale/$lang/htdocs/FAQ"; + } -unless (-f "$FEXHOME/locale/$lang/htdocs/FAQ/meta.faq") { - unlink "$FEXHOME/locale/$lang/htdocs/FAQ/FAQ.html"; - rmdir "$FEXHOME/locale/$lang/htdocs/FAQ"; } make_lf($lang); @@ -157,7 +163,7 @@ sub make_lf { print {$lf} "### auto-generated by install/translate - DO NOT EDIT! ###\n\n"; local $/; $_ = <$fexpp>; - s/.*\n(\#\#\# locale functions)/$1/s; + s/.*\n(\#\#\#* locale functions)/$1/s; s/\nsub (\w+)/\n\$$1\{$lang\} = sub/gs; s/\n\}\n/\n\};\n/gs; print {$lf} $_;