source: app/dist/common/utt_make_config.pl @ 52bccea

help
Last change on this file since 52bccea was 25ae32e, checked in by obrebski <obrebski@…>, 17 years ago

git-svn-id: svn://atos.wmid.amu.edu.pl/utt@4 e293616e-ec6a-49c2-aa92-f4a8b91c5d16

  • Property mode set to 100644
File size: 1.5 KB
Line 
1#!/usr/bin/perl
2
3use Cwd 'abs_path';
4use File::Basename;
5use POSIX;
6
7my $cur_dir = dirname(abs_path($0));
8
9open(FILE, ">$cur_dir/conf/utt.conf");
10
11# we put some description into utt.conf file
12print FILE "# ************************************************************\n";
13print FILE "# * This file was created automatically during installation. *\n";
14print FILE "# * If you don't need do not change it.                      *\n";
15print FILE "# *                                                          *\n";
16print FILE "# * UAM Text Tools                                           *\n";
17print FILE "# * Adam Mickiewicz University, Poland                       *\n";
18print FILE "# * http://utt.amu.edu.pl                                    *\n";
19print FILE "# ************************************************************\n";
20print FILE "\n\n";
21
22# we need utt home directory
23print FILE "# absolute path to utt directory\n";
24print FILE "UTT_HOME=$cur_dir\n\n";
25
26
27# we need user default locale
28$best_locale = findLocale();
29print FILE "# user locale\n";
30print FILE "UTT_LOCALE=$best_locale\n";
31print FILE "\n";
32
33close FILE;
34
35
36
37sub findLocale() {
38        $cur_locale = setlocale(LC_CTYPE);
39
40        # we replace Latinx to ISO-8859-x
41        $cur_locale =~ s/(.+?)Latin(.+?)/$1ISO\-8859\-$2/g;
42
43        if($cur_locale =~ /\w+_\w+\.\S+/) {
44          $best_locale = $cur_locale;
45        }
46        elsif($cur_locale =~ /\w+_\w+/) {
47          $best_locale = $cur_locale.".UTF-8";
48        }
49        else {
50          $best_locale = toupper($cur_locale).'_'.tolower($cur_locale).'.UTF-8';
51        }
52        return $best_locale;
53}
Note: See TracBrowser for help on using the repository browser.