source: trunk/LATMOS-Accounts/lib/LATMOS/Accounts/I18N.pm @ 2097

Last change on this file since 2097 was 1550, checked in by nanardon, 9 years ago

Translate attribute with their definition

File size: 1.2 KB
Line 
1package LATMOS::Accounts::I18N;
2use 5.010000;
3use strict;
4use warnings;
5use Exporter ();
6use vars qw(@ISA @EXPORT_OK @EXPORT);
7use utf8;
8use LATMOS::Accounts::Log;
9use Locale::gettext;
10use POSIX ();
11
12our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0];
13
14=head1 NAME
15
16LATMOS::Accounts::Utils - Utils functions
17
18=cut
19
20@ISA = qw(Exporter);
21@EXPORT = 'l';
22@EXPORT_OK = 'l';
23
24my $init;
25
26if (!$init) {
27    if (-d 'po') {
28        Locale::gettext::bindtextdomain('linkaccounts', 'po')
29    }
30    Locale::gettext::bind_textdomain_codeset('linkaccounts', 'UTF-8');
31    $init = 1;
32}
33
34=head1 FUNCTIONS
35
36=head2 l($text, @args)
37
38Return the translate messsage, using printf.
39
40=cut
41
42sub l { 
43    my ($text, @args) = @_;
44    my $trans = Locale::gettext::dgettext('linkaccounts', $text || '');
45
46    return sprintf($trans || $text, @args);
47}
48
491;
50
51__END__
52
53=head1 SEE ALSO
54
55L<sudo>
56
57=head1 AUTHOR
58
59Olivier Thauvin, E<lt>olivier.thauvin@aerov.jussieu.frE<gt>
60
61=head1 COPYRIGHT AND LICENSE
62
63Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS
64
65This library is free software; you can redistribute it and/or modify
66it under the same terms as Perl itself, either Perl version 5.10.0 or,
67at your option, any later version of Perl 5 you may have available.
68
69=cut
Note: See TracBrowser for help on using the repository browser.