Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

Comment on Win32 Language
Re: Win32 Language
by NetWallah (Abbot) 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.

Re: Win32 Language
by flounder99 (Friar) on Jun 10, 2003 at 19:48 UTC
    Try
    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.

    --

    flounder

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 (Pope) 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


Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (16)
As of 2014-12-18 16:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (58 votes), past polls