Results 1 to 8 of 8

Thread: Getting Language

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    64

    Getting Language

    Hello,

    I want to get the system Language that the user chooses.
    I mean by system Language, the language that the user select from the right part of the taskbar, next to the clock.
    I inserted the GetSystemDefaultLangID, and GetUserDefaultLangID from the APIViewer.
    I am calling them, but the result is not changing while changing the language.
    When I change the regional settings from the control panel, the Language ID I am getting from the GetUserDefaultLangID function is changing, but unfortunately it’s not the case I want.
    So what do you think I must do to fix my problem??
    Thanks for your help.

  2. #2
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    check this out:

    VB Code:
    1. Const LOCALE_USER_DEFAULT = &H400
    2. Const LOCALE_SENGCOUNTRY = &H1002 '  English name of country
    3. Const LOCALE_SENGLANGUAGE = &H1001  '  English name of language
    4. Const LOCALE_SNATIVELANGNAME = &H4  '  native name of language
    5. Const LOCALE_SNATIVECTRYNAME = &H8  '  native name of country
    6.  
    7. Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long
    8.  
    9. Private Sub Form_Load()
    10.     'KPD-Team 2001
    11.     'URL: [url]http://www.allapi.net/[/url]
    12.     'E-Mail: [email][email protected][/email]
    13.     MsgBox "You live in " & GetInfo(LOCALE_SENGCOUNTRY) & " (" & GetInfo(LOCALE_SNATIVECTRYNAME) & ")," & vbCrLf & "and you speak " & GetInfo(LOCALE_SENGLANGUAGE) & " (" & GetInfo(LOCALE_SNATIVELANGNAME) & ").", vbInformation
    14. End Sub
    15.  
    16. Public Function GetInfo(ByVal lInfo As Long) As String
    17.     Dim Buffer As String, Ret As String
    18.     Buffer = String$(256, 0)
    19.     Ret = GetLocaleInfo(LOCALE_USER_DEFAULT, lInfo, Buffer, Len(Buffer))
    20.     If Ret > 0 Then
    21.         GetInfo = Left$(Buffer, Ret - 1)
    22.     Else
    23.         GetInfo = ""
    24.     End If
    25. End Function

    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    64

    Wink

    Thanks for your help, but this fuction too is getting it's Source from the Regional Setting in the Control Pannel.
    I want to get the infotmations from the Language choosen in the taskbar.
    So, please if you have any new idea, just let me know.

  4. #4
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Where can u find your language in the taskbar???
    Don't Rate my posts.

  5. #5
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    what OS are you using???
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2002
    Posts
    64

    OS

    Hello, once again.
    First I am using the win 98 as my Operating system.
    my application is coded under Visual Basic 6.0.

    Second, in the multi Language Operating Systems, choosing LAnguages, can be find in the Taskbar, at the right next to the volume control and the time.

  7. #7
    Red Rush-In
    Guest
    Originally posted by Pc_Madness
    Where can u find your language in the taskbar???
    Here is what he is talking about. (see the image below)


    If you have multiple languages set for Windows, it will add an app to your system tray to allow you to togle between languages that you use.
    In XP they moved it from the system tray to the taskbar.

    I played with all the local based APIs that I could find. Unfortunately they all return the default language.
    I guess Microsofts thinking is that your program should only respond to the users default language.
    If this is the case, then the only use of being able to togle languages is for changing the keyboard layout/characters and for accessing web pages.

    Nahlous, do you know of any programs that respond to the languge that you have selected?

    Hmm, wait a second isn't IE able to do this?
    I know the browser sends info to sites regarding you currently selected language. I've done this to test a multilanguage site that I was developing......
    But I could be mistaken, meaning I may have had to actually change the default language.
    Attached Images Attached Images  

  8. #8
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Aah.
    Don't Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width