~ubuntu-branches/ubuntu/oneiric/localization-config/oneiric

« back to all changes in this revision

Viewing changes to conffiles.d/sarge/links

  • Committer: Bazaar Package Importer
  • Author(s): Konstantinos Margaritis
  • Date: 2005-05-23 00:36:51 UTC
  • Revision ID: james.westby@ubuntu.com-20050523003651-2xfe4l262j5ij3xa
Tags: 0.116
* Translatios
  - Bulgarian added. Closes: #308129
  - Updated Greek and Vietnamese. Closes: #309055
  - Fixed templates file that included extra test messages for session
  chooser
* Closes forgotten bugs. Closes: #306084, #306052.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
use strict;
5
5
use warnings;
6
6
 
 
7
require '/usr/lib/localization-config/common/log.pl';
 
8
 
7
9
my $file = '/etc/links.cfg';
8
 
my $debug = 0;
9
10
 
10
11
# Define the associative array to hold key/value pairs
11
12
my %lang_map = (
38
39
                );
39
40
 
40
41
# If no locale is given as argument, quit
41
 
my $lang = $ARGV[0] or die "No language given";
 
42
my $lang = $ARGV[0] or log_die("$0: No language given");
42
43
 
43
44
# List supported locales
44
45
if ("supported" eq $lang) {
52
53
# the 'Language' entry in the links config file.
53
54
if(defined(my $conf = $lang_map{$lang})) {
54
55
    my $links_lang = $conf->{'LANGUAGE'};
55
 
    print "Links language: $links_lang\n" if $debug;
 
56
    log_msg("$0: Links language: $links_lang");
56
57
    UpdateCfgFile($file, $links_lang)
57
 
            or die "$0: Can't save file: $!\n";
 
58
            or log_die("$0: Can't save file: $!");
58
59
} else {
59
 
    die "$0: No support for language '$lang'\n";
 
60
    log_msg("$0: No support for language $lang");
 
61
    exit;
60
62
}
61
63
 
62
64
# This is the helper subroutine to change the value of the variable
64
66
# and used throughout the rest of the scripts.
65
67
sub UpdateCfgFile {
66
68
    my ($file, $value) = @_;    
67
 
    my $newline = "language \"$value\"\n";
 
69
    my $newline = "language \"$value\"";
68
70
    my $updated;
69
71
 
70
72
    my @lines;
90
92
    }
91
93
 
92
94
    if ($updated) {
93
 
        print "Updating $file\n" if $debug;
94
 
        open(FILE, ">$file.new") or die "Unable to write to $file.new";
 
95
        log_msg("$0:UpdateCfgFile(): Updating $file");
 
96
        open(FILE, ">$file.new") or log_die("$0:UpdateCfgFile(): wUnable to write to $file.new");
95
97
        print FILE @lines;
96
98
        close(FILE);
97
99
        rename "$file.new", $file;