Re: Another case of gettext with Gtk2::GladeXML



Huh!? You are very right... copying the joellisme.mo in one of those
directories works.

That forced my to RTFM! ;-)
To get both code and glade translations to work, i simply need:

# Code Intl
use POSIX;
use Locale::TextDomain ( 'joellisme' );
# Glade intl
use Locale::gettext;
my $d = Locale::gettext->domain( 'joellisme' );
$d->dir( 'LocaleData' ); # look in ./LocaleData

I don't need the rest of the code, namely:

   # Hack to get this working under mandrake
   use lib qw(/usr/lib/libDrakX);
   eval { require c::stuff };
   if ($@) {
       bind_textdomain_codeset('joellisme', "UTF-8");
   } else {
       c::stuff::bind_textdomain_codeset('joellisme', "UTF-8");
   }

Thank you very much for your help Chris!

-Pascal

On 8/18/06, Chris Debenham - PTS Engineer <Chris Debenham sun com> wrote:
I traced the script and found that it is only looking for joellisme.mo
in:
/usr/share/locale/fr_CA/LC_MESSAGES/joellisme.mo
/usr/share/locale/fr/LC_MESSAGES/joellisme.mo
/usr/share/locale-langpack/fr_CA/LC_MESSAGES/joellisme.mo
/usr/share/locale-langpack/fr/LC_MESSAGES/joellisme.mo

You need to either put the .mo file in one of those places, or find some
way to tell libglade to look in a different directory for the
translation (there may be an environment variable to help here)

Chris

On Thu, 2006-08-17 at 02:45 -0400, Pascal wrote:
> Hi Chris,
>   for a moment I thought it could have been it...
> but nope, i tried:
>   $xml_root = Gtk2::GladeXML->new( $glade_dir."/joellisme.glade",
> undef, 'joellisme' );
>
> still the same results :-(
> glade file is ignored...
>
> -Pascal
>
> On 8/17/06, Chris Debenham <chris adebenham com> wrote:
> > Ahh, I see your problem.
> > When you load the glade you use
> >
> >   $xml_root = Gtk2::GladeXML->new( $glade_dir."/joellisme.glade" );
> >
> > To get gettext to handle the glade you need to add the DOMAIN option.
> > Change the line to
> >
> >   $xml_root = Gtk2::GladeXML->new( $glade_dir."/joellisme.glade", 'gui',
> > 'joellisme);
> >
> > and give it another try.
> > I'm not sure if you need the 'gui' bit, you may be able to leave this as
> > ''
> >
> > Chris
> >
> > On Thu, 2006-08-17 at 01:00 -0400, Pascal wrote:  $xml_root =
> > > Hi,
> > >  i'd like to came back on the email:
> > > http://mail.gnome.org/archives/gtk-perl-list/2005-November/msg00034.html
> > >
> > > I can get the translation working no problem for the code part
> > > (joellisme.pl), but not the glade file.
> > > Including Chris' code (see EXPERIMENTAL section in joellisme.pl), i
> > > get an error at runtime:
> > >  Subroutine main::gettext redefined at /usr/share/perl/5.8/Exporter.pm line 65.
> > >  at ./joellisme.pl line 40
> > >
> > > And the interface part doesn't get translated.
> > > You can reproduce by running in fr_CA, type hoax, click search and
> > > look if the button Ignore is Ignorer.
> > >
> > > My translations are in po/ .
> > > I update them with a small Makefile for the moment.
> > > Use "make" to see the different possibilities.
> > > "make all" will update the .pot, update the po file, convert to mo
> > > file, install mo file in ../LocaleData .
> > >
> > > thanks for any tips/help,
> > >
> > > -Pascal
> > > --
> > > Homepage (http://organact.mine.nu)
> > > Debian GNU/Linux (http://www.debian.org)
> > >
> >
> >
> >
>
>
-------------------------------------------------------------------------------
  ,-_|\  RSD Engineer                        E-mail : debenham sun com
 /     \ Sun Microsystems Australia Pty Ltd. Direct : +61 (2) 9844 5188
 \_,-\_* 828 Pacific Highway                 Phone  : +61 (2) 9844 5000
      v  Gordon, N.S.W. 2072                 Fax    : +61 (2) 9844 5189
                                             Mobile : +61 (40) 9844 514
-------------------------------------------------------------------------------
Death Is Hereditary.




--
Homepage (http://organact.mine.nu)
Debian GNU/Linux (http://www.debian.org)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]