package LATMOS::Accounts::I18N;
use 5.010000;
use strict;
use warnings;
use Exporter ();
use vars qw(@ISA @EXPORT_OK @EXPORT);
use utf8;
use LATMOS::Accounts::Log;
use Locale::gettext;
use POSIX ();

our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0];

=head1 NAME

LATMOS::Accounts::Utils - Utils functions

=cut

@ISA = qw(Exporter);
@EXPORT = 'l';
@EXPORT_OK = 'l';

my $init;

if (!$init) {
    if (-d 'po') {
        Locale::gettext::bindtextdomain('linkaccounts', 'po')
    }
    Locale::gettext::bind_textdomain_codeset('linkaccounts', 'UTF-8');
    $init = 1;
}

=head1 FUNCTIONS

=head2 l($text, @args)

Return the translate messsage, using printf.

=cut

sub l { 
    my ($text, @args) = @_;
    my $trans = Locale::gettext::dgettext('linkaccounts', $text || '');

    return sprintf($trans || $text, @args);
}

1;

__END__

=head1 SEE ALSO

L<sudo>

=head1 AUTHOR

Olivier Thauvin, E<lt>olivier.thauvin@aerov.jussieu.frE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.

=cut
