Skip to content

Commit

Permalink
Item14152: Merge commit '883e7cb2ae207df6b817710d1f9f33c20b4c8247' in…
Browse files Browse the repository at this point in the history
…to Item14152

* commit '883e7cb2ae207df6b817710d1f9f33c20b4c8247':
  Item13897: Fixed xgettext to work with OO model.
  Item13897: Locale typo - spelled Local
  • Loading branch information
vrurg committed Sep 6, 2016
2 parents 6b5e82c + 883e7cb commit 3f9dcc1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
5 changes: 1 addition & 4 deletions core/lib/Foswiki/App.pm
Expand Up @@ -1510,10 +1510,7 @@ sub _prepareDispatcher {
status => 404,
header => 'Not Found',
text => 'The requested URL '
. (
$this->engine->request->uri
// 'action:' . $this->engine->pathData->{action}
)
. ( $this->request->uri // 'action:' . $this->request->action )
. ' was not found on this server.',
);
}
Expand Down
5 changes: 3 additions & 2 deletions core/lib/Foswiki/Engine/CLI.pm
Expand Up @@ -20,8 +20,7 @@ use Foswiki::Request ();
use Foswiki::Request::Upload ();
use Foswiki::Response ();

use Moo;
use namespace::clean;
use Foswiki::Class;
extends qw(Foswiki::Engine);

use constant HTTP_COMPLIANT => 0;
Expand Down Expand Up @@ -123,6 +122,8 @@ around _preparePath => sub {
$path_info = $this->pathInfo;
$this->clear_pathInfo;
}
$action = 'view'
unless defined $this->app->cfg->data->{SwitchBoard}{$action};
return {
action => $action,
path_info => $path_info,
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/I18N.pm
Expand Up @@ -237,7 +237,7 @@ around BUILDARGS => sub {
Constructor. Gets the language object corresponding to the current users
language. If $app is not a Foswiki::App object reference, just calls
Local::Maketext::new (the superclass constructor)
Locale::Maketext::new (the superclass constructor)
=cut

Expand Down
8 changes: 5 additions & 3 deletions core/lib/Foswiki/I18N/Extract.pm
Expand Up @@ -12,9 +12,11 @@ Depends on Locale::Maketext::Extract (part of CPAN::Locale::Maketext::Lexicon).
package Foswiki::I18N::Extract;
use v5.14;

use Moo;
use Assert;
use Try::Tiny;

use Foswiki::Class qw(app);
extends qw(Foswiki::Object);
with qw(Foswiki::AppObject);

our $initError;

Expand Down Expand Up @@ -58,7 +60,7 @@ around BUILDARGS => sub {
my $orig = shift;

try {
Foswiki::load_package('Local::Maketext::Extract');
Foswiki::load_package('Locale::Maketext::Extract');
}
catch {
$initError = ref($_) ? $_->stringify : $_;
Expand Down
18 changes: 16 additions & 2 deletions core/tools/xgettext
Expand Up @@ -3,6 +3,7 @@
# Script to extract strings from Foswiki sources and templates

use strict;
use v5.14;

# force the use from the root
-d 'core'
Expand All @@ -11,7 +12,12 @@ use strict;
);

use File::Spec;
use Try::Tiny;

use Foswiki::App ();
use Foswiki::Exception ();

$ENV{PATH};
my $cwd = `pwd`;
chomp($cwd);
unshift( @INC, File::Spec->catfile( $cwd, 'core/lib' ) );
Expand Down Expand Up @@ -80,7 +86,9 @@ sub extract {
my ( $target, @sources ) = @_;
print "I: Extracting strings into $target.\n";

my $extractor = new Foswiki::I18N::Extract;
local %ENV = %ENV;
my $app = Foswiki::App->new( env => \%ENV );
my $extractor = $app->create('Foswiki::I18N::Extract');
die(
"Could not create an extractor. Is Locale::Maketext installed? (see above messages)"
) unless $extractor;
Expand Down Expand Up @@ -123,7 +131,13 @@ if ( $ARGV[0] eq '--list' ) {
}

# extract the strings to the template POT file.
extract( $newpotfile, @sources );
try {
extract( $newpotfile, @sources );
}
catch {
say STDERR Foswiki::Exception::errorStr($_);
exit 1;
};

# merge with old POT file
if ( -e $potfile ) {
Expand Down

0 comments on commit 3f9dcc1

Please sign in to comment.