X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Flocales.pl;h=ff2638b627f9da9c8f873ac8db6f0e66c0a673ae;hb=203ebd4a71a8de7d549db868b657232da36b6e82;hp=692417fcd6f6bafcb405d3d8a6feac3701f552e0;hpb=8317c23ba3187d0d1d46d2bf763ad18cecd7e22d;p=kivitendo-erp.git diff --git a/scripts/locales.pl b/scripts/locales.pl index 692417fcd..ff2638b62 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -6,6 +6,7 @@ # this version of locles processes not only all required .pl files # but also all parse_html_templated files. +use utf8; use strict; use Data::Dumper; @@ -85,6 +86,9 @@ if (-f "$locales_dir/lost") { unlink "$locales_dir/lost"; } +my $charset = slurp("$locales_dir/charset") || 'utf-8'; +chomp $charset; + my %old_texts = %{ $self->{texts} || {} }; map({ handle_file($_, $bindir); } @progfiles); @@ -158,7 +162,7 @@ EOL EOL $LOST_HEADER = <{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript MultiColumnIterator)); + $plugins{needed}->{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript MultiColumnIterator L)); } while ($line =~ m/(?: # Start von Variante 1: LxERP.t8('...'); ohne darumliegende [% ... %]-Tags (LxERP\.t8)\( # LxERP.t8( ::Parameter $1:: - ([\'\"]) # Anfang des zu übersetzenden Strings ::Parameter $2:: - (.*?) # Der zu übersetzende String ::Parameter $3:: - (?', $file or die "$! : $file"; + open my $fh, '>:encoding(utf8)', $file or die "$! : $file"; + + $charset =~ s/\r?\n//g; + my $emacs_charset = lc $charset; - print $fh "#!/usr/bin/perl\n\n"; + print $fh "#!/usr/bin/perl\n# -*- coding: $emacs_charset; -*-\n# vim: fenc=$charset\n\nuse utf8;\n\n"; print $fh $header, "\n" if $header; print $fh "$data_name = $delim[0]\n" if $data_name; @@ -608,6 +615,11 @@ sub generate_file { close $fh; } +sub slurp { + my $file = shift; + do { local ( @ARGV, $/ ) = $file; <> } +} + __END__ =head1 NAME