[jifty-devel] PoDir isn't absolute

Jesse Vincent jesse at bestpractical.com
Wed Mar 7 14:08:39 EST 2007




On Wed, Mar 07, 2007 at 03:30:48AM +0200, Alexey Grebenschikov wrote:
> Hi All,
> 
> My L10N (share/po/*.po) files don't load. Jifty::I18N doesn't find it
> because current work directory /some/project/bin (not /some/project).
> PoDir looks like share/po and Jifty::I18N doesn't convert a relative
> directory to absolute one.
> 
> I have written a patch that uses Jifty::Util->absolute_path.
> May be I am wrong. What do you think about ? 


I think a cleaner patch would inspect the whole array afterward and
using absolute_path on its value then. Does that make sense?

> 
> Best regards,
> Alexey.

> Index: lib/Jifty/I18N.pm
> ===================================================================
> --- lib/Jifty/I18N.pm	(revision 2915)
> +++ lib/Jifty/I18N.pm	(working copy)
> @@ -7,6 +7,7 @@
>  use Email::MIME::ContentType;
>  use Encode::Guess qw(iso-8859-1);
>  use File::ShareDir ':ALL';
> +use Jifty::Util;
>  
>  =head1 NAME
>  
> @@ -38,8 +39,12 @@
>      bless $self, $class;
>  
>      my @import = (
> -        'Gettext',Jifty->config->framework('L10N')->{'PoDir'}. '/*.po',
> -        'Gettext',Jifty->config->framework('L10N')->{'DefaultPoDir'}. '/*.po'
> +        'Gettext', Jifty::Util->absolute_path( 
> +				Jifty->config->framework('L10N')->{'PoDir'}. '/*.po'
> +			),
> +        'Gettext', Jifty::Util->absolute_path(
> +				Jifty->config->framework('L10N')->{'DefaultPoDir'}. '/*.po'
> +			)
>          );
>  
>      foreach my $plugin (Jifty->plugins) {
> @@ -47,7 +52,7 @@
>          my $dir = eval { module_dir(ref($plugin)); };
>          next unless $dir;
>          push @import, 'Gettext';
> -        push @import, $dir . '/po/*.po';
> +        push @import, Jifty::Util->absolute_path( $dir . '/po/*.po' );
>      };
>  
>      Locale::Maketext::Lexicon->import(
> @@ -118,8 +123,12 @@
>      my $modified = join(
>          ',',
>          sort map { $_ => -M $_ } map { glob("$_/*.po") } (
> -            Jifty->config->framework('L10N')->{'PoDir'},
> -            Jifty->config->framework('L10N')->{'DefaultPoDir'}
> +            Jifty::Util->absolute_path( 
> +				Jifty->config->framework('L10N')->{'PoDir'} 
> +			),
> +            Jifty::Util->absolute_path( 
> +				Jifty->config->framework('L10N')->{'DefaultPoDir'}
> +			)
>          )
>      );
>      if ($modified ne $last_modified) {

> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel


-- 


More information about the jifty-devel mailing list