Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ed2d834f

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

  • ID ed2d834fc7af75f23fbcbd5fbbb36b2cf5b8590f
  • Vorgänger 9c5ae7ed
  • Nachfolger 8b3bec89

locales.pl: update auf mobile_webpages

Unterschiede anzeigen:

scripts/locales.pl
43 43
my $bindir       = "$basedir/bin/mozilla";
44 44
my @progdirs     = ( "$basedir/SL" );
45 45
my @menufiles    = glob("${basedir}/menus/*/*");
46
my @javascript_dirs = ($basedir .'/js', $basedir .'/templates/webpages');
46
my @javascript_dirs = ($basedir .'/js', $basedir .'/templates/webpages', $basedir .'/templates/mobile_webpages');
47 47
my $javascript_output_dir = $basedir .'/js';
48 48
my $submitsearch = qr/type\s*=\s*[\"\']?submit/i;
49 49
our $self        = {};
......
434 434

  
435 435
      # is this a template call?
436 436
      if (/(?:parse_html_template2?|render)\s*\(\s*[\"\']([\w\/]+)\s*[\"\']/) {
437
        my $new_file_base = "$basedir/templates/webpages/$1.";
437
        my $new_file_name = $1;
438 438
        if (/parse_html_template2/) {
439
          print "E: " . strip_base($file) . " is still using 'parse_html_template2' for " . strip_base("${new_file_base}html") . ".\n";
439
          print "E: " . strip_base($file) . " is still using 'parse_html_template2' for $new_file_name.html.\n";
440 440
        }
441 441

  
442 442
        my $found_one = 0;
443
        foreach my $ext (qw(html js json)) {
444
          my $new_file = "${new_file_base}${ext}";
445
          if (-f $new_file) {
446
            $cached{$file}{scanh}{$new_file} = 1;
447
            print "." if $opt_v;
448
            $found_one = 1;
443
        for my $space (qw(webpages mobile_webpages)) {
444
          for my $ext (qw(html js json)) {
445
            my $new_file = "$basedir/templates/$space/$new_file_name.$ext";
446
            if (-f $new_file) {
447
              $cached{$file}{scanh}{$new_file} = 1;
448
              print "." if $opt_v;
449
              $found_one = 1;
450
            }
449 451
          }
450 452
        }
451 453

  
452 454
        if ($opt_c && !$found_one) {
453
          print "W: missing HTML template: " . strip_base($new_file_base) . "{html,json,js} (referenced from " . strip_base($file) . ")\n";
455
          print "W: missing HTML template: $new_file_name.{html,json,js} (referenced from " . strip_base($file) . ")\n";
454 456
        }
455 457
      }
456 458

  
......
567 569
}
568 570

  
569 571
sub scanhtmlfile {
570
  local *IN;
571

  
572
  my $file = shift;
572
  my ($file) = @_;
573 573

  
574 574
  return if defined $cached{$file};
575 575

  
576
  my $template_space = $file =~ m{templates/(\w+)/} ? $1 : 'webpages';
577

  
576 578
  my %plugins = ( 'loaded' => { }, 'needed' => { } );
577 579

  
578
  if (!open(IN, '<:encoding(utf8)', $file)) {
580
  my $fh;
581
  if (!open($fh, '<:encoding(utf8)', $file)) {
579 582
    print "E: template file '$file' not found\n";
580 583
    return;
581 584
  }
......
583 586
  my $copying  = 0;
584 587
  my $issubmit = 0;
585 588
  my $text     = "";
586
  while (my $line = <IN>) {
589
  while (my $line = <$fh>) {
587 590
    chomp($line);
588 591

  
589 592
    while ($line =~ m/\[\%[^\w]*use[^\w]+(\w+)[^\w]*?\%\]/gi) {
......
643 646
                      ([^\s]+)      # Beliebig viele Nicht-Whitespaces -- Dateiname
644 647
                      \.(html|js)   # Endung ".html" oder ".js", ansonsten kann es der Name eines Blocks sein
645 648
                     /ix) {
646
      my $new_file_name = "$basedir/templates/webpages/$1.$2";
649
      my $new_file_name = "$basedir/templates/$template_space/$1.$2";
647 650
      $cached{$file}{scanh}{$new_file_name} = 1;
648 651
      substr $line, $LAST_MATCH_START[1], $LAST_MATCH_END[0] - $LAST_MATCH_START[0], '';
649 652
    }
650 653
  }
651 654

  
652
  close(IN);
655
  close($fh);
653 656

  
654 657
  foreach my $plugin (keys %{ $plugins{needed} }) {
655 658
    next if ($plugins{loaded}->{$plugin});
......
692 695
  close($fh);
693 696
}
694 697
sub search_unused_htmlfiles {
695
  my @unscanned_dirs = ('../../templates/webpages');
698
  my @unscanned_dirs = ('../../templates/webpages', '../../templates/mobile_webpages');
696 699

  
697 700
  while (scalar @unscanned_dirs) {
698 701
    my $dir = shift @unscanned_dirs;
......
713 716
  my $s =  "$_[0]";             # Create a copy of the string.
714 717

  
715 718
  $s    =~ s|^../../||;
716
  $s    =~ s|templates/webpages/||;
719
  $s    =~ s|templates/\w+/||;
717 720

  
718 721
  return $s;
719 722
}

Auch abrufbar als: Unified diff