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