aboutsummaryrefslogtreecommitdiff
path: root/lib/Gettext.pm6
blob: 55b86518eb6ce6c798e94471075ac9b7732da562 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
use v6.d;
unit module Gettext:ver<0.0.1>;

use NativeCall;

enum LocaleCategory is export (
    # Character classification and case conversion.
    LcCType => 0,
    # Non-monetary numeric formats.
    LcNumeric => 1,
    # Date and time formats.
    LcTime => 2,
    # Collation order.
    LcCollate => 3,
    # Monetary formats.
    LcMonetary => 4,
    # Formats of informative and diagnostic messages and interactive responses.
    LcMessages => 5,
    # For all.
    LcAll => 6,
    # Paper size.
    LcPaper => 7,
    # Name formats.
    LcName => 8,
    # Address formats and location information.
    LcAddress => 9,
    # Telephone number formats.
    LcTelephone => 10,
    # Measurement units (Metric or Other).
    LcMeasurement => 11,
    # Metadata about the locale information.
    LcIdentification => 12,
);

our sub gettext(Str is encoded('utf8') --> Str) is native { … }
sub bindtextdomain(Str:D, Str:D --> Str) is native is export {…}
sub textdomain(Str:D --> Str) is native is export { … }
sub setlocale(int32, Str:D --> Str ) is native is export { … } 

sub _(Str:D $a --> Str) is export { gettext($a) }


=begin pod

=head1 NAME

Gettext - Perl6 binding for L<GNU Gettext|http://www.gnu.org/software/gettext/>

=head1 SYNOPSIS

  use Gettext;

=head1 DESCRIPTION

Gettext is ...

=head1 AUTHOR

Matias Linares <matiaslina@gmail.com>

=head1 COPYRIGHT AND LICENSE

Copyright 2018 Matias Linares

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

=end pod