update dev300-m58
[ooovba.git] / solenv / bin / pre2par.pl
blob639b59b336f4daecb840538e68ed9673b128050e
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2008 by Sun Microsystems, Inc.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # $RCSfile: pre2par.pl,v $
11 # $Revision: 1.8 $
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
32 use lib ("$ENV{SOLARENV}/bin/modules");
34 use Cwd;
35 use pre2par::directory;
36 use pre2par::files;
37 use pre2par::globals;
38 use pre2par::language;
39 use pre2par::parameter;
40 use pre2par::work;
42 ####################################
43 # Main program
44 ####################################
46 pre2par::parameter::getparameter();
47 pre2par::parameter::control_parameter();
49 pre2par::directory::check_directory($pre2par::globals::parfilename);
51 my $prefile = pre2par::files::read_file($pre2par::globals::prefilename);
53 pre2par::work::check_content($prefile, $pre2par::globals::prefilename);
55 my $parfile = pre2par::work::convert($prefile);
57 pre2par::work::formatter($parfile);
59 my $langfilename = pre2par::work::getlangfilename();
60 my $ulffilename = pre2par::work::getulffilename($pre2par::globals::prefilename);
62 my $dolocalization = pre2par::work::check_existence_of_langfiles($langfilename, $ulffilename);
64 if ( $dolocalization )
66 my $langfile = pre2par::files::read_file($langfilename);
67 pre2par::language::localize($parfile, $langfile);
70 pre2par::files::save_file($pre2par::globals::parfilename, $parfile);
72 # checking of par file was written correctly
73 my $parfilecomp = pre2par::files::read_file($pre2par::globals::parfilename);
74 pre2par::work::diff_content($parfile, $parfilecomp, $pre2par::globals::parfilename);
76 ####################################
77 # End main program
78 ####################################