File: Translation.pm

package info (click to toggle)
gscan2pdf 2.13.5-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,700 kB
  • sloc: perl: 22,713; xml: 81; makefile: 6
file content (40 lines) | stat: -rw-r--r-- 920 bytes parent folder | download
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
package Gscan2pdf::Translation;

use strict;
use warnings;
use Locale::gettext 1.05;    # For translations

BEGIN {
    use Exporter ();
    our ( $VERSION, @EXPORT_OK, %EXPORT_TAGS );

    $VERSION = '2.13.5';

    use base qw(Exporter);
    %EXPORT_TAGS = ();    # eg: TAG => [ qw!name1 name2! ],

    # your exported package globals go here,
    # as well as any optionally exported functions
    @EXPORT_OK = qw( __ );
}

my $d;

sub set_domain {
    my ( $prog_name, $locale ) = @_;
    $d = Locale::gettext->domain($prog_name);
    if ( defined $locale ) { $d->dir($locale) }
    return;
}

# makes it easier to extract strings with xgettext, as using Locale::gettext's
# 'get' as a keyword picks up various false positives, whilst '__' is unique,
# and closer to C's semi-standard '_'.
sub __ {    ## no critic (ProhibitUnusedPrivateSubroutines)
    my ($string) = @_;
    return $d->get($string);
}

1;

__END__