2 eval 'exec perl -wS $0 ${1+"$@"}'
6 # This file is part of the LibreOffice project.
8 # This Source Code Form is subject to the terms of the Mozilla Public
9 # License, v. 2.0. If a copy of the MPL was not distributed with this
10 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 # This file incorporates work covered by the following license notice:
14 # Licensed to the Apache Software Foundation (ASF) under one or more
15 # contributor license agreements. See the NOTICE file distributed
16 # with this work for additional information regarding copyright
17 # ownership. The ASF licenses this file to you under the Apache
18 # License, Version 2.0 (the "License"); you may not use this file
19 # except in compliance with the License. You may obtain a copy of
20 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
26 my $my_lang = 'en-US';
27 my $plist = 'Info.plist';
30 while ($_ = $ARGV[0], /^-/) {
42 # open input file (Info.plist)
43 unless (open(SOURCE
, $plist)) {
44 print STDERR
"Can't open $plist file: $!\n";
48 # XML::Parser not installed by default on MacOS X
49 my (%documents,$key,$icon,$name);
55 $documents{$icon} = $name if length $name > 0;
56 $key = $icon = $name = "";
57 } elsif ( /<key>(.*)<\/key
>/ ) {
59 } elsif ( /<string>(.*)<\/string
>/ ) {
60 if ( $key eq 'CFBundleTypeIconFile' ) {
63 } elsif ( $key eq 'CFBundleTypeName' ) {
72 print_lang
('en-US') unless $lines > 0;
78 # open input file (documents.ulf)
79 unless (open(SOURCE
, $ARGV[0])) {
80 print STDERR
"Can't open $ARGV[0] file: $!\n";
91 # split locale = "value" into 2 strings
92 my ($lang, $value) = split ' = ';
94 if ( $lang ne $_ && $lang eq $this_lang && exists $documents{$last_section} ) {
95 # replacing product variable doesn't work inside zip files and also not for UTF-16
96 next if /%PRODUCTNAME/;
97 s/$lang/"$documents{$last_section}"/;