2 eval 'exec perl -wS $0 ${1+"$@"}'
5 #*************************************************************************
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 # Copyright 2008 by Sun Microsystems, Inc.
11 # OpenOffice.org - a multi-platform office productivity suite
13 # $RCSfile: gen_strings.pl,v $
17 # This file is part of OpenOffice.org.
19 # OpenOffice.org is free software: you can redistribute it and/or modify
20 # it under the terms of the GNU Lesser General Public License version 3
21 # only, as published by the Free Software Foundation.
23 # OpenOffice.org is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU Lesser General Public License version 3 for more details
27 # (a copy is included in the LICENSE file that accompanied this code).
29 # You should have received a copy of the GNU Lesser General Public License
30 # version 3 along with OpenOffice.org. If not, see
31 # <http://www.openoffice.org/license.html>
32 # for a copy of the LGPLv3 License.
34 #*************************************************************************
39 my $my_lang = 'en-US';
40 my $plist = 'Info.plist';
43 while ($_ = $ARGV[0], /^-/) {
55 # open input file (Info.plist)
56 unless (open(SOURCE
, $plist)) {
57 print STDERR
"Can't open $plist file: $!\n";
61 # XML::Parser not installed by default on MacOS X
62 my (%documents,$key,$icon,$name);
68 $documents{$icon} = $name if length $name > 0;
69 $key = $icon = $name = "";
70 } elsif ( /<key>(.*)<\/key
>/ ) {
72 } elsif ( /<string>(.*)<\/string
>/ ) {
73 if ( $key eq 'CFBundleTypeIconFile' ) {
76 } elsif ( $key eq 'CFBundleTypeName' ) {
85 print_lang
('en-US') unless $lines > 0;
91 # open input file (documents.ulf)
92 unless (open(SOURCE
, $ARGV[0])) {
93 print STDERR
"Can't open $ARGV[0] file: $!\n";
104 # split locale = "value" into 2 strings
105 my ($lang, $value) = split ' = ';
107 if ( $lang ne $_ && $lang eq $this_lang && exists $documents{$last_section} ) {
108 # replacing product variable doesn't work inside zip files and also not for UTF-16
109 next if /%PRODUCTNAME/;
110 # s/%PRODUCTNAME/\${FILEFORMATNAME} \${FILEFORMATVERSION}/g;
111 s/$lang/"$documents{$last_section}"/;