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