Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Win32 Language

by shadox (Priest)
on Jun 10, 2003 at 19:17 UTC ( #264829=perlquestion: print w/replies, xml ) Need Help??

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

Hi there, i just finished some script for one of my clients, the script was suposed to run in Win32 in english, now i just get the *great* new that it should run in windows in german and spanish, the change is very little, but i can't find a way to get the Windows Language, how can i do this?

* yes , i did search in google
* yes , i did use super search
* yes , i try in irc too


Optimus magister, bonus liber

Replies are listed 'Best First'.
Re: Win32 Language
by flounder99 (Friar) on Jun 10, 2003 at 19:48 UTC
    C:\>perl -e "use POSIX; print setlocale(LC_CTYPE)"
    on my system it prints:
    English_United States.1252
    I dont have access to any other versions of Windows, so you will have to try it yourself.



Re: Win32 Language
by jand (Friar) on Jun 10, 2003 at 23:35 UTC
    You can use the Win32::OLE::NLS module to access the Windows National Language System stuff. For example:
    use strict; use Win32::OLE::NLS qw(:DEFAULT :LOCALE); my $lcid = GetSystemDefaultLCID(); print GetLocaleInfo($lcid, LOCALE_SLANGUAGE);
    It also provides you with localized dates, times, money etc (in combination with Win32::OLE::Variant).
Re: Win32 Language
by BrowserUk (Patriarch) on Jun 11, 2003 at 01:22 UTC

    You can also get the country, locale and other internationalisation (Sorry. I forgot the abbreviation:) from the registry using Tie::Registry

    HKCU/Control Panel/International/Locale HKCU/Control Panel/International/SCountry

    The date format, currancy symbol etc. are also there.

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Re: Win32 Language
by NetWallah (Canon) on Jun 10, 2003 at 19:29 UTC
    I did not have much time to dig too deep into this, but here is some info to get you some direction:

    These functions are related to general execution environment.
    NtQueryDefaultLocale GetLocaleInfo Retrieves information about the locale.
    NtSetDefaultLocale SetLocaleInfo Sets locale information. NtQuerySystemEnvironmentValue GetEnvironmentVariable Gets the value of an environment variable.
    NtSetSystemEnvironmentValue SetEnvironmentVariable Sets the value of an environment variable.
    NtQueryDefaultUILanguage New to NT 5.0. NT 5.0 supports on-the-fly language changes. Queries the current language.
    NtSetDefaultUILanguage New to NT 5.0. NT 5.0 supports on-the-fly language changes. Sets the current language.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://264829]
Approved by silent11
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2023-06-04 21:22 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (22 votes). Check out past polls.