Filename | /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/languages.pm |
Statements | Executed 479 statements in 4.32ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 7.07ms | 11.4ms | BEGIN@34 | installer::languages::
1 | 1 | 1 | 1.24ms | 2.78ms | get_all_languages_for_one_product | installer::languages::
111 | 4 | 1 | 362µs | 362µs | CORE:match (opcode) | installer::languages::
1 | 1 | 1 | 343µs | 345µs | BEGIN@30 | installer::languages::
1 | 1 | 1 | 133µs | 158µs | get_language_string | installer::languages::
1 | 1 | 1 | 32µs | 37µs | analyze_languagelist | installer::languages::
2 | 2 | 1 | 28µs | 28µs | CORE:subst (opcode) | installer::languages::
1 | 1 | 1 | 24µs | 24µs | all_elements_of_array1_in_array2 | installer::languages::
2 | 2 | 2 | 19µs | 19µs | get_default_language | installer::languages::
1 | 1 | 1 | 18µs | 20µs | BEGIN@31 | installer::languages::
1 | 1 | 1 | 17µs | 19µs | BEGIN@33 | installer::languages::
1 | 1 | 1 | 13µs | 14µs | BEGIN@32 | installer::languages::
0 | 0 | 0 | 0s | 0s | get_info_about_languages | installer::languages::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | #************************************************************************* | ||||
2 | # | ||||
3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||||
4 | # | ||||
5 | # Copyright 2000, 2010 Oracle and/or its affiliates. | ||||
6 | # | ||||
7 | # OpenOffice.org - a multi-platform office productivity suite | ||||
8 | # | ||||
9 | # This file is part of OpenOffice.org. | ||||
10 | # | ||||
11 | # OpenOffice.org is free software: you can redistribute it and/or modify | ||||
12 | # it under the terms of the GNU Lesser General Public License version 3 | ||||
13 | # only, as published by the Free Software Foundation. | ||||
14 | # | ||||
15 | # OpenOffice.org is distributed in the hope that it will be useful, | ||||
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
18 | # GNU Lesser General Public License version 3 for more details | ||||
19 | # (a copy is included in the LICENSE file that accompanied this code). | ||||
20 | # | ||||
21 | # You should have received a copy of the GNU Lesser General Public License | ||||
22 | # version 3 along with OpenOffice.org. If not, see | ||||
23 | # <http://www.openoffice.org/license.html> | ||||
24 | # for a copy of the LGPLv3 License. | ||||
25 | # | ||||
26 | #************************************************************************* | ||||
27 | |||||
28 | package installer::languages; | ||||
29 | |||||
30 | 2 | 63µs | 2 | 348µs | # spent 345µs (343+3) within installer::languages::BEGIN@30 which was called:
# once (343µs+3µs) by installer::scriptitems::BEGIN@33 at line 30 # spent 345µs making 1 call to installer::languages::BEGIN@30
# spent 2µs making 1 call to UNIVERSAL::import |
31 | 2 | 53µs | 2 | 22µs | # spent 20µs (18+2) within installer::languages::BEGIN@31 which was called:
# once (18µs+2µs) by installer::scriptitems::BEGIN@33 at line 31 # spent 20µs making 1 call to installer::languages::BEGIN@31
# spent 2µs making 1 call to UNIVERSAL::import |
32 | 2 | 51µs | 2 | 16µs | # spent 14µs (13+2) within installer::languages::BEGIN@32 which was called:
# once (13µs+2µs) by installer::scriptitems::BEGIN@33 at line 32 # spent 14µs making 1 call to installer::languages::BEGIN@32
# spent 2µs making 1 call to UNIVERSAL::import |
33 | 2 | 57µs | 2 | 22µs | # spent 19µs (17+3) within installer::languages::BEGIN@33 which was called:
# once (17µs+3µs) by installer::scriptitems::BEGIN@33 at line 33 # spent 19µs making 1 call to installer::languages::BEGIN@33
# spent 2µs making 1 call to UNIVERSAL::import |
34 | 2 | 2.41ms | 2 | 11.4ms | # spent 11.4ms (7.07+4.32) within installer::languages::BEGIN@34 which was called:
# once (7.07ms+4.32ms) by installer::scriptitems::BEGIN@33 at line 34 # spent 11.4ms making 1 call to installer::languages::BEGIN@34
# spent 5µs making 1 call to UNIVERSAL::import |
35 | |||||
36 | ############################################################################# | ||||
37 | # Analyzing the laguage list parameter and language list from zip list file | ||||
38 | ############################################################################# | ||||
39 | |||||
40 | sub analyze_languagelist | ||||
41 | # spent 37µs (32+5) within installer::languages::analyze_languagelist which was called:
# once (32µs+5µs) by installer::run at line 124 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
42 | 4 | 37µs | my $first = $installer::globals::languagelist; | ||
43 | |||||
44 | 1 | 3µs | $first =~ s/\_/\,/g; # substituting "_" by ",", in case of dmake definition 01_49 # spent 3µs making 1 call to installer::languages::CORE:subst | ||
45 | |||||
46 | # Products are separated by a "#", if defined in zip-list by a "|". But "get_info_about_languages" | ||||
47 | # substitutes already "|" to "#". This procedure only knows "#" as product separator. | ||||
48 | # Different languages for one product are separated by ",". But on the command line the "_" is used. | ||||
49 | # Therefore "_" is replaced by "," at the beginning of this procedure. | ||||
50 | |||||
51 | 1 | 2µs | while ($first =~ /^(\S+)\#(\S+?)$/) # Minimal matching, to keep the order of languages # spent 2µs making 1 call to installer::languages::CORE:match | ||
52 | { | ||||
53 | $first = $1; | ||||
54 | my $last = $2; | ||||
55 | unshift(@installer::globals::languageproducts, $last); | ||||
56 | } | ||||
57 | |||||
58 | unshift(@installer::globals::languageproducts, $first); | ||||
59 | } | ||||
60 | |||||
61 | #################################################### | ||||
62 | # Reading languages from zip list file | ||||
63 | #################################################### | ||||
64 | |||||
65 | sub get_info_about_languages | ||||
66 | { | ||||
67 | my ( $allsettingsarrayref ) = @_; | ||||
68 | |||||
69 | my $languagelistref; | ||||
70 | |||||
71 | $languagelistref = installer::ziplist::getinfofromziplist($allsettingsarrayref, "languages"); | ||||
72 | $installer::globals::languagelist = $$languagelistref; | ||||
73 | |||||
74 | if ( $installer::globals::languagelist eq "" ) # not defined on command line and not in product list | ||||
75 | { | ||||
76 | installer::exiter::exit_program("ERROR: Languages not defined on command line (-l) and not in product list!", "get_info_about_languages"); | ||||
77 | } | ||||
78 | |||||
79 | # Adapting the separator format from zip list. | ||||
80 | # | means new product, , (comma) means more than one language in one product | ||||
81 | # On the command line, | is difficult to use. Therefore this script uses hashes | ||||
82 | |||||
83 | $installer::globals::languagelist =~ s/\|/\#/g; | ||||
84 | |||||
85 | analyze_languagelist(); | ||||
86 | } | ||||
87 | |||||
88 | ############################################################################# | ||||
89 | # Checking whether all elements of an array A are also member of array B | ||||
90 | ############################################################################# | ||||
91 | |||||
92 | sub all_elements_of_array1_in_array2 | ||||
93 | # spent 24µs within installer::languages::all_elements_of_array1_in_array2 which was called:
# once (24µs+0s) by installer::languages::get_all_languages_for_one_product at line 208 | ||||
94 | 4 | 11µs | my ($array1, $array2) = @_; | ||
95 | |||||
96 | my $array2_contains_all_elements_of_array1 = 1; | ||||
97 | |||||
98 | 1 | 14µs | for ( my $i = 0; $i <= $#{$array1}; $i++ ) | ||
99 | { | ||||
100 | 2 | 2µs | if (! grep {$_ eq ${$array1}[$i]} @{$array2}) | ||
101 | { | ||||
102 | $array2_contains_all_elements_of_array1 = 0; | ||||
103 | last; | ||||
104 | } | ||||
105 | } | ||||
106 | |||||
107 | return $array2_contains_all_elements_of_array1; | ||||
108 | } | ||||
109 | |||||
110 | ############################################# | ||||
111 | # All languages defined for one product | ||||
112 | ############################################# | ||||
113 | |||||
114 | sub get_all_languages_for_one_product | ||||
115 | # spent 2.78ms (1.24+1.53) within installer::languages::get_all_languages_for_one_product which was called:
# once (1.24ms+1.53ms) by installer::run at line 500 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
116 | 10 | 40µs | my ( $languagestring, $allvariables ) = @_; | ||
117 | |||||
118 | my @languagearray = (); | ||||
119 | |||||
120 | my $last = $languagestring; | ||||
121 | |||||
122 | $installer::globals::ismultilingual = 0; # setting the global variable $ismultilingual ! | ||||
123 | 1 | 500ns | 1 | 3µs | if ( $languagestring =~ /\,/ ) { $installer::globals::ismultilingual = 1; } # spent 3µs making 1 call to installer::languages::CORE:match |
124 | |||||
125 | 1 | 6µs | while ( $last =~ /^\s*(.+?)\,(.+)\s*$/) # "$" for minimal matching, comma separated list # spent 6µs making 1 call to installer::languages::CORE:match | ||
126 | { | ||||
127 | 432 | 1.33ms | my $first = $1; | ||
128 | $last = $2; | ||||
129 | 108 | 1.14ms | installer::remover::remove_leading_and_ending_whitespaces(\$first); # spent 1.14ms making 108 calls to installer::remover::remove_leading_and_ending_whitespaces, avg 11µs/call | ||
130 | 108 | 350µs | push(@languagearray, "$first"); # spent 350µs making 108 calls to installer::languages::CORE:match, avg 3µs/call | ||
131 | } | ||||
132 | |||||
133 | 1 | 10µs | installer::remover::remove_leading_and_ending_whitespaces(\$last); # spent 10µs making 1 call to installer::remover::remove_leading_and_ending_whitespaces | ||
134 | push(@languagearray, "$last"); | ||||
135 | |||||
136 | 4 | 61µs | if ( $installer::globals::iswindowsbuild ) | ||
137 | { | ||||
138 | my $furthercheck = 1; | ||||
139 | |||||
140 | # For some languages (that are not supported by Windows, english needs to be added to the installation set | ||||
141 | |||||
142 | # FIXME The script i18npool/source/isolang/langid.pl greps this very | ||||
143 | # source file to read this array. Be careful! | ||||
144 | my @noMSLocaleLangs = ( | ||||
145 | "br", | ||||
146 | "bs", | ||||
147 | "dz", | ||||
148 | "gu", | ||||
149 | "km", | ||||
150 | "nr", | ||||
151 | "ns", | ||||
152 | "nso", | ||||
153 | "rw", | ||||
154 | "ss", | ||||
155 | "st", | ||||
156 | "tg", | ||||
157 | "ts", | ||||
158 | "tn", | ||||
159 | "ve", | ||||
160 | "xh", | ||||
161 | "zu", | ||||
162 | "ne", | ||||
163 | "bn", | ||||
164 | "bn-BD", | ||||
165 | "bn-IN", | ||||
166 | "lo", | ||||
167 | "cy", | ||||
168 | "ku", | ||||
169 | "as-IN", | ||||
170 | "te-IN", | ||||
171 | "ml-IN", | ||||
172 | "mr-IN", | ||||
173 | "ur-IN", | ||||
174 | "ta-IN", | ||||
175 | "or-IN", | ||||
176 | "ti-ER", | ||||
177 | "eo", | ||||
178 | "ka", | ||||
179 | "ga", | ||||
180 | "uk", | ||||
181 | "gd", | ||||
182 | "my", | ||||
183 | "mai", | ||||
184 | "brx", | ||||
185 | "dgo", | ||||
186 | "kok", | ||||
187 | "mni", | ||||
188 | "ca-XV", | ||||
189 | "sat", | ||||
190 | "ug", | ||||
191 | "om", | ||||
192 | "si", | ||||
193 | "or", | ||||
194 | "oc", | ||||
195 | "ml", | ||||
196 | "as", | ||||
197 | "ast", | ||||
198 | "ht", | ||||
199 | "jbo", | ||||
200 | "fur", | ||||
201 | "ny", | ||||
202 | "so", | ||||
203 | "kab", | ||||
204 | "tk", | ||||
205 | "ky-CN", | ||||
206 | ); | ||||
207 | |||||
208 | 1 | 24µs | if ( all_elements_of_array1_in_array2(\@languagearray, \@noMSLocaleLangs) ) # spent 24µs making 1 call to installer::languages::all_elements_of_array1_in_array2 | ||
209 | { | ||||
210 | my $officestartlanguage = $languagearray[0]; | ||||
211 | unshift(@languagearray, "en-US"); # am Anfang einfügen! | ||||
212 | $installer::globals::ismultilingual = 1; | ||||
213 | $installer::globals::added_english = 1; | ||||
214 | $installer::globals::set_office_start_language = 1; | ||||
215 | # setting the variable PRODUCTLANGUAGE, needed for Linguistic-ForceDefaultLanguage.xcu | ||||
216 | $allvariables->{'PRODUCTLANGUAGE'} = $officestartlanguage; | ||||
217 | $furthercheck = 0; | ||||
218 | } | ||||
219 | |||||
220 | # In bilingual installation sets, in which english is the first language, | ||||
221 | # the Office start language shall be the second language. | ||||
222 | |||||
223 | 1 | 1µs | if ( $furthercheck ) | ||
224 | { | ||||
225 | if (( $#languagearray == 1 ) && ( $languagearray[0] eq "en-US" )) | ||||
226 | { | ||||
227 | my $officestartlanguage = $languagearray[1]; | ||||
228 | $installer::globals::set_office_start_language = 1; | ||||
229 | # setting the variable PRODUCTLANGUAGE, needed for Linguistic-ForceDefaultLanguage.xcu | ||||
230 | $allvariables->{'PRODUCTLANGUAGE'} = $officestartlanguage; | ||||
231 | } | ||||
232 | } | ||||
233 | } | ||||
234 | |||||
235 | return \@languagearray; | ||||
236 | } | ||||
237 | |||||
238 | ########################################################## | ||||
239 | # Converting the language array into a string for output | ||||
240 | ########################################################## | ||||
241 | |||||
242 | sub get_language_string | ||||
243 | # spent 158µs (133+25) within installer::languages::get_language_string which was called:
# once (133µs+25µs) by installer::run at line 502 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
244 | 5 | 161µs | my ($languagesref) = @_; | ||
245 | |||||
246 | my $newstring = ""; | ||||
247 | |||||
248 | for ( my $i = 0; $i <= $#{$languagesref}; $i++ ) | ||||
249 | { | ||||
250 | $newstring = $newstring . ${$languagesref}[$i] . "_"; | ||||
251 | } | ||||
252 | |||||
253 | # remove ending underline | ||||
254 | |||||
255 | 1 | 25µs | $newstring =~ s/\_\s*$//; # spent 25µs making 1 call to installer::languages::CORE:subst | ||
256 | |||||
257 | return \$newstring; | ||||
258 | } | ||||
259 | |||||
260 | ########################################################## | ||||
261 | # Analyzing the languages in the languages array and | ||||
262 | # returning the most important language | ||||
263 | ########################################################## | ||||
264 | |||||
265 | sub get_default_language | ||||
266 | # spent 19µs within installer::languages::get_default_language which was called 2 times, avg 10µs/call:
# once (12µs+0s) by installer::run at line 1696 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (8µs+0s) by installer::scriptitems::add_License_Files_into_Installdir at line 1365 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/scriptitems.pm | ||||
267 | 4 | 25µs | my ($languagesref) = @_; | ||
268 | |||||
269 | return ${$languagesref}[0]; # ToDo, only returning the first language | ||||
270 | } | ||||
271 | |||||
272 | 1 | 7µs | 1; | ||
# spent 362µs within installer::languages::CORE:match which was called 111 times, avg 3µs/call:
# 108 times (350µs+0s) by installer::languages::get_all_languages_for_one_product at line 130, avg 3µs/call
# once (6µs+0s) by installer::languages::get_all_languages_for_one_product at line 125
# once (3µs+0s) by installer::languages::get_all_languages_for_one_product at line 123
# once (2µs+0s) by installer::languages::analyze_languagelist at line 51 | |||||
sub installer::languages::CORE:subst; # opcode |