On Fri, Feb 4, 2011 at 5:56 PM, Mark Dootson <mark.doot...@znix.com> wrote: > Hi, > > I took a look at the locale code, and assuming that what is required is > to load the language translations, I don't think you should be setting > the Locale to en_GB by default. > > The following code allows you to save .mo catalogs with names such as > > en_GB.mo > en_US.mo > > > code will load the most appropriate catalogs if they exist. > No need at all to change the locale of the user. If message catalogs for > user's locale are available, they'll get translations. If not, they'll > get the strings in 'en'. Of course, you don't actually need a catalog > for 'en' if that's what you decide represents the locale for the strings > in the source code. > > Hope this helps. > > #--------------------------------------------------------------------- > > # Suggested alternate way to load language files for Padre > > my $langid = Wx::Locale::GetSystemLanguage; > my $locale = Wx::Locale->new($langid); > > # add lookup prefixes > my $catpathprefix = 'path to where the mo files are'; > $locale->AddCatalogLookupPathPrefix( $catpathprefix ); > > # add catalogs in order > my($shortfile, $longfile); > > my $langname = $locale->GetCanonicalName(); # en_GB, en_US etc. > > my $shortname = ( $langname ) ? substr($langname,0,2) : 'en'; > > my $filename = qq($catpathprefix/$shortname.mo); > $shortfile = 1 if -f $filename; > > if($shortfile) { > my $result = $locale->AddCatalog( $shortname ) ; > warn (gettext('Unable to load language for locale') . ' %s', > $shortname) if !$result; > } > > $filename = qq($catpathprefix/$langname.mo); > > $longfile = 1 if -f $filename; > if( ($longfile) && ( $shortname ne $langname) ) { > my $result = $locale->AddCatalog( $langname ); > warn(gettext('Unable to load language for locale') . ' %s', > $langname) if !$result; > } > > #---------------------------------------------------------------------- >
Mark, why don't you just join us on IRC http://padre.perlide.org/irc.html?channel=padre ask someone to give you a commit bit and make the changes? Then we'll have at least one committer who understand wx :) regards Gabor _______________________________________________ Padre-dev mailing list Padre-dev@perlide.org http://mail.perlide.org/mailman/listinfo/padre-dev