File: Gettext.pm

package info (click to toggle)
debconf 1.5.11etch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,364 kB
  • ctags: 714
  • sloc: perl: 8,347; sh: 286; makefile: 174; python: 117
file content (53 lines) | stat: -rw-r--r-- 1,155 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl -w

=head1 NAME

Debconf::Gettext - Enables gettext for internationalization.

=cut

package Debconf::Gettext;
use strict;

=head1 DESCRIPTION

This module should be used by any part of debconf that is internationalized
and uses the gettext() function to get translated text. This module will
attempt to use Locale::gettext to provide the gettext() function. However,
since debconf must be usable on the base system, which does not include
Locale::gettext, it will detect if loading the module fails, and fall back
to providing a gettext() function that only works in the C locale.

This module also calls textdomain() if possible; the domain used by debconf
is "debconf".

=cut

BEGIN {
	eval 'use Locale::gettext';
	if ($@) {
		# Failed; make up and export our own stupid gettext() function.
		eval q{
			sub gettext {
				return shift;
			}
		};
	}
	else {
		# Locale::gettext initialized; proceed with setup.
		textdomain('debconf');
	}
}

# Now there is a gettext symbol in our symbol table, which must be exported
# to our caller.
use base qw(Exporter);
our @EXPORT=qw(gettext);

=head1 AUTHOR

Joey Hess <joeyh@debian.org>

=cut

1