xref: /aoo41x/main/solenv/bin/pre2par.pl (revision 7e90fac2)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24use lib ("$ENV{SOLARENV}/bin/modules");
25
26use Cwd;
27use pre2par::directory;
28use pre2par::files;
29use pre2par::globals;
30use pre2par::language;
31use pre2par::parameter;
32use pre2par::work;
33
34####################################
35# Main program
36####################################
37
38pre2par::parameter::getparameter();
39pre2par::parameter::control_parameter();
40
41pre2par::directory::check_directory($pre2par::globals::parfilename);
42
43my $prefile = pre2par::files::read_file($pre2par::globals::prefilename);
44
45pre2par::work::check_content($prefile, $pre2par::globals::prefilename);
46
47my $parfile = pre2par::work::convert($prefile);
48
49pre2par::work::formatter($parfile);
50
51my $langfilename = pre2par::work::getlangfilename();
52my $ulffilename = pre2par::work::getulffilename($pre2par::globals::prefilename);
53
54my $dolocalization = pre2par::work::check_existence_of_langfiles($langfilename, $ulffilename);
55
56if ( $dolocalization )
57{
58	my $langfile = pre2par::files::read_file($langfilename);
59	pre2par::language::localize($parfile, $langfile);
60}
61
62pre2par::files::save_file($pre2par::globals::parfilename, $parfile);
63
64# checking of par file was written correctly
65my $parfilecomp = pre2par::files::read_file($pre2par::globals::parfilename);
66pre2par::work::diff_content($parfile, $parfilecomp, $pre2par::globals::parfilename);
67
68####################################
69# End main program
70####################################
71