Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Okay, doing a bit more digging: According to the CatalystX::I18N docs, CatalystX::I18N::Maketext is a 'Helpful wrapper around Locale::Maketext. Can also be used outside of Catalyst'. I have MyApp::Maketext setup as directed:
package MyApp::Maketext; use strict; use warnings; use parent qw(CatalystX::I18N::Maketext); 1;
I have a little test script running, the setup for which is this:
#!/usr/bin/perl use strict; use warnings; use FindBin qw( $Bin ); use lib "$Bin/../lib"; use TopTable::Maketext; use Path::Class::Dir; my $dir = Path::Class::Dir->new( "$Bin/..", "root", "locale" ); TopTable::Maketext->load_lexicon( locales => ["en_GB"], # Required directories => [$dir], # Required gettext_style => 0, # Optional, Default 1 );
I am then trying two different ways to get a handle to the maketext() method:
my $lang = TopTable::Maketext->get_handle; printf "%s\n", $lang->maketext( "menu.title.news" );
Gives the following result: Can't call method "maketext" on an undefined value at bin\maketext-demo.pl line 23. If I swap ->get_handle to ->new:
my $lang = TopTable::Maketext->new; printf "%s\n", $lang->maketext( "menu.title.news" );
I get the following:
maketext doesn't know how to say: menu.title.news as needed at bin\maketext-demo.pl line 23.
I'm at a bit of a loss as to what to try next! Thank you so much in advance for any pointers anyone can give.

In reply to Re: Catalyst: accessing maketext from a model by mkchris
in thread Catalyst: accessing maketext from a model by mkchris

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-26 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found