xref: /aoo41x/main/i18npool/source/isolang/langid.pl (revision cdf0e10c)
1*cdf0e10cSrcweir: # -*- perl -*-  vim: ft=perl
2*cdf0e10cSrcweireval 'exec perl -w -S $0 ${1+"$@"}'
3*cdf0e10cSrcweirif 0;
4*cdf0e10cSrcweir#*************************************************************************
5*cdf0e10cSrcweir#
6*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7*cdf0e10cSrcweir#
8*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates.
9*cdf0e10cSrcweir#
10*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
11*cdf0e10cSrcweir#
12*cdf0e10cSrcweir# This file is part of OpenOffice.org.
13*cdf0e10cSrcweir#
14*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
15*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
16*cdf0e10cSrcweir# only, as published by the Free Software Foundation.
17*cdf0e10cSrcweir#
18*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
19*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
20*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
22*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
23*cdf0e10cSrcweir#
24*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
25*cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
26*cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
27*cdf0e10cSrcweir# for a copy of the LGPLv3 License.
28*cdf0e10cSrcweir#
29*cdf0e10cSrcweir#*************************************************************************
30*cdf0e10cSrcweir
31*cdf0e10cSrcweir# See Usage() below or invoke without arguments for short instructions.
32*cdf0e10cSrcweir# For long instructions use the source, Luke ;-)
33*cdf0e10cSrcweir
34*cdf0e10cSrcweiruse strict;
35*cdf0e10cSrcweir
36*cdf0e10cSrcweirsub Usage()
37*cdf0e10cSrcweir{
38*cdf0e10cSrcweir    print STDERR
39*cdf0e10cSrcweir        "\n",
40*cdf0e10cSrcweir        "langid - a hackish utility to lookup lang.h language defines and LangIDs,\n",
41*cdf0e10cSrcweir        "isolang.cxx ISO639/ISO3166 mapping, locale data files, langtab.src language\n",
42*cdf0e10cSrcweir        "listbox entries, postset.mk, file_ooo.scp registry name, globals.pm and\n",
43*cdf0e10cSrcweir        "msi-encodinglist.txt\n\n",
44*cdf0e10cSrcweir
45*cdf0e10cSrcweir        "Usage: $0 [--single] {language string} | {LangID} | {primarylanguage sublanguage} | {language-country}\n\n",
46*cdf0e10cSrcweir
47*cdf0e10cSrcweir        "A language string will be used as a generic string match in all searched files.\n",
48*cdf0e10cSrcweir        "You may enclose the language string in word delimiters,\n",
49*cdf0e10cSrcweir        "e.g. \\blanguage_german\\b for a specific match.\n",
50*cdf0e10cSrcweir        "If the language string expression matches more than one define,\n",
51*cdf0e10cSrcweir        "e.g. as in 'german', all matching defines will be processed.\n",
52*cdf0e10cSrcweir        "If the language string does not match a define or an identifier in\n",
53*cdf0e10cSrcweir        "langtab.src, a generic string match of the listbox entries will be tried.\n\n",
54*cdf0e10cSrcweir
55*cdf0e10cSrcweir        "Numeric values of LangID,primarylanguage,sublanguage can be given\n",
56*cdf0e10cSrcweir        "decimal, hexagesimal (leading 0x), octal (leading 0) or binary (leading 0b).\n",
57*cdf0e10cSrcweir        "The exact language_define of an exact match will be used in remaining lookups.\n\n",
58*cdf0e10cSrcweir
59*cdf0e10cSrcweir        "A language-country pair will lookup a xx-YY mapping from isolang.cxx,\n",
60*cdf0e10cSrcweir        "for example: 'en-US' or 'de-' or '-CH',\n",
61*cdf0e10cSrcweir        "xx and YY can be given case insensitive, will be lowered-uppered internally,\n",
62*cdf0e10cSrcweir        "and xx and YY themselfs may be regular expressions.\n",
63*cdf0e10cSrcweir        "Also here a list of matches will be processed.\n\n",
64*cdf0e10cSrcweir
65*cdf0e10cSrcweir        "If option --single is given, only the first match will be processed.\n\n";
66*cdf0e10cSrcweir}
67*cdf0e10cSrcweir
68*cdf0e10cSrcweirmy $SOLARVERSION = $ENV{"SOLARVERSION"};
69*cdf0e10cSrcweirmy $INPATH       = $ENV{"INPATH"};
70*cdf0e10cSrcweirmy $SRC_ROOT     = $ENV{"SRC_ROOT"};
71*cdf0e10cSrcweirmy $UPDMINOREXT  = $ENV{"UPDMINOREXT"};
72*cdf0e10cSrcweirif (!defined($SOLARVERSION) || !defined($INPATH) || !defined($SRC_ROOT))
73*cdf0e10cSrcweir{
74*cdf0e10cSrcweir    print "\nNeed \$SOLARVERSION, \$INPATH and \$SRC_ROOT, please set your OOo environment!\n";
75*cdf0e10cSrcweir    Usage();
76*cdf0e10cSrcweir    exit 1;
77*cdf0e10cSrcweir}
78*cdf0e10cSrcweirif (!defined($UPDMINOREXT)) {
79*cdf0e10cSrcweir    $UPDMINOREXT  = '';
80*cdf0e10cSrcweir}
81*cdf0e10cSrcweirmy $SOLENVINC = "$SOLARVERSION/$INPATH/inc$UPDMINOREXT";
82*cdf0e10cSrcweir
83*cdf0e10cSrcweirmy $LANGUAGE_MASK_PRIMARY = 0x03ff;
84*cdf0e10cSrcweir
85*cdf0e10cSrcweirsub getPrimaryLanguage($)
86*cdf0e10cSrcweir{
87*cdf0e10cSrcweir    my($lcid) = @_;
88*cdf0e10cSrcweir    return $lcid & $LANGUAGE_MASK_PRIMARY;
89*cdf0e10cSrcweir}
90*cdf0e10cSrcweir
91*cdf0e10cSrcweirsub getSubLanguage($)
92*cdf0e10cSrcweir{
93*cdf0e10cSrcweir    my($lcid) = @_;
94*cdf0e10cSrcweir    return $lcid >> 10;
95*cdf0e10cSrcweir}
96*cdf0e10cSrcweir
97*cdf0e10cSrcweirsub makeLangID($$)
98*cdf0e10cSrcweir{
99*cdf0e10cSrcweir    my( $sub, $pri) = @_;
100*cdf0e10cSrcweir    return ($sub << 10) | $pri;
101*cdf0e10cSrcweir}
102*cdf0e10cSrcweir
103*cdf0e10cSrcweir
104*cdf0e10cSrcweirsub grepFile($$$$@)
105*cdf0e10cSrcweir{
106*cdf0e10cSrcweir    my( $regex, $path, $module, $name, @addregex) = @_;
107*cdf0e10cSrcweir    my @result;
108*cdf0e10cSrcweir    my $found = 0;
109*cdf0e10cSrcweir    my $areopen = 0;
110*cdf0e10cSrcweir    my $arecloser = '';
111*cdf0e10cSrcweir    my $file;
112*cdf0e10cSrcweir    # Try module under current working directory first to catch local
113*cdf0e10cSrcweir    # modifications. A Not yet delivered lang.h is a special case.
114*cdf0e10cSrcweir    if ("$path/$module/$name" eq "$SOLENVINC/i18npool/lang.h") {
115*cdf0e10cSrcweir        $file = "./$module/inc/i18npool/lang.h"; }
116*cdf0e10cSrcweir    else {
117*cdf0e10cSrcweir        $file = "./$module/$name"; }
118*cdf0e10cSrcweir    if (!($found = open( IN, $file)))
119*cdf0e10cSrcweir    {
120*cdf0e10cSrcweir        # Then with the given path.
121*cdf0e10cSrcweir        $file = "$path/$module/$name";
122*cdf0e10cSrcweir        if (!($found = open( IN, $file)))
123*cdf0e10cSrcweir        {
124*cdf0e10cSrcweir            print "No $file\n";
125*cdf0e10cSrcweir            $file = "$path/$module.lnk/$name";
126*cdf0e10cSrcweir            if (!($found = open( IN, $file))) {
127*cdf0e10cSrcweir                print "No $file.\n";
128*cdf0e10cSrcweir                $file = "$path/$module.link/$name";
129*cdf0e10cSrcweir                if (!($found = open( IN, $file))) {
130*cdf0e10cSrcweir                    print "No $file either.\n"; }
131*cdf0e10cSrcweir            }
132*cdf0e10cSrcweir        }
133*cdf0e10cSrcweir    }
134*cdf0e10cSrcweir    if ($found)
135*cdf0e10cSrcweir    {
136*cdf0e10cSrcweir        $found = 0;
137*cdf0e10cSrcweir        while (my $line = <IN>)
138*cdf0e10cSrcweir        {
139*cdf0e10cSrcweir            if ($line =~ /$regex/)
140*cdf0e10cSrcweir            {
141*cdf0e10cSrcweir                if (!$found)
142*cdf0e10cSrcweir                {
143*cdf0e10cSrcweir                    $found = 1;
144*cdf0e10cSrcweir                    print "$file:\n";
145*cdf0e10cSrcweir                }
146*cdf0e10cSrcweir                chomp( $line);
147*cdf0e10cSrcweir                print "$line\n";
148*cdf0e10cSrcweir                push( @result, $line);
149*cdf0e10cSrcweir            }
150*cdf0e10cSrcweir            elsif (@addregex)
151*cdf0e10cSrcweir            {
152*cdf0e10cSrcweir                # By convention first element is opener, second element is closer.
153*cdf0e10cSrcweir                if (!$areopen)
154*cdf0e10cSrcweir                {
155*cdf0e10cSrcweir                    if ($line =~ /$addregex[0]/)
156*cdf0e10cSrcweir                    {
157*cdf0e10cSrcweir                        $areopen = 1;
158*cdf0e10cSrcweir                        $arecloser = $addregex[1];
159*cdf0e10cSrcweir                    }
160*cdf0e10cSrcweir                }
161*cdf0e10cSrcweir                if ($areopen)
162*cdf0e10cSrcweir                {
163*cdf0e10cSrcweir                    for (my $i = 2; $i < @addregex; ++$i)
164*cdf0e10cSrcweir                    {
165*cdf0e10cSrcweir                        if ($line =~ /$addregex[$i]/)
166*cdf0e10cSrcweir                        {
167*cdf0e10cSrcweir                            if (!$found)
168*cdf0e10cSrcweir                            {
169*cdf0e10cSrcweir                                $found = 1;
170*cdf0e10cSrcweir                                print "$file:\n";
171*cdf0e10cSrcweir                            }
172*cdf0e10cSrcweir                            chomp( $line);
173*cdf0e10cSrcweir                            print "$line\n";
174*cdf0e10cSrcweir                            push( @result, $line);
175*cdf0e10cSrcweir                        }
176*cdf0e10cSrcweir                    }
177*cdf0e10cSrcweir                    if ($line =~ /$arecloser/)
178*cdf0e10cSrcweir                    {
179*cdf0e10cSrcweir                        $areopen = 0;
180*cdf0e10cSrcweir                    }
181*cdf0e10cSrcweir                }
182*cdf0e10cSrcweir            }
183*cdf0e10cSrcweir        }
184*cdf0e10cSrcweir        close( IN);
185*cdf0e10cSrcweir    }
186*cdf0e10cSrcweir    if (!$found) {
187*cdf0e10cSrcweir        print "Not found in $file\n";
188*cdf0e10cSrcweir        #print "Not found in $file for $regex @addregex\n";
189*cdf0e10cSrcweir    }
190*cdf0e10cSrcweir    return @result;
191*cdf0e10cSrcweir}
192*cdf0e10cSrcweir
193*cdf0e10cSrcweir
194*cdf0e10cSrcweirsub main()
195*cdf0e10cSrcweir{
196*cdf0e10cSrcweir    my( $lcid, @parts, $grepdef, $options, $single);
197*cdf0e10cSrcweir    $grepdef = 0;
198*cdf0e10cSrcweir    $single = 0;
199*cdf0e10cSrcweir    for ($options = 0; $options < @ARGV && $ARGV[$options] =~ /^--/; ++$options)
200*cdf0e10cSrcweir    {
201*cdf0e10cSrcweir        if ($ARGV[$options] eq '--single') { $single = 1; }
202*cdf0e10cSrcweir        else { print "Unknown option: $ARGV[$options]\n"; }
203*cdf0e10cSrcweir    }
204*cdf0e10cSrcweir    if (@ARGV == 1 + $options)
205*cdf0e10cSrcweir    {
206*cdf0e10cSrcweir        # 0x hex, 0b bin, 0 oct
207*cdf0e10cSrcweir        if ($ARGV[$options] =~ /^0/) {
208*cdf0e10cSrcweir            $lcid = oct( $ARGV[0]); }
209*cdf0e10cSrcweir        elsif ($ARGV[$options] =~ /^[0-9]/) {
210*cdf0e10cSrcweir            $lcid = $ARGV[$options]; }
211*cdf0e10cSrcweir        else
212*cdf0e10cSrcweir        {
213*cdf0e10cSrcweir            $grepdef = $ARGV[$options];
214*cdf0e10cSrcweir            $lcid = 0;
215*cdf0e10cSrcweir        }
216*cdf0e10cSrcweir        $parts[0] = getPrimaryLanguage( $lcid);
217*cdf0e10cSrcweir        $parts[1] = getSubLanguage( $lcid);
218*cdf0e10cSrcweir    }
219*cdf0e10cSrcweir    elsif (@ARGV == 2 + $options)
220*cdf0e10cSrcweir    {
221*cdf0e10cSrcweir        for (my $i = $options; $i < 2 + $options; ++$i)
222*cdf0e10cSrcweir        {
223*cdf0e10cSrcweir            if ($ARGV[$i] =~ /^0/) {
224*cdf0e10cSrcweir                $parts[$i] = oct( $ARGV[$i]); }
225*cdf0e10cSrcweir            else {
226*cdf0e10cSrcweir                $parts[$i] = $ARGV[$i]; }
227*cdf0e10cSrcweir        }
228*cdf0e10cSrcweir        $lcid = makeLangID( $parts[1], $parts[0]);
229*cdf0e10cSrcweir    }
230*cdf0e10cSrcweir    else
231*cdf0e10cSrcweir    {
232*cdf0e10cSrcweir        Usage();
233*cdf0e10cSrcweir        return 1;
234*cdf0e10cSrcweir    }
235*cdf0e10cSrcweir    my $modifier = "(?i)";
236*cdf0e10cSrcweir    my (@resultlist, @greplist, $result);
237*cdf0e10cSrcweir    # If no string was given on the command line, but value(s) were, lookup the
238*cdf0e10cSrcweir    # LangID value to obtain the define identifier.
239*cdf0e10cSrcweir    if ($grepdef)
240*cdf0e10cSrcweir    {
241*cdf0e10cSrcweir        # #define LANGUAGE_AFRIKAANS                  0x0436
242*cdf0e10cSrcweir        @resultlist = grepFile(
243*cdf0e10cSrcweir            $modifier . '^\s*#\s*define\s+[A-Z_]*' . $grepdef,
244*cdf0e10cSrcweir            $SOLENVINC, "i18npool", "lang.h", ());
245*cdf0e10cSrcweir    }
246*cdf0e10cSrcweir    else
247*cdf0e10cSrcweir    {
248*cdf0e10cSrcweir        printf( "LangID: 0x%04X (dec %d), primary: 0x%03x, sub 0x%02x\n", $lcid,
249*cdf0e10cSrcweir                $lcid, $parts[0], $parts[1]);
250*cdf0e10cSrcweir        my $buf = sprintf( "0x%04X", $lcid);
251*cdf0e10cSrcweir        @resultlist = grepFile(
252*cdf0e10cSrcweir            '^\s*#\s*define\s+\w+\s+' . $buf,
253*cdf0e10cSrcweir            $SOLENVINC, "i18npool", "lang.h", ());
254*cdf0e10cSrcweir    }
255*cdf0e10cSrcweir    for $result (@resultlist)
256*cdf0e10cSrcweir    {
257*cdf0e10cSrcweir        # #define LANGUAGE_AFRIKAANS                  0x0436
258*cdf0e10cSrcweir        if ($result =~ /^\s*#\s*define\s+(\w+)\s+(0x[0-9a-fA-F]+)/)
259*cdf0e10cSrcweir        {
260*cdf0e10cSrcweir            push( @greplist, '\b' . $1 . '\b');
261*cdf0e10cSrcweir            $modifier = "";     # complete identifier now case sensitive
262*cdf0e10cSrcweir            if ($single) {
263*cdf0e10cSrcweir                last; }
264*cdf0e10cSrcweir        }
265*cdf0e10cSrcweir    }
266*cdf0e10cSrcweir    # If the string given is of the form xx-yy lookup a language,country pair
267*cdf0e10cSrcweir    # to obtain the define identifier. xx and yy themselfs may be regexps.
268*cdf0e10cSrcweir    # xx- is a short form for 'xx-.*' and -yy a short form for '.*-yy'
269*cdf0e10cSrcweir    if ($grepdef =~ /^(.*)-$/) {
270*cdf0e10cSrcweir        $grepdef = $1 . "-.*"; }
271*cdf0e10cSrcweir    if ($grepdef =~ /^-(.*)$/) {
272*cdf0e10cSrcweir        $grepdef = ".*-" . $1; }
273*cdf0e10cSrcweir    if ($grepdef =~ /^(.*)-(.*)$/)
274*cdf0e10cSrcweir    {
275*cdf0e10cSrcweir        my $lang = $1;
276*cdf0e10cSrcweir        my $coun = $2;
277*cdf0e10cSrcweir        $lang = lc($lang);
278*cdf0e10cSrcweir        $coun = uc($coun);
279*cdf0e10cSrcweir        #     { LANGUAGE_AFRIKAANS,                   "af", "ZA" },
280*cdf0e10cSrcweir        @resultlist = grepFile(
281*cdf0e10cSrcweir            '^\s*\{\s*\w+\s*,\s*\"' . $lang . '\"\s*,\s*\"'  . $coun . '\"\s*\}\s*,',
282*cdf0e10cSrcweir            "$SRC_ROOT", "i18npool", "source/isolang/isolang.cxx", ());
283*cdf0e10cSrcweir        for $result (@resultlist)
284*cdf0e10cSrcweir        {
285*cdf0e10cSrcweir            if ($result =~ /^\s*\{\s*(\w+)\s*,\s*\"\w+\"\s*,\s*\"(\w+)?\"\s*\}\s*,/)
286*cdf0e10cSrcweir            {
287*cdf0e10cSrcweir                push( @greplist, '\b' . $1 . '\b');
288*cdf0e10cSrcweir                $modifier = "";     # complete identifier now case sensitive
289*cdf0e10cSrcweir                if ($single) {
290*cdf0e10cSrcweir                    last; }
291*cdf0e10cSrcweir            }
292*cdf0e10cSrcweir        }
293*cdf0e10cSrcweir        $grepdef = 0;
294*cdf0e10cSrcweir    }
295*cdf0e10cSrcweir    if (!@greplist && $grepdef) {
296*cdf0e10cSrcweir        push( @greplist, $grepdef); }
297*cdf0e10cSrcweir    for $grepdef (@greplist)
298*cdf0e10cSrcweir    {
299*cdf0e10cSrcweir        print "\nUsing: " . $grepdef . "\n";
300*cdf0e10cSrcweir
301*cdf0e10cSrcweir        # Decimal LCID, was needed for Langpack.ulf but isn't used anymore,
302*cdf0e10cSrcweir        # keep just in case we'd need it again.
303*cdf0e10cSrcweir        # #define LANGUAGE_AFRIKAANS                  0x0436
304*cdf0e10cSrcweir        @resultlist = grepFile(
305*cdf0e10cSrcweir            $modifier . '^\s*#\s*define\s+[A-Z_]*' . $grepdef,
306*cdf0e10cSrcweir            $SOLENVINC, "i18npool", "lang.h", ());
307*cdf0e10cSrcweir        my @lcidlist;
308*cdf0e10cSrcweir        for $result (@resultlist)
309*cdf0e10cSrcweir        {
310*cdf0e10cSrcweir            # #define LANGUAGE_AFRIKAANS                  0x0436
311*cdf0e10cSrcweir            if ($result =~ /^\s*#\s*define\s+(\w+)\s+(0x[0-9a-fA-F]+)/)
312*cdf0e10cSrcweir            {
313*cdf0e10cSrcweir                push( @lcidlist, oct( $2));
314*cdf0e10cSrcweir            }
315*cdf0e10cSrcweir        }
316*cdf0e10cSrcweir
317*cdf0e10cSrcweir        #     { LANGUAGE_AFRIKAANS,                   "af", "ZA" },
318*cdf0e10cSrcweir        @resultlist = grepFile(
319*cdf0e10cSrcweir            $modifier . '^\s*\{\s*.*' . $grepdef . '.*\s*,\s*\".*\"\s*,\s*\".*\"\s*\}\s*,',
320*cdf0e10cSrcweir            "$SRC_ROOT", "i18npool", "source/isolang/isolang.cxx", ());
321*cdf0e10cSrcweir
322*cdf0e10cSrcweir        my @langcoungreplist;
323*cdf0e10cSrcweir        for $result (@resultlist)
324*cdf0e10cSrcweir        {
325*cdf0e10cSrcweir            if ($result =~ /^\s*\{\s*\w+\s*,\s*\"(\w+)\"\s*,\s*\"(\w+)?\"\s*\}\s*,/)
326*cdf0e10cSrcweir            {
327*cdf0e10cSrcweir                my $lang = $1;
328*cdf0e10cSrcweir                my $coun = $2;
329*cdf0e10cSrcweir                my $loca;
330*cdf0e10cSrcweir                if ($coun)
331*cdf0e10cSrcweir                {
332*cdf0e10cSrcweir                    $loca = $lang . "_" . $coun;
333*cdf0e10cSrcweir                    push( @langcoungreplist, '\b' . $lang . '\b(-' . $coun . ')?');
334*cdf0e10cSrcweir                }
335*cdf0e10cSrcweir                else
336*cdf0e10cSrcweir                {
337*cdf0e10cSrcweir                    $loca = $lang;
338*cdf0e10cSrcweir                    $coun = "";
339*cdf0e10cSrcweir                    push( @langcoungreplist, '\b' . $lang . '\b');
340*cdf0e10cSrcweir                }
341*cdf0e10cSrcweir                my $file = "$SRC_ROOT/i18npool/source/localedata/data/$loca.xml";
342*cdf0e10cSrcweir                my $found;
343*cdf0e10cSrcweir                if (!($found = open( LD, $file)))
344*cdf0e10cSrcweir                {
345*cdf0e10cSrcweir                    $file = "$SRC_ROOT/i18npool.lnk/source/localedata/data/$loca.xml";
346*cdf0e10cSrcweir                    if (!($found = open( LD, $file)))
347*cdf0e10cSrcweir                    {
348*cdf0e10cSrcweir                        $file = "$SRC_ROOT/i18npool.link/source/localedata/data/$loca.xml";
349*cdf0e10cSrcweir                        $found = open( LD, $file);
350*cdf0e10cSrcweir                    }
351*cdf0e10cSrcweir                }
352*cdf0e10cSrcweir                if ($found)
353*cdf0e10cSrcweir                {
354*cdf0e10cSrcweir                    print "Found $file:\n";
355*cdf0e10cSrcweir                    my $on = 0;
356*cdf0e10cSrcweir                    while (my $line = <LD>)
357*cdf0e10cSrcweir                    {
358*cdf0e10cSrcweir                        if ($line =~ /<(Language|Country)>/) {
359*cdf0e10cSrcweir                            $on = 1; }
360*cdf0e10cSrcweir                        if ($on) {
361*cdf0e10cSrcweir                            print $line; }
362*cdf0e10cSrcweir                        if ($line =~ /<\/(Language|Country)>/) {
363*cdf0e10cSrcweir                            $on = 0; }
364*cdf0e10cSrcweir                    }
365*cdf0e10cSrcweir                    close( LD);
366*cdf0e10cSrcweir                }
367*cdf0e10cSrcweir                else {
368*cdf0e10cSrcweir                    print "No $SRC_ROOT/i18npool/source/localedata/data/$loca.xml\n"; }
369*cdf0e10cSrcweir            }
370*cdf0e10cSrcweir        }
371*cdf0e10cSrcweir
372*cdf0e10cSrcweir        #         case LANGUAGE_ARABIC:
373*cdf0e10cSrcweir        grepFile(
374*cdf0e10cSrcweir            $modifier . '^\s*case\s*.*' . $grepdef . '.*\s*:',
375*cdf0e10cSrcweir            "$SRC_ROOT", "i18npool", "source/isolang/mslangid.cxx", ());
376*cdf0e10cSrcweir
377*cdf0e10cSrcweir        # With CWS 'langstatusbar' the language listbox resource file gets a new location.
378*cdf0e10cSrcweir        my $module = "svx";
379*cdf0e10cSrcweir        my $name = "source/dialog/langtab.src";
380*cdf0e10cSrcweir        if (!(-e "$SRC_ROOT/$module/$name")) {
381*cdf0e10cSrcweir            $module = "svtools";
382*cdf0e10cSrcweir            $name = "source/misc/langtab.src";
383*cdf0e10cSrcweir        }
384*cdf0e10cSrcweir        #         < "Afrikaans" ; LANGUAGE_AFRIKAANS ; > ;
385*cdf0e10cSrcweir        # lookup define
386*cdf0e10cSrcweir        @resultlist = grepFile(
387*cdf0e10cSrcweir            $modifier . '^\s*<\s*\".*\"\s*;\s*.*' . $grepdef . '.*\s*;\s*>\s*;',
388*cdf0e10cSrcweir            "$SRC_ROOT", $module, $name, ());
389*cdf0e10cSrcweir        # lookup string
390*cdf0e10cSrcweir        if (!@resultlist) {
391*cdf0e10cSrcweir            grepFile(
392*cdf0e10cSrcweir                $modifier . '^\s*<\s*\".*' . $grepdef . '.*\"\s*;\s*.*\s*;\s*>\s*;',
393*cdf0e10cSrcweir                "$SRC_ROOT", $module, $name, ()); }
394*cdf0e10cSrcweir
395*cdf0e10cSrcweir        for my $langcoun (@langcoungreplist)
396*cdf0e10cSrcweir        {
397*cdf0e10cSrcweir            # Name (xxx) = "/registry/spool/org/openoffice/Office/Common-ctl.xcu";
398*cdf0e10cSrcweir            grepFile(
399*cdf0e10cSrcweir                '^\s*Name\s*\(' . $langcoun . '\)\s*=',
400*cdf0e10cSrcweir                "$SRC_ROOT", "scp2", "source/ooo/file_ooo.scp", ());
401*cdf0e10cSrcweir
402*cdf0e10cSrcweir            # completelangiso=af ar as-IN ... zu
403*cdf0e10cSrcweir            grepFile(
404*cdf0e10cSrcweir                '^\s*completelangiso\s*=\s*(\s*([a-z]{2,3})(-[A-Z][A-Z])?)*' . $langcoun . '',
405*cdf0e10cSrcweir                "$SRC_ROOT", "solenv", "inc/postset.mk",
406*cdf0e10cSrcweir                # needs a duplicated pair of backslashes to produce a literal \\
407*cdf0e10cSrcweir                ('^\s*completelangiso\s*=', '^\s*$', '^\s*' . $langcoun . '\s*\\\\*$'));
408*cdf0e10cSrcweir
409*cdf0e10cSrcweir            # @noMSLocaleLangs = ( "br", "bs", ... )
410*cdf0e10cSrcweir            grepFile(
411*cdf0e10cSrcweir                '^\s*@noMSLocaleLangs\s*=\s*\(\s*(\s*"([a-z]{2,3})(-[A-Z][A-Z])?"\s*,?)*' . $langcoun . '',
412*cdf0e10cSrcweir                "$SRC_ROOT", "solenv", "bin/modules/installer/globals.pm",
413*cdf0e10cSrcweir                ('^\s*@noMSLocaleLangs\s*=', '\)\s*$', '"' . $langcoun . '"'));
414*cdf0e10cSrcweir
415*cdf0e10cSrcweir            # af    1252  1078   # Afrikaans
416*cdf0e10cSrcweir            grepFile(
417*cdf0e10cSrcweir                '^\s*' . $langcoun . '',
418*cdf0e10cSrcweir                "$SRC_ROOT", "setup_native", "source/win32/msi-encodinglist.txt", ());
419*cdf0e10cSrcweir        }
420*cdf0e10cSrcweir    }
421*cdf0e10cSrcweir    return 0;
422*cdf0e10cSrcweir}
423*cdf0e10cSrcweir
424*cdf0e10cSrcweirmain();
425