File: JWCI18N.pm

package info (click to toggle)
jwchat 1.0%2Bdfsg-1.3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,944 kB
  • ctags: 372
  • sloc: perl: 479; xml: 462; java: 116; sh: 108; makefile: 54
file content (56 lines) | stat: -rw-r--r-- 1,220 bytes parent folder | download | duplicates (5)
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
54
55
56
#!/usr/bin/perl -w


package JWCI18N;
use base qw(Locale::Maketext);

use Locale::Maketext 1.01;
use Locale::Maketext::Lexicon 0.10;
use base ('Locale::Maketext::Fuzzy');
use vars qw( %Lexicon );


%Lexicon = (
    '__Content-Type' => 'text/plain; charset=utf-8',

  '_AUTO' => 1,
  # That means that lookup failures can't happen -- if we get as far
  #  as looking for something in this lexicon, and we don't find it,
  #  then automagically set $Lexicon{$key} = $key, before possibly
  #  compiling it.
 
  # The exception is keys that start with "_" -- they aren't auto-makeable.

);
# End of lexicon.



sub Init {
    # Load language-specific functions
    foreach my $language ( glob("po/*.pm")) {
        if ($language =~ /^([-\w.\/\\~:]+)$/) {
            require $1;
        }
        else {
            warn("$language is tainted. not loading");
        }
    }

    # Acquire all .po files and iterate them into lexicons
    Locale::Maketext::Lexicon->import({
        _decode => 1,
	_AUTO   => 1,
        '*'     => [
            Gettext => ("po/*.po")
        ],
    });
    return 1;
}

  
  # And, assuming you want the base class to be an _AUTO lexicon,
  # as is discussed a few sections up:
  
  1;