--- loncom/localize/localize/mtarguments 2008/12/30 20:45:38 1.1 +++ loncom/localize/localize/mtarguments 2009/01/13 12:42:55 1.2 @@ -3,8 +3,8 @@ use strict; use warnings; -my $man = -"mtarguments - searches a single file or all files in a directory and its subdirectory for occurence of calls to the subroutine &mt. Arguments of &mt are written to the file newphrases.txt. In addition, arguments and locations where such calls appear are written to the file newphraseslocations.txt. +my $man = " +mtarguments - searches a single file or all files in a directory and its subdirectory for occurence of calls to the subroutine &mt. Arguments of &mt are appended to the file newphrases.txt. In addition, arguments and locations where such calls appear are written to the file newphraseslocations.txt. mtarguments is particularly useful for detecting new arguments to mt which consequently need to be translated for non-English users of loncapa. Detection of such arguments is most easily done by comparing newphrases.txt with an earlier version of this file via unix's diff. Detected new phrases can then be incorporated into localization files using sync.pl. @@ -36,6 +36,10 @@ if ( $ARGV[0] =~ m/^\s*-h/ ) { die "$files[0] is not a file.\n" unless -f $ARGV[0]; } + +# Start Analysis +print "mtarguments is searching...\n"; + # expression for nested parantheses my $rep; $rep = qr{ \( ((?: (?> [^()]+ ) | (??{ $rep }) )*) \) }x; @@ -70,18 +74,26 @@ sub find_mt_arguments{ } #write outputfiles -open(NP,'>','newphrases.txt'); +open(NP,'>>','newphrases.txt'); # Keep existing entries and append new phrases. synch.pl will care about entries which occur more than one time. open(NPL,'>','newphraseslocations.txt'); +my $counter=0; my $warnings=0; +my $exprNP=""; foreach my $expr (sort keys %mtArgInFile){ - print NP "$expr\n"; + $exprNP=$expr; + $exprNP=~s/^["'](.*)["']$/$1/; # Remove " and ' at beginning and end for newphrases.txt + print NP "$exprNP\n"; print NPL "$expr\n\tFOUND IN: $mtArgInFile{$expr}\n"; + $counter++; $warnings++ if($expr=~/\$|@|&/); } -close(NPL); close(NP); -print "Wrote newphrases.txt.\nWrote newphraseslocations.txt.\n"; -print "WARNING: Found $warnings case(s) where argument of &mt is a perl variable.\n" if $warnings; +print "Wrote newphrases.txt.\n"; +close(NPL); +print "Wrote newphraseslocations.txt.\n"; + +print "WARNING: Found $warnings case(s) where argument of &mt contains a perl variable.\n" if $warnings; +print "Found $counter new phrases.\n"; sub recursivefilelist { my ($currentpath) = @_; 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.