Browse Source

v.0.6.1 - remane to Translate::Fluent

themage
theMage 7 months ago
parent
commit
648f13d509
44 changed files with 290 additions and 281 deletions
  1. 2 0
      .gitignore
  2. 9 2
      Changes
  3. 31 31
      MANIFEST
  4. 4 4
      Makefile.PL
  5. 5 5
      README.md
  6. 0 66
      lib/Locale/Fluent/Elements.pm
  7. 0 16
      lib/Locale/Fluent/Elements/DefaultVariant.pm
  8. 15 15
      lib/Locale/Fluent.pm
  9. 66 0
      lib/Translate/Fluent/Elements.pm
  10. 3 3
      lib/Locale/Fluent/Elements/Argument.pm
  11. 3 3
      lib/Locale/Fluent/Elements/ArgumentList.pm
  12. 3 3
      lib/Locale/Fluent/Elements/Attribute.pm
  13. 3 3
      lib/Locale/Fluent/Elements/AttributeAccessor.pm
  14. 4 4
      lib/Locale/Fluent/Elements/Base.pm
  15. 3 3
      lib/Locale/Fluent/Elements/BlockPlaceable.pm
  16. 3 3
      lib/Locale/Fluent/Elements/BlockText.pm
  17. 3 3
      lib/Locale/Fluent/Elements/CallArguments.pm
  18. 16 0
      lib/Translate/Fluent/Elements/DefaultVariant.pm
  19. 3 3
      lib/Locale/Fluent/Elements/FunctionReference.pm
  20. 3 3
      lib/Locale/Fluent/Elements/InlineExpression.pm
  21. 3 3
      lib/Locale/Fluent/Elements/InlinePlaceable.pm
  22. 3 3
      lib/Locale/Fluent/Elements/InlineText.pm
  23. 3 3
      lib/Locale/Fluent/Elements/Message.pm
  24. 3 3
      lib/Locale/Fluent/Elements/MessageReference.pm
  25. 3 3
      lib/Locale/Fluent/Elements/NamedArgument.pm
  26. 3 3
      lib/Locale/Fluent/Elements/Pattern.pm
  27. 3 3
      lib/Locale/Fluent/Elements/PatternElement.pm
  28. 7 7
      lib/Locale/Fluent/Elements/SelectExpression.pm
  29. 3 3
      lib/Locale/Fluent/Elements/StringLiteral.pm
  30. 3 3
      lib/Locale/Fluent/Elements/Term.pm
  31. 3 3
      lib/Locale/Fluent/Elements/TermReference.pm
  32. 3 3
      lib/Locale/Fluent/Elements/Text.pm
  33. 3 3
      lib/Locale/Fluent/Elements/VariableReference.pm
  34. 3 3
      lib/Locale/Fluent/Elements/Variant.pm
  35. 10 10
      lib/Locale/Fluent/Parser.pm
  36. 15 15
      lib/Locale/Fluent/ResourceGroup.pm
  37. 7 7
      lib/Locale/Fluent/ResourceGroup/Context.pm
  38. 8 8
      lib/Locale/Fluent/ResourceSet.pm
  39. 2 2
      t/00-load.t
  40. 5 5
      t/20-base-methods.t
  41. 6 6
      t/40-parse-file.t
  42. 4 4
      t/45-resource-set.t
  43. 5 5
      t/55-resource-group.t
  44. 3 3
      t/65-slurp.t

+ 2 - 0
.gitignore

@ -14,5 +14,7 @@ inc/
14 14
nytprof.out
15 15
pod2htm*.tmp
16 16
pm_to_blib
17
Translate-Fluent-*
18
Translate-Fluent-*.tar.gz
17 19
Locale-Fluent-*
18 20
Locale-Fluent-*.tar.gz

+ 9 - 2
Changes

@ -1,7 +1,14 @@
1
Revision history for Locale-Fluent
1
Revision history for Translate-Fluent
2
3
0.6.0   2020/Jun/18
4
        - renamed from Locale::Fluent to Translate::Fluent because
5
          of the Locale namespace being owned by perl itself.
6
7
0.5.3   2020/May/25
8
        - add Moo to the list of dependencies
2 9
3 10
0.5.2   2020/May/23
4
        - add Regexp::Grammar to the list o dependencies - opsy
11
        - add Regexp::Grammar to the list of dependencies - opsy
5 12
6 13
0.5.1   2020/May/23
7 14
        First release

+ 31 - 31
MANIFEST

@ -1,36 +1,36 @@
1 1
archnotes/001-sets-n-groups.md
2 2
Changes
3
lib/Locale/Fluent.pm
4
lib/Locale/Fluent/Elements.pm
5
lib/Locale/Fluent/Elements/Argument.pm
6
lib/Locale/Fluent/Elements/ArgumentList.pm
7
lib/Locale/Fluent/Elements/Attribute.pm
8
lib/Locale/Fluent/Elements/AttributeAccessor.pm
9
lib/Locale/Fluent/Elements/Base.pm
10
lib/Locale/Fluent/Elements/BlockPlaceable.pm
11
lib/Locale/Fluent/Elements/BlockText.pm
12
lib/Locale/Fluent/Elements/CallArguments.pm
13
lib/Locale/Fluent/Elements/DefaultVariant.pm
14
lib/Locale/Fluent/Elements/FunctionReference.pm
15
lib/Locale/Fluent/Elements/InlineExpression.pm
16
lib/Locale/Fluent/Elements/InlinePlaceable.pm
17
lib/Locale/Fluent/Elements/InlineText.pm
18
lib/Locale/Fluent/Elements/Message.pm
19
lib/Locale/Fluent/Elements/MessageReference.pm
20
lib/Locale/Fluent/Elements/NamedArgument.pm
21
lib/Locale/Fluent/Elements/Pattern.pm
22
lib/Locale/Fluent/Elements/PatternElement.pm
23
lib/Locale/Fluent/Elements/SelectExpression.pm
24
lib/Locale/Fluent/Elements/StringLiteral.pm
25
lib/Locale/Fluent/Elements/Term.pm
26
lib/Locale/Fluent/Elements/TermReference.pm
27
lib/Locale/Fluent/Elements/Text.pm
28
lib/Locale/Fluent/Elements/VariableReference.pm
29
lib/Locale/Fluent/Elements/Variant.pm
30
lib/Locale/Fluent/Parser.pm
31
lib/Locale/Fluent/ResourceGroup.pm
32
lib/Locale/Fluent/ResourceGroup/Context.pm
33
lib/Locale/Fluent/ResourceSet.pm
3
lib/Translate/Fluent.pm
4
lib/Translate/Fluent/Elements.pm
5
lib/Translate/Fluent/Elements/Argument.pm
6
lib/Translate/Fluent/Elements/ArgumentList.pm
7
lib/Translate/Fluent/Elements/Attribute.pm
8
lib/Translate/Fluent/Elements/AttributeAccessor.pm
9
lib/Translate/Fluent/Elements/Base.pm
10
lib/Translate/Fluent/Elements/BlockPlaceable.pm
11
lib/Translate/Fluent/Elements/BlockText.pm
12
lib/Translate/Fluent/Elements/CallArguments.pm
13
lib/Translate/Fluent/Elements/DefaultVariant.pm
14
lib/Translate/Fluent/Elements/FunctionReference.pm
15
lib/Translate/Fluent/Elements/InlineExpression.pm
16
lib/Translate/Fluent/Elements/InlinePlaceable.pm
17
lib/Translate/Fluent/Elements/InlineText.pm
18
lib/Translate/Fluent/Elements/Message.pm
19
lib/Translate/Fluent/Elements/MessageReference.pm
20
lib/Translate/Fluent/Elements/NamedArgument.pm
21
lib/Translate/Fluent/Elements/Pattern.pm
22
lib/Translate/Fluent/Elements/PatternElement.pm
23
lib/Translate/Fluent/Elements/SelectExpression.pm
24
lib/Translate/Fluent/Elements/StringLiteral.pm
25
lib/Translate/Fluent/Elements/Term.pm
26
lib/Translate/Fluent/Elements/TermReference.pm
27
lib/Translate/Fluent/Elements/Text.pm
28
lib/Translate/Fluent/Elements/VariableReference.pm
29
lib/Translate/Fluent/Elements/Variant.pm
30
lib/Translate/Fluent/Parser.pm
31
lib/Translate/Fluent/ResourceGroup.pm
32
lib/Translate/Fluent/ResourceGroup/Context.pm
33
lib/Translate/Fluent/ResourceSet.pm
34 34
Makefile.PL
35 35
MANIFEST			This list of files
36 36
README.md

+ 4 - 4
Makefile.PL

@ -4,10 +4,10 @@ use warnings;
4 4
use ExtUtils::MakeMaker;
5 5
6 6
WriteMakefile(
7
    NAME             => 'Locale::Fluent',
7
    NAME             => 'Translate::Fluent',
8 8
    AUTHOR           => q{theMage <neves@cpan.org>},
9
    VERSION_FROM     => 'lib/Locale/Fluent.pm',
10
    ABSTRACT_FROM    => 'lib/Locale/Fluent.pm',
9
    VERSION_FROM     => 'lib/Translate/Fluent.pm',
10
    ABSTRACT_FROM    => 'lib/Translate/Fluent.pm',
11 11
    LICENSE          => 'artistic_2',
12 12
    PL_FILES         => {},
13 13
    MIN_PERL_VERSION => 5.006,
@ -24,5 +24,5 @@ WriteMakefile(
24 24
        #'Foo::Bar::Module' => 5.0401,
25 25
    },
26 26
    dist  => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
27
    clean => { FILES => 'Locale-Fluent-*' },
27
    clean => { FILES => 'Translate-Fluent-*' },
28 28
);

+ 5 - 5
README.md

@ -1,10 +1,10 @@
1
# Locale-Fluent
1
# Translate-Fluent
2 2
3
Locale::Fluent is a perl implementation of
3
Translate::Fluent is a perl implementation of
4 4
[Project Fluent](https://projectfluent.org), which is a research project
5 5
by [Mozilla](https://mozilla.org) aiming at more natural sounding translations.
6 6
7
Locale::Fluent is aimed at those who are looking for an alternative
7
Translate::Fluent is aimed at those who are looking for an alternative
8 8
at gettext for the translation of their projects.
9 9
10 10
@ -59,12 +59,12 @@ To install this module, run the following commands:
59 59
After installing, you can find documentation for this module with the
60 60
perldoc command.
61 61
62
    perldoc Locale::Fluent
62
    perldoc Translate::Fluent
63 63
64 64
65 65
Support requests an bugs can be reported in:
66 66
67
http://magick-source.net/MagickPerl/Locale-Fluent
67
http://magick-source.net/MagickPerl/Translate-Fluent
68 68
69 69
70 70
## LICENSE AND COPYRIGHT

+ 0 - 66
lib/Locale/Fluent/Elements.pm

@ -1,66 +0,0 @@
1
package Locale::Fluent::Elements;
2
3
use Locale::Fluent::Elements::Message;
4
use Locale::Fluent::Elements::Pattern;
5
use Locale::Fluent::Elements::PatternElement;
6
use Locale::Fluent::Elements::InlinePlaceable;
7
use Locale::Fluent::Elements::InlineText;
8
use Locale::Fluent::Elements::InlineExpression;
9
use Locale::Fluent::Elements::BlockText;
10
use Locale::Fluent::Elements::BlockPlaceable;
11
use Locale::Fluent::Elements::FunctionReference;
12
use Locale::Fluent::Elements::VariableReference;
13
use Locale::Fluent::Elements::CallArguments;
14
use Locale::Fluent::Elements::ArgumentList;
15
use Locale::Fluent::Elements::Argument;
16
use Locale::Fluent::Elements::NamedArgument;
17
use Locale::Fluent::Elements::MessageReference;
18
use Locale::Fluent::Elements::TermReference;
19
use Locale::Fluent::Elements::AttributeAccessor;
20
use Locale::Fluent::Elements::StringLiteral;
21
use Locale::Fluent::Elements::Term;
22
use Locale::Fluent::Elements::SelectExpression;
23
use Locale::Fluent::Elements::Variant;
24
use Locale::Fluent::Elements::DefaultVariant;
25
use Locale::Fluent::Elements::Attribute;
26
27
sub create {
28
  my (undef, $type, $args) = @_;
29
30
  $type = "\u$type";
31
  $type =~ s/_(.)/\u$1/g;
32
33
  my $class = "Locale::Fluent::Elements::$type";
34
35
  my $res;
36
  eval {
37
    $res = $class->new( %$args );
38
39
    1;
40
  } or do {
41
    my ($err) = $@;
42
    print STDERR "err: $err\n"
43
      unless $err =~ m{Can't locate object method "new"};
44
    unless ($type eq 'Text') {
45
      print STDERR "FLT: Missing $class\n";
46
    }
47
  };
48
49
  return $res;
50
}
51
52
1;
53
54
__END__
55
56
=head1 NOTHING TO SEE HERE
57
58
this file is part of L<Locale::Fluent>. See its documentation for more information
59
60
=head2 create
61
62
this package implements a create method, but is not that interesting
63
64
65
=cut
66

+ 0 - 16
lib/Locale/Fluent/Elements/DefaultVariant.pm

@ -1,16 +0,0 @@
1
package Locale::Fluent::Elements::DefaultVariant;
2
3
use Moo;
4
extends 'Locale::Fluent::Elements::Variant';
5
6
1;
7
8
__END__
9
10
=head1 NOTHING TO SEE HERE
11
12
This file is part of L<Locale::Fluent>. See its documentation for more
13
information.
14
15
=cut
16

+ 15 - 15
lib/Locale/Fluent.pm

@ -1,34 +1,34 @@
1
package Locale::Fluent;
1
package Translate::Fluent;
2 2
3 3
use 5.006;
4 4
use strict;
5 5
use warnings;
6 6
7
our $VERSION = v0.5.3;
7
our $VERSION = v0.6.1;
8 8
9
use Locale::Fluent::Parser;
10
use Locale::Fluent::ResourceGroup;
9
use Translate::Fluent::Parser;
10
use Translate::Fluent::ResourceGroup;
11 11
12 12
sub parse_file {
13 13
  my $class = shift;
14 14
15
  return Locale::Fluent::Parser::parse_file( @_ );
15
  return Translate::Fluent::Parser::parse_file( @_ );
16 16
}
17 17
18 18
sub slurp_directory {
19 19
  my $class = shift;
20 20
21
  return Locale::Fluent::ResourceGroup->slurp_directory( @_ );
21
  return Translate::Fluent::ResourceGroup->slurp_directory( @_ );
22 22
}
23 23
24
1; # End of Locale::Fluent
24
1; # End of Translate::Fluent
25 25
26 26
27 27
__END__
28 28
29 29
=head1 NAME
30 30
31
Locale::Fluent - A perl implementation of Project Fluent Translations.
31
Translate::Fluent - A perl implementation of Project Fluent Translations.
32 32
33 33
=head1 VERSION
34 34
@ -36,9 +36,9 @@ Version 0.5.3
36 36
37 37
=head1 SYNOPSIS
38 38
39
  use Locale::Fluent;
39
  use Translate::Fluent;
40 40
  
41
  my $translations = Locale::Fluent->slurp_directory("translations");
41
  my $translations = Translate::Fluent->slurp_directory("translations");
42 42
43 43
  my $data = {
44 44
    name    => "theMage",
@ -89,22 +89,22 @@ text directly, to define the text.
89 89
90 90
This is impossible to do with gettext.
91 91
92
And that's why Locale::Fluent was started.
92
And that's why Translate::Fluent was started.
93 93
94 94
=head1 STATIC METHODS
95 95
96 96
=head2 parse_file
97 97
98 98
parse_file allow you to parse a single FLT file and returns a
99
L<Locale::Fluent::ResourceSet> object that can be used to translate
99
L<Translate::Fluent::ResourceSet> object that can be used to translate
100 100
strings.
101 101
102
See L<Locale::Fluent::Parser#parse_file> for details.
102
See L<Translate::Fluent::Parser#parse_file> for details.
103 103
104 104
=head2 slurp_directory
105 105
106 106
slurp_directory parses all the files in a directory, including (optionally)
107
sub-directories, and create a L<Locale::Fluent::ResourceGroup> object
107
sub-directories, and create a L<Translate::Fluent::ResourceGroup> object
108 108
that can be used to translate strings.
109 109
110 110
=head1 AUTHOR
@ -132,7 +132,7 @@ yet, as well as a few ideas that may be added in the future:
132 132
133 133
No known bugs at the moment, but we will be tracking them in:
134 134
135
L<http://magick-source.net/MagickPerl/Locale-Fluent>
135
L<http://magick-source.net/MagickPerl/Translate-Fluent>
136 136
137 137
138 138
=head1 PROJECT FLUENT

+ 66 - 0
lib/Translate/Fluent/Elements.pm

@ -0,0 +1,66 @@
1
package Translate::Fluent::Elements;
2
3
use Translate::Fluent::Elements::Message;
4
use Translate::Fluent::Elements::Pattern;
5
use Translate::Fluent::Elements::PatternElement;
6
use Translate::Fluent::Elements::InlinePlaceable;
7
use Translate::Fluent::Elements::InlineText;
8
use Translate::Fluent::Elements::InlineExpression;
9
use Translate::Fluent::Elements::BlockText;
10
use Translate::Fluent::Elements::BlockPlaceable;
11
use Translate::Fluent::Elements::FunctionReference;
12
use Translate::Fluent::Elements::VariableReference;
13
use Translate::Fluent::Elements::CallArguments;
14
use Translate::Fluent::Elements::ArgumentList;
15
use Translate::Fluent::Elements::Argument;
16
use Translate::Fluent::Elements::NamedArgument;
17
use Translate::Fluent::Elements::MessageReference;
18
use Translate::Fluent::Elements::TermReference;
19
use Translate::Fluent::Elements::AttributeAccessor;
20
use Translate::Fluent::Elements::StringLiteral;
21
use Translate::Fluent::Elements::Term;
22
use Translate::Fluent::Elements::SelectExpression;
23
use Translate::Fluent::Elements::Variant;
24
use Translate::Fluent::Elements::DefaultVariant;
25
use Translate::Fluent::Elements::Attribute;
26
27
sub create {
28
  my (undef, $type, $args) = @_;
29
30
  $type = "\u$type";
31
  $type =~ s/_(.)/\u$1/g;
32
33
  my $class = "Translate::Fluent::Elements::$type";
34
35
  my $res;
36
  eval {
37
    $res = $class->new( %$args );
38
39
    1;
40
  } or do {
41
    my ($err) = $@;
42
    print STDERR "err: $err\n"
43
      unless $err =~ m{Can't locate object method "new"};
44
    unless ($type eq 'Text') {
45
      print STDERR "FLT: Missing $class\n";
46
    }
47
  };
48
49
  return $res;
50
}
51
52
1;
53
54
__END__
55
56
=head1 NOTHING TO SEE HERE
57
58
this file is part of L<Translate::Fluent>. See its documentation for more information
59
60
=head2 create
61
62
this package implements a create method, but is not that interesting
63
64
65
=cut
66

+ 3 - 3
lib/Locale/Fluent/Elements/Argument.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::Argument;
1
package Translate::Fluent::Elements::Argument;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(
7 7
      named_argument
@ -49,7 +49,7 @@ __END__
49 49
50 50
=head1 NOTHING TO SEE HERE
51 51
52
This file is part of L<Locale::Fluent>. See its documentation for more
52
This file is part of L<Translate::Fluent>. See its documentation for more
53 53
information.
54 54
55 55
=head2 identifier

+ 3 - 3
lib/Locale/Fluent/Elements/ArgumentList.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::ArgumentList;
1
package Translate::Fluent::Elements::ArgumentList;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has argument => (
7 7
  is  => 'ro',
@ -46,7 +46,7 @@ __END__
46 46
47 47
=head1 NOTHING TO SEE HERE
48 48
49
This file is part of L<Locale::Fluent>. See its documentation for more
49
This file is part of L<Translate::Fluent>. See its documentation for more
50 50
information.
51 51
52 52
=head2 to_variables

+ 3 - 3
lib/Locale/Fluent/Elements/Attribute.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::Attribute;
1
package Translate::Fluent::Elements::Attribute;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(identifier pattern)] => (
7 7
  is  => 'ro',
@ -30,7 +30,7 @@ __END__
30 30
31 31
=head1 NOTHING TO SEE HERE
32 32
33
This file is part of L<Locale::Fluent>. See its documentation for more
33
This file is part of L<Translate::Fluent>. See its documentation for more
34 34
information.
35 35
36 36
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/AttributeAccessor.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::AttributeAccessor;
1
package Translate::Fluent::Elements::AttributeAccessor;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has identifier => (
7 7
  is  => 'ro',
@ -21,7 +21,7 @@ __END__
21 21
22 22
=head1 NOTHING TO SEE HERE
23 23
24
This file is part of L<Locale::Fluent>. See its documentation for more
24
This file is part of L<Translate::Fluent>. See its documentation for more
25 25
information.
26 26
27 27
=cut

+ 4 - 4
lib/Locale/Fluent/Elements/Base.pm

@ -1,4 +1,4 @@
1
package Locale::Fluent::Elements::Base;
1
package Translate::Fluent::Elements::Base;
2 2
3 3
use Moo;
4 4
@ -12,7 +12,7 @@ around BUILDARGS => sub {
12 12
13 13
    if (ref $val eq 'HASH') {
14 14
       
15
      my $res = Locale::Fluent::Elements->create(
15
      my $res = Translate::Fluent::Elements->create(
16 16
          $k, $val
17 17
        );
18 18
    
@ -25,7 +25,7 @@ around BUILDARGS => sub {
25 25
        my $itemval = ref $item->{$type}
26 26
                        ? $item->{$type} 
27 27
                        : { text => $item->{$type} };
28
        my $res = Locale::Fluent::Elements->create(
28
        my $res = Translate::Fluent::Elements->create(
29 29
            $type => $itemval
30 30
          );
31 31
@ -47,7 +47,7 @@ __END__
47 47
48 48
=head1 NOTHING TO SEE HERE
49 49
50
This file is part of L<Locale::Fluent>. See its documentation for more
50
This file is part of L<Translate::Fluent>. See its documentation for more
51 51
information.
52 52
53 53
=cut

+ 3 - 3
lib/Locale/Fluent/Elements/BlockPlaceable.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::BlockPlaceable;
1
package Translate::Fluent::Elements::BlockPlaceable;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has inline_placeable => (
7 7
  is  => 'ro',
@ -24,7 +24,7 @@ __END__
24 24
25 25
=head1 NOTHING TO SEE HERE
26 26
27
This file is part of L<Locale::Fluent>. See its documentation for more
27
This file is part of L<Translate::Fluent>. See its documentation for more
28 28
information.
29 29
30 30
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/BlockText.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::BlockText;
1
package Translate::Fluent::Elements::BlockText;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has text => (
7 7
  is  => 'ro',
@ -27,7 +27,7 @@ __END__
27 27
28 28
=head1 NOTHING TO SEE HERE
29 29
30
This file is part of L<Locale::Fluent>. See its documentation for more
30
This file is part of L<Translate::Fluent>. See its documentation for more
31 31
information.
32 32
33 33
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/CallArguments.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::CallArguments;
1
package Translate::Fluent::Elements::CallArguments;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has argument_list => (
7 7
  is  => 'ro',
@ -23,7 +23,7 @@ __END__
23 23
24 24
=head1 NOTHING TO SEE HERE
25 25
26
This file is part of L<Locale::Fluent>. See its documentation for more
26
This file is part of L<Translate::Fluent>. See its documentation for more
27 27
information.
28 28
29 29
=head2 to_variables

+ 16 - 0
lib/Translate/Fluent/Elements/DefaultVariant.pm

@ -0,0 +1,16 @@
1
package Translate::Fluent::Elements::DefaultVariant;
2
3
use Moo;
4
extends 'Translate::Fluent::Elements::Variant';
5
6
1;
7
8
__END__
9
10
=head1 NOTHING TO SEE HERE
11
12
This file is part of L<Translate::Fluent>. See its documentation for more
13
information.
14
15
=cut
16

+ 3 - 3
lib/Locale/Fluent/Elements/FunctionReference.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::FunctionReference;
1
package Translate::Fluent::Elements::FunctionReference;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(
7 7
      identifier
@ -24,7 +24,7 @@ __END__
24 24
25 25
=head1 NOTHING TO SEE HERE
26 26
27
This file is part of L<Locale::Fluent>. See its documentation for more
27
This file is part of L<Translate::Fluent>. See its documentation for more
28 28
information.
29 29
30 30
=cut

+ 3 - 3
lib/Locale/Fluent/Elements/InlineExpression.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::InlineExpression;
1
package Translate::Fluent::Elements::InlineExpression;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(
7 7
      string_literal
@ -51,7 +51,7 @@ __END__
51 51
52 52
=head1 NOTHING TO SEE HERE
53 53
54
This file is part of L<Locale::Fluent>. See its documentation for more
54
This file is part of L<Translate::Fluent>. See its documentation for more
55 55
information.
56 56
57 57
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/InlinePlaceable.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::InlinePlaceable;
1
package Translate::Fluent::Elements::InlinePlaceable;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(select_expression inline_expression)] => (
7 7
  is  => 'ro',
@ -40,7 +40,7 @@ __END__
40 40
41 41
=head1 NOTHING TO SEE HERE
42 42
43
This file is part of L<Locale::Fluent>. See its documentation for more
43
This file is part of L<Translate::Fluent>. See its documentation for more
44 44
information.
45 45
46 46
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/InlineText.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::InlineText;
1
package Translate::Fluent::Elements::InlineText;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has text => (
7 7
  is  => 'ro',
@ -19,7 +19,7 @@ __END__
19 19
20 20
=head1 NOTHING TO SEE HERE
21 21
22
This file is part of L<Locale::Fluent>. See its documentation for more
22
This file is part of L<Translate::Fluent>. See its documentation for more
23 23
information.
24 24
25 25
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/Message.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::Message;
1
package Translate::Fluent::Elements::Message;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(identifier pattern attributes)] => (
7 7
  is  => 'ro',
@ -49,7 +49,7 @@ __END__
49 49
50 50
=head1 NOTHING TO SEE HERE
51 51
52
This file is part of L<Locale::Fluent>. See its documentation for more
52
This file is part of L<Translate::Fluent>. See its documentation for more
53 53
information.
54 54
55 55
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/MessageReference.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::MessageReference;
1
package Translate::Fluent::Elements::MessageReference;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(
7 7
      identifier
@ -45,7 +45,7 @@ __END__
45 45
46 46
=head1 NOTHING TO SEE HERE
47 47
48
This file is part of L<Locale::Fluent>. See its documentation for more
48
This file is part of L<Translate::Fluent>. See its documentation for more
49 49
information.
50 50
51 51
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/NamedArgument.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::NamedArgument;
1
package Translate::Fluent::Elements::NamedArgument;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(
7 7
      identifier
@ -36,7 +36,7 @@ __END__
36 36
37 37
=head1 NOTHING TO SEE HERE
38 38
39
This file is part of L<Locale::Fluent>. See its documentation for more
39
This file is part of L<Translate::Fluent>. See its documentation for more
40 40
information.
41 41
42 42
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/Pattern.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::Pattern;
1
package Translate::Fluent::Elements::Pattern;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(pattern_element)] => (
7 7
  is  => 'ro',
@ -34,7 +34,7 @@ __END__
34 34
35 35
=head1 NOTHING TO SEE HERE
36 36
37
This file is part of L<Locale::Fluent>. See its documentation for more
37
This file is part of L<Translate::Fluent>. See its documentation for more
38 38
information.
39 39
40 40
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/PatternElement.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::PatternElement;
1
package Translate::Fluent::Elements::PatternElement;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(inline_text block_text inline_placeable block_placeable)] => (
7 7
  is  => 'ro',
@ -14,7 +14,7 @@ __END__
14 14
15 15
=head1 NOTHING TO SEE HERE
16 16
17
This file is part of L<Locale::Fluent>. See its documentation for more
17
This file is part of L<Translate::Fluent>. See its documentation for more
18 18
information.
19 19
20 20
=cut

+ 7 - 7
lib/Locale/Fluent/Elements/SelectExpression.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::SelectExpression;
1
package Translate::Fluent::Elements::SelectExpression;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(inline_expression default_variant)] => (
7 7
  is  => 'ro',
@ -10,7 +10,7 @@ has [qw(inline_expression default_variant)] => (
10 10
11 11
has variant_list => (
12 12
  is => 'ro',
13
  default => sub { bless {}, 'Locale::Fluent::Elements::_variantlist' },
13
  default => sub { bless {}, 'Translate::Fluent::Elements::_variantlist' },
14 14
);
15 15
16 16
around BUILDARGS => sub {
@ -26,7 +26,7 @@ around BUILDARGS => sub {
26 26
  my %list;
27 27
  if ($args{variant_list}->{variant}) {
28 28
    for my $variant (@{ $args{variant_list}->{variant} }) {
29
      $variant = Locale::Fluent::Elements->create(
29
      $variant = Translate::Fluent::Elements->create(
30 30
          Variant => {
31 31
            Identifier  => $variant->{VariantKey}->{Identifier},
32 32
            Pattern     => $variant->{Pattern},
@ -38,7 +38,7 @@ around BUILDARGS => sub {
38 38
39 39
  if (%list) {
40 40
    $args{ variant_list }
41
      = bless \%list, 'Locale::Fluent::Elements::_variantlist';
41
      = bless \%list, 'Translate::Fluent::Elements::_variantlist';
42 42
  }
43 43
44 44
  $class->$orig( %args );
@ -58,7 +58,7 @@ sub translate {
58 58
}
59 59
60 60
61
package Locale::Fluent::Elements::_variantlist;
61
package Translate::Fluent::Elements::_variantlist;
62 62
63 63
1;
64 64
@ -66,7 +66,7 @@ __END__
66 66
67 67
=head1 NOTHING TO SEE HERE
68 68
69
This file is part of L<Locale::Fluent>. See its documentation for more
69
This file is part of L<Translate::Fluent>. See its documentation for more
70 70
information.
71 71
72 72
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/StringLiteral.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::StringLiteral;
1
package Translate::Fluent::Elements::StringLiteral;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has text => (
7 7
  is  => 'ro',
@ -20,7 +20,7 @@ __END__
20 20
21 21
=head1 NOTHING TO SEE HERE
22 22
23
This file is part of L<Locale::Fluent>. See its documentation for more
23
This file is part of L<Translate::Fluent>. See its documentation for more
24 24
information.
25 25
26 26
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/Term.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::Term;
1
package Translate::Fluent::Elements::Term;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(identifier pattern attributes)] => (
7 7
  is  => 'ro',
@ -48,7 +48,7 @@ __END__
48 48
49 49
=head1 NOTHING TO SEE HERE
50 50
51
This file is part of L<Locale::Fluent>. See its documentation for more
51
This file is part of L<Translate::Fluent>. See its documentation for more
52 52
information.
53 53
54 54
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/TermReference.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::TermReference;
1
package Translate::Fluent::Elements::TermReference;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(
7 7
      identifier
@ -50,7 +50,7 @@ __END__
50 50
51 51
=head1 NOTHING TO SEE HERE
52 52
53
This file is part of L<Locale::Fluent>. See its documentation for more
53
This file is part of L<Translate::Fluent>. See its documentation for more
54 54
information.
55 55
56 56
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/Text.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::Text;
1
package Translate::Fluent::Elements::Text;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has text => (
7 7
  is  => 'ro',
@ -20,7 +20,7 @@ __END__
20 20
21 21
=head1 NOTHING TO SEE HERE
22 22
23
This file is part of L<Locale::Fluent>. See its documentation for more
23
This file is part of L<Translate::Fluent>. See its documentation for more
24 24
information.
25 25
26 26
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/VariableReference.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::VariableReference;
1
package Translate::Fluent::Elements::VariableReference;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has identifier => (
7 7
  is  => 'ro',
@ -22,7 +22,7 @@ __END__
22 22
23 23
=head1 NOTHING TO SEE HERE
24 24
25
This file is part of L<Locale::Fluent>. See its documentation for more
25
This file is part of L<Translate::Fluent>. See its documentation for more
26 26
information.
27 27
28 28
=head2 translate

+ 3 - 3
lib/Locale/Fluent/Elements/Variant.pm

@ -1,7 +1,7 @@
1
package Locale::Fluent::Elements::Variant;
1
package Translate::Fluent::Elements::Variant;
2 2
3 3
use Moo;
4
extends 'Locale::Fluent::Elements::Base';
4
extends 'Translate::Fluent::Elements::Base';
5 5
6 6
has [qw(
7 7
      identifier
@ -32,7 +32,7 @@ __END__
32 32
33 33
=head1 NOTHING TO SEE HERE
34 34
35
This file is part of L<Locale::Fluent>. See its documentation for more
35
This file is part of L<Translate::Fluent>. See its documentation for more
36 36
information.
37 37
38 38
=head2 translate

+ 10 - 10
lib/Locale/Fluent/Parser.pm

@ -1,4 +1,4 @@
1
package Locale::Fluent::Parser;
1
package Translate::Fluent::Parser;
2 2
3 3
use parent qw'Exporter';
4 4
@ -7,8 +7,8 @@ our @EXPORT_OK = qw(
7 7
  parse_string
8 8
);
9 9
10
use Locale::Fluent::ResourceSet;
11
use Locale::Fluent::Elements;
10
use Translate::Fluent::ResourceSet;
11
use Translate::Fluent::Elements;
12 12
13 13
use Regexp::Grammars;
14 14
@ -184,7 +184,7 @@ sub parse_file {
184 184
sub parse_string {
185 185
  my ($str) = @_;
186 186
187
  my $reset = Locale::Fluent::ResourceSet->new();
187
  my $reset = Translate::Fluent::ResourceSet->new();
188 188
189 189
  if ( $str =~ $fluent_parser ) {
190 190
    my %entries;
@ -194,7 +194,7 @@ sub parse_string {
194 194
195 195
      my ($type) = keys %{ $elm->{Entry} };
196 196
197
      my $resobj = Locale::Fluent::Elements->create(
197
      my $resobj = Translate::Fluent::Elements->create(
198 198
          $type => $elm->{Entry}->{ $type }
199 199
        );
200 200
@ -215,11 +215,11 @@ __END__
215 215
216 216
=head1 NAME
217 217
218
Locale::Fluent::Parser - Load fluent files and tranform them into objects
218
Translate::Fluent::Parser - Load fluent files and tranform them into objects
219 219
220 220
=head1 SYNOPSIS
221 221
222
  use Locale::Fluent::Parser qw(parse_file);
222
  use Translate::Fluent::Parser qw(parse_file);
223 223
224 224
  my $resource_set = parse_file( "some_project.en.flt" );
225 225
@ -229,7 +229,7 @@ Locale::Fluent::Parser - Load fluent files and tranform them into objects
229 229
230 230
=head2 parse_file( $filename )
231 231
232
parse_file takes a filename and parse it into a L<Locale::Fluent::ResourceSet>
232
parse_file takes a filename and parse it into a L<Translate::Fluent::ResourceSet>
233 233
object that can be used to translate translation tags.
234 234
235 235
See L<#SYNOPSIS> for example.
@ -239,7 +239,7 @@ C<return undef>.
239 239
240 240
=head2 parse_string( $string )
241 241
242
parse_string takes a string and parses it into a L<Locale::Fluent::ResourceSet>
242
parse_string takes a string and parses it into a L<Translate::Fluent::ResourceSet>
243 243
object.
244 244
245 245
If the string does not contain any valid resources, parse_string will
@ -247,7 +247,7 @@ C<return undef>.
247 247
248 248
=head1 SEE MORE
249 249
250
This file is part of L<Locale::Fluent> - version, license and more general
250
This file is part of L<Translate::Fluent> - version, license and more general
251 251
information can be found in its documentation
252 252
253 253
=cut

+ 15 - 15
lib/Locale/Fluent/ResourceGroup.pm

@ -1,4 +1,4 @@
1
package Locale::Fluent::ResourceGroup;
1
package Translate::Fluent::ResourceGroup;
2 2
3 3
use Moo;
4 4
@ -17,13 +17,13 @@ has default_language => (
17 17
  default => sub { 'en' },
18 18
);
19 19
20
use Locale::Fluent::ResourceGroup::Context;
21
use Locale::Fluent::ResourceSet;
20
use Translate::Fluent::ResourceGroup::Context;
21
use Translate::Fluent::ResourceSet;
22 22
23 23
sub slurp_directory {
24 24
  my ($self, $directory, $context) = @_;
25 25
26
  unless (ref $self and $self->isa("Locale::Fluent::ResourceGroup")) {
26
  unless (ref $self and $self->isa("Translate::Fluent::ResourceGroup")) {
27 27
    my %params = ();
28 28
    if ($context->{default_language}) {
29 29
      $params{default_language} = delete $context->{default_language};
@ -88,7 +88,7 @@ sub slurp_directory {
88 88
      }
89 89
    }
90 90
91
    my $resset =  Locale::Fluent::Parser::parse_string( $fluent );
91
    my $resset =  Translate::Fluent::Parser::parse_string( $fluent );
92 92
    if ($resset) {
93 93
      $self->add_resource_set( $resset, \%context );
94 94
    }
@ -132,16 +132,16 @@ sub translate {
132 132
    if !$context and $variables->{__context};
133 133
134 134
  my $_ctx;
135
  if (ref $context eq 'Locale::Fluent::ResourceGroup::Context') {
135
  if (ref $context eq 'Translate::Fluent::ResourceGroup::Context') {
136 136
    $_ctx = $context;
137 137
    $context = $_ctx->context;
138 138
  }
139 139
140 140
  my $res = $self->_find_resource( $res_id, $context );
141 141
142
  return unless $res and $res->isa("Locale::Fluent::Elements::Message");
142
  return unless $res and $res->isa("Translate::Fluent::Elements::Message");
143 143
144
  $_ctx ||= Locale::Fluent::ResourceGroup::Context->new(
144
  $_ctx ||= Translate::Fluent::ResourceGroup::Context->new(
145 145
                context   => $context,
146 146
                resgroup  => $self,
147 147
              );
@ -154,7 +154,7 @@ sub get_term {
154 154
155 155
  my $term = $self->_find_resource( $term_id, $context );
156 156
157
  return unless $term->isa("Locale::Fluent::Elements::Term");
157
  return unless $term->isa("Translate::Fluent::Elements::Term");
158 158
159 159
  return $term;
160 160
}
@ -164,7 +164,7 @@ sub get_message {
164 164
165 165
  my $res = $self->_find_resource( $message_id, $context );
166 166
167
  return unless $res->isa("Locale::Fluent::Elements::Message");
167
  return unless $res->isa("Translate::Fluent::Elements::Message");
168 168
169 169
  return $res;
170 170
}
@ -248,19 +248,19 @@ __END__
248 248
249 249
=head1 NAME
250 250
251
Locale::Fluent::ResourceGroup - a group of contextualized L<ResourceSet>s.
251
Translate::Fluent::ResourceGroup - a group of contextualized L<ResourceSet>s.
252 252
253 253
=head1 SYNOPSIS
254 254
255
  my $group = Locale::Fluent::ResourceGroup->slurp_directory( "somedir" );
255
  my $group = Translate::Fluent::ResourceGroup->slurp_directory( "somedir" );
256 256
  my $variables = {};
257 257
258 258
  print $group->translate("some-resource", $variables, { language => "en" });
259 259
260 260
=head1 DESCRIPTION
261 261
262
Where L<Locale::Fluent::ResourceSet> allow you to get translations from a
263
single set of resources, C<Locale::Fluent::ResourceGroup> provides the
262
Where L<Translate::Fluent::ResourceSet> allow you to get translations from a
263
single set of resources, C<Translate::Fluent::ResourceGroup> provides the
264 264
mechanisms to use multiple resource sets with basic rules to find the needed
265 265
resource across multiple resource set.
266 266
@ -419,7 +419,7 @@ happen. Do not do that.
419 419
420 420
=head1 SEE MORE
421 421
422
This file is part of L<Locale::Fluent> - version, license and more general
422
This file is part of L<Translate::Fluent> - version, license and more general
423 423
information can be found in its documentation.
424 424
425 425
=cut

+ 7 - 7
lib/Locale/Fluent/ResourceGroup/Context.pm

@ -1,4 +1,4 @@
1
package Locale::Fluent::ResourceGroup::Context;
1
package Translate::Fluent::ResourceGroup::Context;
2 2
3 3
use Moo;
4 4
@ -29,7 +29,7 @@ __END__
29 29
30 30
=head1 NAME
31 31
32
Locale::Fluent::ResourceGroup::Context - ResourceSet emulation
32
Translate::Fluent::ResourceGroup::Context - ResourceSet emulation
33 33
34 34
=head1 SYNOPSIS
35 35
@ -37,18 +37,18 @@ DO NOT USE DIRECTLY
37 37
38 38
=head1 DESCRIPTION
39 39
40
This package is used internally by L<Locale::Fluent::ResourceGroup> to
41
provide the functionality of L<Locale::Fluent::ResourceSet> and keep track
40
This package is used internally by L<Translate::Fluent::ResourceGroup> to
41
provide the functionality of L<Translate::Fluent::ResourceSet> and keep track
42 42
of what is the context of the original translation request.
43 43
44 44
This is needed so that all sub-translations needed to finish a translation
45 45
request are done in a consistent way. This object, unlike the ResourceSet,
46 46
does not keep any translation objects, it only delegates getting this objects
47
from L<Locale::Fluent::ResourceGroup> with the right context.
47
from L<Translate::Fluent::ResourceGroup> with the right context.
48 48
49 49
=head1 METHODS IMPLEMENTED
50 50
51
This package only implements the methods of L<Locale::Fluent:ResourceSet>
51
This package only implements the methods of L<Translate::Fluent:ResourceSet>
52 52
needed during translation calls. See that class for details on those methods.
53 53
54 54
=head2 get_term( $term_id )
@ -57,7 +57,7 @@ needed during translation calls. See that class for details on those methods.
57 57
58 58
=head1 SEE MORE
59 59
60
This file is part of L<Locale::Fluent> - version, license and more general
60
This file is part of L<Translate::Fluent> - version, license and more general
61 61
information can be found in its documentation
62 62
63 63
=cut

+ 8 - 8
lib/Locale/Fluent/ResourceSet.pm

@ -1,4 +1,4 @@
1
package Locale::Fluent::ResourceSet;
1
package Translate::Fluent::ResourceSet;
2 2
3 3
use Moo;
4 4
@ -19,7 +19,7 @@ sub translate {
19 19
20 20
  my $res = $self->resources->{ $res_id };
21 21
22
  return unless $res and $res->isa("Locale::Fluent::Elements::Message");
22
  return unless $res and $res->isa("Translate::Fluent::Elements::Message");
23 23
24 24
  return $res->translate( { %{$variables//{}}, __resourceset => $self} );
25 25
}
@ -28,7 +28,7 @@ sub get_term {
28 28
  my ($self, $term_id) = @_;
29 29
30 30
  my $res = $self->resources->{ $term_id };
31
  return unless $res->isa("Locale::Fluent::Elements::Term");
31
  return unless $res->isa("Translate::Fluent::Elements::Term");
32 32
33 33
  return $res;
34 34
}
@ -37,7 +37,7 @@ sub get_message {
37 37
  my ($self, $message_id) = @_;
38 38
39 39
  my $res = $self->resources->{ $message_id };
40
  return unless $res->isa("Locale::Fluent::Elements::Message");
40
  return unless $res->isa("Translate::Fluent::Elements::Message");
41 41
42 42
  return $res;
43 43
}
@ -48,18 +48,18 @@ __END__
48 48
49 49
=head1 NAME
50 50
51
Locale::Fluent::ResourceSet - a set of translation resources 
51
Translate::Fluent::ResourceSet - a set of translation resources 
52 52
53 53
=head1 SYNOPSIS
54 54
55
  my $resource_set = Locale::Fluent->parse_file( "filename.flt" );
55
  my $resource_set = Translate::Fluent->parse_file( "filename.flt" );
56 56
  my $variables = {};
57 57
58 58
  print $resource_set->translate('some-string', $variables );
59 59
60 60
=head1 DESCRIPTION
61 61
62
C<Locale::Fluent::ResourceSet> groups multiple translation resources,
62
C<Translate::Fluent::ResourceSet> groups multiple translation resources,
63 63
often from a single file, and allow you to get translations from them,
64 64
even when they need other resources in the resource set.
65 65
@ -89,7 +89,7 @@ intended for internal use.
89 89
90 90
=head1 SEE MORE
91 91
92
This file is part of L<Locale::Fluent> - version, license and more general
92
This file is part of L<Translate::Fluent> - version, license and more general
93 93
information can be found in its documentation.
94 94
95 95
=cut

+ 2 - 2
t/00-load.t

@ -7,7 +7,7 @@ use Test::More;
7 7
plan tests => 1;
8 8
9 9
BEGIN {
10
    use_ok( 'Locale::Fluent' ) || print "Bail out!\n";
10
    use_ok( 'Translate::Fluent' ) || print "Bail out!\n";
11 11
}
12 12
13
diag( "Testing Locale::Fluent $Locale::Fluent::VERSION, Perl $], $^X" );
13
diag( "Testing Translate::Fluent $Translate::Fluent::VERSION, Perl $], $^X" );

+ 5 - 5
t/20-base-methods.t

@ -5,18 +5,18 @@ use warnings;
5 5
use Test::More;
6 6
7 7
BEGIN {
8
  use_ok('Locale::Fluent') || print "Bail out!\n";
8
  use_ok('Translate::Fluent') || print "Bail out!\n";
9 9
}
10 10
11 11
my $path = $0;
12 12
$path =~ s{t/20-base-methods.t}{test_files/basic.flt};
13 13
14
my $resource_set = Locale::Fluent->parse_file( $path );
15
isa_ok( $resource_set, "Locale::Fluent::ResourceSet" );
14
my $resource_set = Translate::Fluent->parse_file( $path );
15
isa_ok( $resource_set, "Translate::Fluent::ResourceSet" );
16 16
17 17
$path =~ s{basic.flt}{slurp};
18
my $resource_group = Locale::Fluent->slurp_directory( $path );
19
isa_ok( $resource_group, "Locale::Fluent::ResourceGroup");
18
my $resource_group = Translate::Fluent->slurp_directory( $path );
19
isa_ok( $resource_group, "Translate::Fluent::ResourceGroup");
20 20
21 21
# the specifics of ResourceSet and ResourceGroup will be tested
22 22
# somewhere else.

+ 6 - 6
t/40-parse-file.t

@ -6,7 +6,7 @@ use Test::More;
6 6
7 7
8 8
BEGIN {
9
    use_ok( 'Locale::Fluent' ) || print "Bail out!\n";
9
    use_ok( 'Translate::Fluent' ) || print "Bail out!\n";
10 10
}
11 11
12 12
my $path = $0;
@ -15,7 +15,7 @@ my $path = $0;
15 15
16 16
$path =~ s{t/40-parse-file.t}{test_files/basic-missing.flt};
17 17
eval {
18
  my $resource_set = Locale::Fluent::Parser::parse_file( $path );
18
  my $resource_set = Translate::Fluent::Parser::parse_file( $path );
19 19
  
20 20
  fail("should have died with a missing file");
21 21
  1;
@ -26,21 +26,21 @@ eval {
26 26
27 27
$path =~ s{\-missing}{};
28 28
29
my $resource_set = Locale::Fluent::Parser::parse_file( $path );
29
my $resource_set = Translate::Fluent::Parser::parse_file( $path );
30 30
ok( $resource_set, "Defined resource_set");
31 31
32 32
BAIL_OUT("Undefined resource_set")
33 33
  unless $resource_set;
34 34
35
isa_ok( $resource_set, "Locale::Fluent::ResourceSet");
35
isa_ok( $resource_set, "Translate::Fluent::ResourceSet");
36 36
37 37
38 38
$path =~ s{basic.flt}{empty.flt};
39
my $empty_set = Locale::Fluent::Parser::parse_file( $path );
39
my $empty_set = Translate::Fluent::Parser::parse_file( $path );
40 40
is($empty_set, undef, 'file with no definitions should return undef');
41 41
42 42
$path =~ s{empty.flt}{broken.flt};
43
my $broken_set = Locale::Fluent::Parser::parse_file( $path );
43
my $broken_set = Translate::Fluent::Parser::parse_file( $path );
44 44
is($broken_set, undef, 'file with only broken definitions should return undef');
45 45
46 46
done_testing();

+ 4 - 4
t/45-resource-set.t

@ -6,19 +6,19 @@ use Test::More;
6 6
7 7
8 8
BEGIN {
9
    use_ok( 'Locale::Fluent' ) || print "Bail out!\n";
9
    use_ok( 'Translate::Fluent' ) || print "Bail out!\n";
10 10
}
11 11
12 12
my $path = $0;
13 13
$path =~ s{t/.*.t}{test_files/basic.flt};
14 14
15
my $resource_set = Locale::Fluent::Parser::parse_file( $path );
15
my $resource_set = Translate::Fluent::Parser::parse_file( $path );
16 16
ok( $resource_set, "Defined resource_set");
17 17
18 18
BAIL_OUT("Undefined resource_set")
19 19
  unless $resource_set;
20 20
21
isa_ok( $resource_set, "Locale::Fluent::ResourceSet");
21
isa_ok( $resource_set, "Translate::Fluent::ResourceSet");
22 22
23 23
my $fullname = $resource_set->translate("fullname");
24 24
is( $fullname, 'theMage Merlin mage dude', "Got a proper fullname");
@ -39,7 +39,7 @@ is( $missing, undef, 'should not get a translation of a missing resource');
39 39
40 40
41 41
my $term    = $resource_set->get_term('math-constant');
42
isa_ok( $term, "Locale::Fluent::Elements::Term");
42
isa_ok( $term, "Translate::Fluent::Elements::Term");
43 43
44 44
my $no_term = $resource_set->get_term('math-value-of-pi');
45 45
is($no_term, undef, 'should not get a message when asking for a term');

+ 5 - 5
t/55-resource-group.t

@ -6,21 +6,21 @@ use Test::More;
6 6
7 7
8 8
BEGIN {
9
    use_ok( 'Locale::Fluent' ) || print "Bail out!\n";
9
    use_ok( 'Translate::Fluent' ) || print "Bail out!\n";
10 10
}
11 11
12 12
my $path = $0;
13 13
$path =~ s{t/.*.t}{test_files/basic.flt};
14 14
15
my $resource_set = Locale::Fluent::Parser::parse_file( $path );
15
my $resource_set = Translate::Fluent::Parser::parse_file( $path );
16 16
ok( $resource_set, "Defined resource_set");
17 17
18 18
BAIL_OUT("Undefined resource_set")
19 19
  unless $resource_set;
20 20
21
isa_ok( $resource_set, "Locale::Fluent::ResourceSet");
21
isa_ok( $resource_set, "Translate::Fluent::ResourceSet");
22 22
23
my $resource_group = Locale::Fluent::ResourceGroup->new();
23
my $resource_group = Translate::Fluent::ResourceGroup->new();
24 24
$resource_group->add_resource_set( $resource_set );
25 25
26 26
my $fullname = $resource_group->translate("fullname");
@ -42,7 +42,7 @@ is( $missing, undef, 'should not get a translation of a missing resource');
42 42
43 43
44 44
my $term    = $resource_group->get_term('math-constant');
45
isa_ok( $term, "Locale::Fluent::Elements::Term");
45
isa_ok( $term, "Translate::Fluent::Elements::Term");
46 46
47 47
my $no_term = $resource_group->get_term('math-value-of-pi');
48 48
is($no_term, undef, 'should not get a message when asking for a term');

+ 3 - 3
t/65-slurp.t

@ -6,15 +6,15 @@ use Test::More;
6 6
7 7
8 8
BEGIN {
9
    use_ok( 'Locale::Fluent' ) || print "Bail out!\n";
9
    use_ok( 'Translate::Fluent' ) || print "Bail out!\n";
10 10
}
11 11
12 12
my $path = $0;
13 13
$path =~ s{t/.*.t}{test_files/slurp};
14 14
15 15
16
my $resource_group = Locale::Fluent::ResourceGroup->slurp_directory( $path );
17
isa_ok($resource_group, "Locale::Fluent::ResourceGroup");
16
my $resource_group = Translate::Fluent::ResourceGroup->slurp_directory( $path );
17
isa_ok($resource_group, "Translate::Fluent::ResourceGroup");
18 18
19 19
my $ptbr = $resource_group->translate(
20 20
                  'my-language',