Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 38105908

Von Moritz Bunkus vor etwa 19 Jahren hinzugefügt

  • ID 3810590867a59bab1a4b65d9b4ae67b19038fd19
  • Vorgänger 38087e58
  • Nachfolger e848dbf1

Perltidy ueber locales.pl laufen lassen. Den Parser in locaes.pl so erweitert, dass er auch $text->locale(...)-Funktionsaufrufe auswertet, die ueber mehrere Zeilen gehen. Das wurde durch die Verwendung von perltidy akut, das bei sehr langen Zeilen das Argument zu $text->locale() in eine eigene Zeile schreibt. Einige der dadurch neu/wieder gefundenen Ausdruecke uebersetzt bzw. deren urspruengliche Uebersetzung wiederhergestellt. Merge von 570:573 aus unstable.

Unterschiede anzeigen:

locale/de/all
4 4
# run locales.pl from this directory to rebuild the translation files
5 5

  
6 6
$self{texts} = {
7
  ' Date missing!'              => ' Datum fehlt!',
8
  ' Number'                     => '',
9
  ' Part Number missing!'       => ' Artikelnummer fehlt!',
10
  ' missing!'                   => ' fehlt!',
7 11
  'AP'                          => 'Einkauf',
8 12
  'AP Aging'                    => 'Offene Verbindlichkeiten',
9 13
  'AP Transaction'              => 'Kreditorenbuchung',
......
27 31
  'Accrual'                     => 'Bilanzierung',
28 32
  'Active'                      => 'Aktiv',
29 33
  'Add'                         => 'Erfassen',
34
  'Add '                        => '',
30 35
  'Add AP Transaction'          => 'Kreditorenbuchung',
31 36
  'Add AR Transaction'          => 'Debitorenbuchung',
32 37
  'Add Account'                 => 'Konto erfassen',
......
270 275
  'ELSTER-Steuernummer: '       => 'ELSTER-Steuernummer: ',
271 276
  'EUR'                         => 'E/?-Rechnung',
272 277
  'Edit'                        => 'Bearbeiten',
278
  'Edit '                       => '',
273 279
  'Edit Account'                => 'Kontodaten bearbeiten',
274 280
  'Edit Accounts Payables Transaction' => 'Kreditorenbuchung bearbeiten',
275 281
  'Edit Accounts Receivables Transaction' => 'Debitorenbuchung bearbeiten',
......
297 303
  'Edit Warehouse'              => 'Lager bearbeiten',
298 304
  'Employee'                    => 'Bearbeiter',
299 305
  'Enforce transaction reversal for all dates' => 'Gegenbuchungen f?r jeden Zeitraum aktualisieren',
300
  'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Durch Doppelpunkte getrennte W?hrungsk?rzel mit maximal 3 Buchstaben auff?hren; Ihre eigene LandesW?hrung zuerst (z.B. EUR:USD:CAD)',
306
  'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Geben Sie Ihre und weitere W?hrungen mit bis zu drei Buchstaben pro W?hrung und W?hrungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD)',
301 307
  'Equity'                      => 'Passiva',
308
  'Es fehlen Angaben zur Versteuerung.
309
  Wenn Sie Ist Versteuert sind, w?hlen Sie die Einnahmen/?berschu?-Rechnung aus.
310
  Sind Sie Soll-Versteuert und Bilanzverpflichtet, dann w?hlen Sie Bilanz aus.' => '',
302 311
  'Exch'                        => 'Wechselkurs.',
303 312
  'Exchangerate'                => 'Wechselkurs',
304 313
  'Exchangerate Difference'     => 'Wechselkursunterschied',
......
462 471
  'N/A'                         => 'N.Z.',
463 472
  'Name'                        => 'Name',
464 473
  'Name missing!'               => 'Name fehlt!',
465
  'New Account'                 => '',
474
  'New Account'                 => 'Neues Konto',
466 475
  'New Templates'               => 'neue Vorlagen',
467 476
  'No'                          => 'Nein',
468 477
  'No Database Drivers available!' => 'Kein Datenbanktreiber verf?gbar!',
......
790 799
  'number'                      => 'Nummer',
791 800
  'posted!'                     => 'gebucht',
792 801
  'quarter'                     => 'viertelj?hrliche (quartalsweise) Abgabe',
802
  's'                           => '',
793 803
  'save'                        => 'speichern',
794 804
  'saved'                       => 'gespeichert',
795 805
  'saved!'                      => 'gespeichert',
locale/de/am
64 64
  'Edit Template'               => 'Vorlage bearbeiten',
65 65
  'Edit Warehouse'              => 'Lager bearbeiten',
66 66
  'Enforce transaction reversal for all dates' => 'Gegenbuchungen f?r jeden Zeitraum aktualisieren',
67
  'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Durch Doppelpunkte getrennte W?hrungsk?rzel mit maximal 3 Buchstaben auff?hren; Ihre eigene LandesW?hrung zuerst (z.B. EUR:USD:CAD)',
67
  'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Geben Sie Ihre und weitere W?hrungen mit bis zu drei Buchstaben pro W?hrung und W?hrungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD)',
68 68
  'Equity'                      => 'Passiva',
69 69
  'Expense'                     => 'Aufwandskonto',
70 70
  'Expense Account'             => 'Aufwandskonto',
locale/de/ct
1 1
$self{texts} = {
2
  ' Number'                     => ' Number',
2 3
  'Abteilung'                   => 'Abteilung',
3 4
  'Account Number'              => 'Kontonummer',
4 5
  'Accounting Menu'             => 'Kontoverwaltung',
......
87 88
  'Vendors'                     => 'Lieferanten',
88 89
  'Zipcode'                     => 'PLZ',
89 90
  'days'                        => 'Tage',
91
  's'                           => 's',
90 92
};
91 93

  
92 94
$self{subs} = {
locale/de/gl
69 69
  'May '                        => 'Mai',
70 70
  'Mitarbeiter'                 => 'Mitarbeiter',
71 71
  'MwSt. inkl.'                 => 'MwSt. inkl.',
72
  'New Account'                 => 'New Account',
72
  'New Account'                 => 'Neues Konto',
73 73
  'Notes'                       => 'Bemerkungen',
74 74
  'Nov'                         => 'Nov',
75 75
  'November'                    => 'November',
......
147 147
  'weiter'                      => 'continue',
148 148
  'l?schen'                     => 'delete',
149 149
  'dialogbuchung'               => 'gl_transaction',
150
  'new_account'                 => 'new_account',
150
  'neues_konto'                 => 'new_account',
151 151
  'buchen'                      => 'post',
152 152
  'neu_buchen'                  => 'post_as_new',
153 153
  'rechnung'                    => 'sales_invoice',
locale/de/ic
1 1
$self{texts} = {
2
  ' Date missing!'              => ' Datum fehlt!',
3
  ' Part Number missing!'       => ' Artikelnummer fehlt!',
2 4
  'Accounting Menu'             => 'Kontoverwaltung',
3 5
  'Active'                      => 'Aktiv',
4 6
  'Add'                         => 'Erfassen',
7
  'Add '                        => 'Add ',
5 8
  'Add Assembly'                => 'Erzeugnis erfassen',
6 9
  'Add Part'                    => 'Ware erfassen',
7 10
  'Add Purchase Order'          => 'Lieferantenauftrag erfassen',
......
44 47
  'E-mail'                      => 'eMail',
45 48
  'E-mail address missing!'     => 'eMailadresse fehlt!',
46 49
  'E-mailed'                    => 'eMail gesendet.',
50
  'Edit '                       => 'Edit ',
47 51
  'Edit Assembly'               => 'Erzeugnis bearbeiten',
48 52
  'Edit Part'                   => 'Ware bearbeiten',
49 53
  'Edit Service'                => 'Dienstleistung bearbeiten',
......
177 181
  'button'                      => '?',
178 182
  'choice'                      => 'ausw?hlen',
179 183
  'choice part'                 => 'Artikel ausw?hlen',
180
  'ea'                          => 'Stk',
181 184
  'emailed to'                  => 'gemailt an',
182 185
  'hr'                          => 'Stunde',
183 186
  'list'                        => 'auflisten',
locale/de/io
1 1
$self{texts} = {
2
  ' Date missing!'              => ' Datum fehlt!',
2 3
  'Add Purchase Order'          => 'Lieferantenauftrag erfassen',
3 4
  'Add Quotation'               => 'Angebot erfassen',
4 5
  'Add Request for Quotation'   => 'Anfrage erfassen',
locale/de/ir
1 1
$self{texts} = {
2
  ' Date missing!'              => ' Datum fehlt!',
2 3
  'Account'                     => 'Konto',
3 4
  'Accounting Menu'             => 'Kontoverwaltung',
4 5
  'Add Purchase Order'          => 'Lieferantenauftrag erfassen',
locale/de/is
1 1
$self{texts} = {
2
  ' Date missing!'              => ' Datum fehlt!',
2 3
  'Account'                     => 'Konto',
3 4
  'Accounting Menu'             => 'Kontoverwaltung',
4 5
  'Add Purchase Order'          => 'Lieferantenauftrag erfassen',
locale/de/locales.pl
4 4

  
5 5
use FileHandle;
6 6

  
7

  
8
$basedir = "../..";
9
$bindir = "$basedir/bin/mozilla";
7
$basedir  = "../..";
8
$bindir   = "$basedir/bin/mozilla";
10 9
$menufile = "menu.ini";
11 10

  
12 11
foreach $item (@ARGV) {
......
32 31
  unshift @menufiles, $menufile;
33 32
}
34 33

  
35

  
36 34
# slurp the translations in
37 35
if (-f 'all') {
38 36
  require "all";
39 37
}
40 38

  
41

  
42 39
foreach $file (@progfiles) {
43
  
40

  
44 41
  %locale = ();
45 42
  %submit = ();
46
  %subrt = ();
47
  
43
  %subrt  = ();
44

  
48 45
  &scanfile("$bindir/$file");
49 46

  
50 47
  # scan custom_{module}.pl or {login}_{module}.pl files
51 48
  foreach $customfile (@customfiles) {
52 49
    if ($customfile =~ /_$file/) {
53 50
      if (-f "$bindir/$customfile") {
54
	&scanfile("$bindir/$customfile");
51
        &scanfile("$bindir/$customfile");
55 52
      }
56 53
    }
57 54
  }
58
  
55

  
59 56
  # if this is the menu.pl file
60 57
  if ($file eq 'menu.pl') {
61 58
    foreach $item (@menufiles) {
......
65 62
  
66 63
  $file =~ s/\.pl//;
67 64

  
68

  
69 65
  eval { require 'missing'; };
70 66
  unlink 'missing';
71 67

  
72 68
  foreach $text (keys %$missing) {
73 69
    if ($locale{$text}) {
74 70
      unless ($self{texts}{$text}) {
75
	$self{texts}{$text} = $missing->{$text};
71
        $self{texts}{$text} = $missing->{$text};
76 72
      }
77 73
    }
78 74
  }
79 75

  
80

  
81 76
  open FH, ">$file" or die "$! : $file";
82 77

  
83 78
  print FH q|$self{texts} = {
......
95 90
    $keytext = $key;
96 91
    $keytext =~ s/'/\\'/g;
97 92
    $keytext =~ s/\\$/\\\\/;
98
    
99
    print FH qq|  '$keytext'|.(' ' x (27-length($keytext))).qq| => '$text',\n|;
93

  
94
    print FH qq|  '$keytext'|
95
      . (' ' x (27 - length($keytext)))
96
      . qq| => '$text',\n|;
100 97
  }
101 98

  
102 99
  print FH q|};
103 100

  
104 101
$self{subs} = {
105 102
|;
106
  
103

  
107 104
  foreach $key (sort keys %subrt) {
108 105
    $text = $key;
109 106
    $text =~ s/'/\\'/g;
110 107
    $text =~ s/\\$/\\\\/;
111
    print FH qq|  '$text'|.(' ' x (27-length($text))).qq| => '$text',\n|;
108
    print FH qq|  '$text'| . (' ' x (27 - length($text))) . qq| => '$text',\n|;
112 109
  }
113 110

  
114 111
  foreach $key (sort keys %submit) {
......
120 117
    $english_sub =~ s/'/\\'/g;
121 118
    $english_sub =~ s/\\$/\\\\/;
122 119
    $english_sub = lc $key;
123
    
120

  
124 121
    $translated_sub = lc $text;
125
    $english_sub =~ s/( |-|,)/_/g;
122
    $english_sub    =~ s/( |-|,)/_/g;
126 123
    $translated_sub =~ s/( |-|,)/_/g;
127
    print FH qq|  '$translated_sub'|.(' ' x (27-length($translated_sub))).qq| => '$english_sub',\n|;
124
    print FH qq|  '$translated_sub'|
125
      . (' ' x (27 - length($translated_sub)))
126
      . qq| => '$english_sub',\n|;
128 127
  }
129
  
128

  
130 129
  print FH q|};
131 130

  
132 131
1;
......
135 134
  close FH;
136 135
}
137 136

  
138

  
139 137
# now print out all
140 138

  
141 139
open FH, ">all" or die "$! : all";
......
148 146
$self{texts} = {
149 147
|;
150 148

  
151

  
152 149
foreach $key (sort keys %alllocales) {
153 150
  $text = $self{texts}{$key};
154 151

  
155 152
  $count++;
156
  
153

  
157 154
  $text =~ s/'/\\'/g;
158 155
  $text =~ s/\\$/\\\\/;
159
  $key =~ s/'/\\'/g;
160
  $key =~ s/\\$/\\\\/;
156
  $key  =~ s/'/\\'/g;
157
  $key  =~ s/\\$/\\\\/;
161 158

  
162 159
  unless ($text) {
163 160
    $notext++;
164 161
    push @missing, $key;
165 162
  }
166 163

  
167
  print FH qq|  '$key'|.(' ' x (27-length($key))).qq| => '$text',\n|;
164
  print FH qq|  '$key'| . (' ' x (27 - length($key))) . qq| => '$text',\n|;
168 165

  
169 166
}
170 167

  
......
175 172

  
176 173
close FH;
177 174

  
178

  
179 175
if (@missing) {
180 176
  open FH, ">missing" or die "$! : missing";
181 177

  
......
185 181
|;
186 182

  
187 183
  foreach $text (@missing) {
188
    print FH qq|  '$text'|.(' ' x (27-length($text))).qq| => '',\n|;
184
    print FH qq|  '$text'| . (' ' x (27 - length($text))) . qq| => '',\n|;
189 185
  }
190 186

  
191 187
  print FH q|};
......
194 190
|;
195 191

  
196 192
  close FH;
197
  
193

  
198 194
}
199 195

  
200 196
open(FH, "LANGUAGE");
......
207 203
print "\n$trlanguage - ${per}%\n";
208 204

  
209 205
exit;
206

  
210 207
# eom
211 208

  
209
sub extract_text_between_parenthesis {
210
  my ($fh, $line) = @_;
211
  my ($inside_string, $pos, $text, $quote_next) = (undef, 0, "", 0);
212

  
213
  while (1) {
214
    if (length($line) <= $pos) {
215
      $line = <$fh>;
216
      return ($text, "") unless ($line);
217
      $pos = 0;
218
    }
219

  
220
    my $cur_char = substr($line, $pos, 1);
221

  
222
    if (!$inside_string) {
223
      if ((length($line) >= ($pos + 3)) && (substr($line, $pos, 2)) eq "qq") {
224
        $inside_string = substr($line, $pos + 2, 1);
225
        $pos += 2;
226

  
227
      } elsif ((length($line) >= ($pos + 2)) &&
228
               (substr($line, $pos, 1) eq "q")) {
229
        $inside_string = substr($line, $pos + 1, 1);
230
        $pos++;
231

  
232
      } elsif (($cur_char eq '"') || ($cur_char eq '\'')) {
233
        $inside_string = $cur_char;
234

  
235
      } elsif ($cur_char eq ")") {
236
        return ($text, substr($line, $pos + 1));
237
      }
238

  
239
    } else {
240
      if ($quote_next) {
241
        $text .= $cur_char;
242
        $quote_next = 0;
243

  
244
      } elsif ($cur_char eq '\\') {
245
        $text .= $cur_char;
246
        $quote_next = 1;
247

  
248
      } elsif ($cur_char eq $inside_string) {
249
        undef($inside_string);
250

  
251
      } else {
252
        $text .= $cur_char;
253

  
254
      }
255
    }
256
    $pos++;
257
  }
258
}
212 259

  
213 260
sub scanfile {
214 261
  my $file = shift;
215 262

  
216 263
  return unless (-f "$file");
217
  
264

  
218 265
  my $fh = new FileHandle;
219 266
  open $fh, "$file" or die "$! : $file";
220 267

  
221 268
  my ($is_submit, $line_no, $sub_line_no) = (0, 0, 0);
222
	
269

  
223 270
  while (<$fh>) {
224 271
    $line_no++;
272

  
225 273
    # is this another file
226 274
    if (/require\s+\W.*\.pl/) {
227 275
      my $newfile = $&;
......
229 277
      $newfile =~ s/\$form->{path}\///;
230 278
      &scanfile("$bindir/$newfile");
231 279
    }
232
   
280

  
233 281
    # is this a sub ?
234 282
    if (/^sub /) {
235 283
      ($null, $subrt) = split / +/;
236 284
      $subrt{$subrt} = 1;
237 285
      next;
238 286
    }
239
    
287

  
240 288
    my $rc = 1;
241
    
289

  
242 290
    while ($rc) {
243 291
      if (/Locale/) {
244
	unless (/^use /) {
245
	  my ($null, $country) = split /,/;
246
	  $country =~ s/^ +[\"\']//;
247
	  $country =~ s/[\"\'].*//;
248
	}
292
        unless (/^use /) {
293
          my ($null, $country) = split /,/;
294
          $country =~ s/^ +[\"\']//;
295
          $country =~ s/[\"\'].*//;
296
        }
249 297
      }
250 298

  
251 299
      my $postmatch = "";
300

  
252 301
      # is it a submit button before $locale->
253 302
      if (/type\s*=\s*submit/i) {
254 303
        $postmatch = $';
255 304
        if ($` !~ /\$locale->text/) {
256
          $is_submit = 1;
305
          $is_submit   = 1;
257 306
          $sub_line_no = $line_no;
258 307
        }
259 308
      }
260 309

  
261
      my ($found) = /\$locale->text.*?\W\)/;
310
      my ($found) = /\$locale->text.*?\(/;
262 311
      my $postmatch = $';
263 312

  
264 313
      if ($found) {
265
	my $string = $&;
266
	$string =~ s/\$locale->text\(\s*[\'\"(q|qq)][\'\/\\\|~]*//;
267
	$string =~ s/\W\)+.*$//;
314
        my $string;
315
        ($string, $_) = extract_text_between_parenthesis($fh, $postmatch);
316
        $postmatch = $_;
268 317

  
269 318
        # if there is no $ in the string record it
270
	unless ($string =~ /\$\D.*/) {
271
	  # this guarantees one instance of string
272
	  $locale{$string} = 1;
319
        unless (($string =~ /\$\D.*/) || ("" eq $string)) {
320

  
321
          # this guarantees one instance of string
322
          $locale{$string} = 1;
273 323

  
274 324
          # this one is for all the locales
275
	  $alllocales{$string} = 1;
325
          $alllocales{$string} = 1;
276 326

  
277 327
          # is it a submit button before $locale->
278 328
          if ($is_submit) {
279
	    $submit{$string} = 1;
329
            $submit{$string} = 1;
280 330
          }
281
	}
331
        }
282 332
      } elsif ($postmatch =~ />/) {
283 333
        $is_submit = 0;
284 334
      }
285 335

  
286 336
      # exit loop if there are no more locales on this line
287 337
      ($rc) = ($postmatch =~ /\$locale->text/);
338

  
288 339
      # strip text
289 340
      s/^.*?\$locale->text.*?\)//;
290 341

  
291
      if (($postmatch =~ />/) ||
292
          (!$found && ($sub_line_no != $line_no) && />/)) {
342
      if (   ($postmatch =~ />/)
343
          || (!$found && ($sub_line_no != $line_no) && />/)) {
293 344
        $is_submit = 0;
294 345
      }
295 346
    }
......
299 350

  
300 351
}
301 352

  
302

  
303 353
sub scanmenu {
304 354
  my $file = shift;
305 355

  
......
311 361

  
312 362
  # strip []
313 363
  grep { s/(\[|\])//g } @a;
314
  
364

  
315 365
  foreach my $item (@a) {
316 366
    @b = split /--/, $item;
317 367
    foreach $string (@b) {
318 368
      chomp $string;
319
      $locale{$string} = 1;
369
      $locale{$string}     = 1;
320 370
      $alllocales{$string} = 1;
321 371
    }
322 372
  }
323
  
324
}
325 373

  
374
}
326 375

  
locale/de/oe
1 1
$self{texts} = {
2
  ' Date missing!'              => ' Datum fehlt!',
3
  ' missing!'                   => ' fehlt!',
2 4
  'Accounting Menu'             => 'Kontoverwaltung',
3 5
  'Add'                         => 'Erfassen',
4 6
  'Add Exchangerate'            => 'Wechselkurs erfassen',
locale/de/ustva
30 30
  'Description'                 => 'Beschreibung',
31 31
  'ELSTER Export nach Winston'  => 'ELSTER Export nach Winston',
32 32
  'ELSTER-Steuernummer: '       => 'ELSTER-Steuernummer: ',
33
  'Es fehlen Angaben zur Versteuerung.
34
  Wenn Sie Ist Versteuert sind, w?hlen Sie die Einnahmen/?berschu?-Rechnung aus.
35
  Sind Sie Soll-Versteuert und Bilanzverpflichtet, dann w?hlen Sie Bilanz aus.' => 'Es fehlen Angaben zur Versteuerung.
36
  Wenn Sie Ist Versteuert sind, w?hlen Sie die Einnahmen/?berschu?-Rechnung aus.
37
  Sind Sie Soll-Versteuert und Bilanzverpflichtet, dann w?hlen Sie Bilanz aus.',
33 38
  'Fax'                         => 'Fax',
34 39
  'Fax. : '                     => 'Fax. : ',
35 40
  'Fax.: '                      => 'Fax.: ',

Auch abrufbar als: Unified diff