File: mergelocale.pl

package info (click to toggle)
mrtg 2.9.17-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,140 kB
  • ctags: 1,517
  • sloc: perl: 22,688; ansic: 3,536; sh: 1,309; makefile: 319; php: 227; awk: 213; csh: 49; exp: 16
file content (52 lines) | stat: -rwxr-xr-x 1,043 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl
#
# usage: ./mergelocale.pl skeleton.pm0 lang1.pmd lang2.pmd
# the script then creates locales_mrtg.pm
#
# If you want to modify a locale, modify the pmd file and rerun 
# this script and copy the generated locales_mrtg.pm to the run directory.
#
# If you want to translate a locale, copy one of the existing locales and 
# translate. Then rerun and copy. 
#
#################################################################
#
# Distributed under the GNU copyleft
#
###################################################################

open(OUTFILE,"> locales_mrtg.pm");

@patchdb=(
'PATCHTAG\s*00',
'PATCHTAG\s*10',
'PATCHTAG\s*20',
'PATCHTAG\s*30',
'PATCHTAG\s*40',
'PATCHTAG\s*50',
'PATCHTAG\s*60',
);

while(@ARGV){
  push(@languages,shift);
};

foreach $patchtag (@patchdb)
{
  for $i (@languages)
  {
    open(LANGF,"< $i");
    $patch="";
    while(<LANGF>)
    {
      if(/\#.\S*PATCHTAG/)
      { 
        $patch=/$patchtag/;
      }
      else
      {
        if($patch) { print OUTFILE $_; };
      };
    };
  };
};