Merge branch 'master' of ssh://lx-office/~/lx-office-erp
[kivitendo-erp.git] / scripts / locales.pl
index 2174c2d..24b0687 100755 (executable)
@@ -85,6 +85,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 +161,7 @@ EOL
 EOL
   $LOST_HEADER  = <<EOL;
 # The last 50 text strings, that have been removed.
-# This file is auto-generated by locales.pl. Do not edit it.
+# This file has been auto-generated by locales.pl. Please don't edit!
 EOL
 }
 
@@ -598,7 +601,7 @@ sub generate_file {
 
   open my $fh, '>', $file or die "$! : $file";
 
-  print $fh "#!/usr/bin/perl\n# -*- coding: iso-8859-15; -*-\n\n";
+  print $fh "#!/usr/bin/perl\n# -*- coding: $charset; -*-\n# vim: fenc=$charset\n\n";
   print $fh $header, "\n" if $header;
   print $fh "$data_name = $delim[0]\n" if $data_name;
 
@@ -608,6 +611,11 @@ sub generate_file {
   close $fh;
 }
 
+sub slurp {
+  my $file = shift;
+  do { local ( @ARGV, $/ ) = $file; <> }
+}
+
 __END__
 
 =head1 NAME