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;
}
#----------------------------------------------------------------------
On 04/02/2011 15:17, Oren Maurer wrote:
> Gabor ad all
> Hi
>
> Sorry for replying only now.
>
> Here is what I get when doing 'locale':
>
> --->>>
> [meorero@meorero-arch05 ~]$ locale
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=en_US.UTF-8
> [meorero@meorero-arch05 ~]$
> <<<---
>
> On Sun, Jan 30, 2011 at 6:19 PM, Gabor Szabo <[email protected]
> <mailto:[email protected]>> wrote:
>
> On Sat, Jan 22, 2011 at 6:08 PM, Oren Maurer <[email protected]
> <mailto:[email protected]>> wrote:
> > Hi.
> > I have succeeded to get Padre (the las version, 0.78) on Arch Linux.
> > On Arch Linux - Padre is part of AUR (Arch User Repository).
> > But I installed by CPAN, because compiling (of WX) and installing
> from the
> > AUR package failed.
> > Maybe I will investigate it some time...
> > Anyway - now, when I type 'padre' on my X terminal, Padre comes
> up , but I
> > get also this:
> > [meorero@meorero-arch05 ~]$ padre
> > 05:45:14 PM: Error: Cannot set locale to 'en_GB'.
> > [meorero@meorero-arch05 ~]$
> > Do you know why, and what shall I do?
> >
>
> what do you get when you type the following?
>
> $ locale
>
>
> Gabor
> _______________________________________________
> Padre-dev mailing list
> [email protected] <mailto:[email protected]>
> http://mail.perlide.org/mailman/listinfo/padre-dev
>
>
>
>
> --
> ________________________________
> Oren Maurer
> http://oren.maurer.org.il
> http://meorero.wordpress.com
> _______________________________
> # =======================|
> # Please avoid sending me Word |
> # or PowerPoint attachments |
> # =======================|
> # See: http://www.gnu.org/philosophy/no-word-attachments.html
>
>
>
> _______________________________________________
> Padre-dev mailing list
> [email protected]
> http://mail.perlide.org/mailman/listinfo/padre-dev
_______________________________________________
Padre-dev mailing list
[email protected]
http://mail.perlide.org/mailman/listinfo/padre-dev