eb.
summaryrefslogtreecommitdiff
path: root/locale/cn_utf/locales.pl
blob: cc8d2be7669a68a3eb99d88ac65f449432be0325 (plain)
  1. #!/usr/bin/perl
  2. # -n do not include custom_ scripts
  3. # -a build all file
  4. # -m do not generate missing files
  5. use FileHandle;
  6. $basedir = "../..";
  7. $bindir = "$basedir/bin/mozilla";
  8. $menufile = "menu.ini";
  9. foreach $item (@ARGV) {
  10. $item =~ s/-//g;
  11. $arg{$item} = 1;
  12. }
  13. open(FH, "LANGUAGE");
  14. $language = <FH>;
  15. close(FH);
  16. chomp $language;
  17. $language =~ s/\((.*)\)/$1/;
  18. $charset = $1;
  19. opendir DIR, "$bindir" or die "$!";
  20. @progfiles = grep { /\.pl/; !/(_|^\.)/ } readdir DIR;
  21. seekdir DIR, 0;
  22. @customfiles = grep /_/, readdir DIR;
  23. closedir DIR;
  24. # put customized files into @customfiles
  25. @customfiles = () if ($arg{n});
  26. if ($arg{n}) {
  27. @menufiles = ($menufile);
  28. } else {
  29. opendir DIR, "$basedir" or die "$!";
  30. @menufiles = grep { /.*?_$menufile$/ } readdir DIR;
  31. closedir DIR;
  32. unshift @menufiles, $menufile;
  33. }
  34. if (-f "all") {
  35. eval { require "all"; };
  36. %all = %{$self{texts}};
  37. %{$self{texts}} = ();
  38. } else {
  39. # build %all file from individual files
  40. foreach $file (@progfiles) {
  41. &scanfile("$bindir/$file");
  42. }
  43. }
  44. # remove the old missing file
  45. if (-f 'missing') {
  46. unlink "missing";
  47. }
  48. foreach $file (@progfiles) {
  49. %locale = ();
  50. %submit = ();
  51. %subrt = ();
  52. @missing = ();
  53. %missing = ();
  54. &scanfile("$bindir/$file");
  55. # scan custom_{module}.pl or {login}_{module}.pl files
  56. foreach $customfile (@customfiles) {
  57. if ($customfile =~ /_$file/) {
  58. if (-f "$bindir/$customfile") {
  59. &scanfile("$bindir/$customfile");
  60. }
  61. }
  62. }
  63. # if this is the menu.pl file
  64. if ($file eq 'menu.pl') {
  65. foreach $item (@menufiles) {
  66. &scanmenu("$basedir/$item");
  67. }
  68. }
  69. $file =~ s/\.pl//;
  70. if (-f "$file.missing") {
  71. eval { require "$file.missing"; };
  72. unlink "$file.missing";
  73. for (keys %$missing) {