Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b251cc22

Von Sven Schöling vor mehr als 9 Jahren hinzugefügt

  • ID b251cc22f355941217493073e124ba3878d5530f
  • Vorgänger 15b1558e
  • Nachfolger cd306e61

Menüstruktur auf YAML geändert

Unterschiede anzeigen:

scripts/locales.pl
25 25
use List::MoreUtils qw(apply);
26 26
use List::Util qw(first);
27 27
use Pod::Usage;
28
use YAML ();
29
use YAML::Loader (); # YAML tries to load Y:L at runtime, but can't find it after we chdir'ed
28 30

  
29 31
$OUTPUT_AUTOFLUSH = 1;
30 32

  
......
41 43
my $locales_dir  = ".";
42 44
my $bindir       = "$basedir/bin/mozilla";
43 45
my @progdirs     = ( "$basedir/SL" );
44
my @menufiles    = <${basedir}/menus/*.ini>;
46
my @menufiles    = <"${basedir}/menus/*/*">;
45 47
my @javascript_dirs = ($basedir .'/js', $basedir .'/templates/webpages');
46 48
my $javascript_output_dir = $basedir .'/js';
47 49
my $submitsearch = qr/type\s*=\s*[\"\']?submit/i;
......
98 100
# put customized files into @customfiles
99 101
my %dir_h;
100 102

  
101
if ($opt_n) {
102
  @customfiles = ();
103
} else {
104
  tie %dir_h, 'IO::Dir', $basedir;
105
  push @menufiles, map { "$basedir/$_" } grep { /.*_menu.ini$/ } keys %dir_h;
106
}
107

  
108 103
my @dbplfiles;
109 104
foreach my $sub_dir ("Pg-upgrade2", "Pg-upgrade2-auth") {
110 105
  my $dir = "$basedir/sql/$sub_dir";
......
520 515
sub scanmenu {
521 516
  my $file = shift;
522 517

  
523
  my $fh = new FileHandle;
524
  open $fh, '<:encoding(utf8)', $file or die "$! : $file";
525

  
526
  my @a = grep m/^\[/, <$fh>;
527
  close($fh);
518
  print STDERR "trying to load file $file\n";
519
  my $menu = YAML::LoadFile($file);
528 520

  
529
  # strip []
530
  grep { s/(\[|\])//g } @a;
531

  
532
  foreach my $item (@a) {
533
    my @b = split /--/, $item;
534
    foreach my $string (@b) {
535
      chomp $string;
536
      $locale{$string}     = 1;
537
      $alllocales{$string} = 1;
538
    }
521
  for my $node (@$menu) {
522
    $locale{$node->{name}}     = 1;
523
    $alllocales{$node->{name}} = 1;
539 524
  }
540

  
541 525
}
542 526

  
543 527
sub unescape_template_string {
......
780 764

  
781 765
=head1 DESCRIPTION
782 766

  
783
This script collects strings from Perl files, the menu.ini file and
767
This script collects strings from Perl files, the menu files and
784 768
HTML templates and puts them into the file "all" for translation.
785 769

  
786 770
=cut

Auch abrufbar als: Unified diff