Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Wise Monks,

I am attempting to obtain the ISO Standard 639 English name of a Win32 computer using Win32::OLE::NLS.

use Win32::OLE::NLS; $LCID = GetSystemDefaultLCID(); # evaluates to '1033' print GetLocaleInfo($LCID, 'LOCALE_SENGLANGUAGE');

returns nothing.

What am I missing?

Thanks for any suggestions!

Replies are listed 'Best First'.
Re: Getting English name of locale language
by tachyon (Chancellor) on Apr 11, 2003 at 11:35 UTC

    The second argument to GetLocaleInfo() is a constant (so you don't quote it) that you will either need to import (don't really know from where but using Win32::OLE::Const) or just have a look at this:

    use Win32::OLE::NLS; $LCID = GetSystemDefaultLCID(); for my $const ( 0..88 ) { print "Const val $const\t", GetLocaleInfo($LCID, $const ), "\n"; } __DATA__ Const val 0 Const val 1 0409 Const val 2 English (United States) Const val 3 ENU Const val 4 English Const val 5 1 Const val 6 United States Const val 7 USA Const val 8 United States Const val 9 0409 [snip] Const val 20 $ Const val 21 USD [snip] Const val 31 M/d/yyyy [yada yada]

    It continues on with currency, date, etc, etc. The data ends at a const value of 88 FWIW, that why it only goes to 88.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Thanks!
Re: Getting English name of locale language
by tachyon (Chancellor) on Apr 11, 2003 at 11:22 UTC

    Win32::Locale

    use Win32::Locale; my $language = Win32::Locale::get_language(); if($language eq 'en-us') { print "Wasaaap homeslice!\n"; } else { print "You $language people ain't FROM around here, are ya?\n"; }

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print