on windows, i have to press shift+alt to change language
is there an api to get the current language, and to set (or switch to) another language?
thanks
change language
Re: change language
Code: Select all
Debug "User Language:"
Select GetUserDefaultLangID_() & $03FF
Case #LANG_ENGLISH
Debug "#LANG_ENGLISH"
Default
Debug "?"
EndSelect
Debug ""
Debug "Keyboard Layout:"
Select GetKeyboardLayout_(0) & $03FF
Case #LANG_ENGLISH
Debug "#LANG_ENGLISH"
Default
Debug "?"
EndSelecti hope not.effis wrote:and to set (or switch to) another language?
c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: change language
it return the same value before and after shift+altUser Language:
?
Keyboard Layout:
#LANG_ENGLISH
r u sure it isnt possible to switch?
Re: change language
Try this:
HTH.
Code: Select all
hkl1=LoadKeyboardLayout_("00000401",#KLF_REORDER)
hkl2=LoadKeyboardLayout_("0000040C",#KLF_REORDER)
OpenWindow(1,200,100,500,300,"test 1",#PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget |#PB_Window_ScreenCentered)
TextGadget(0,20,20,70,20,"language1=")
StringGadget(1,100,20,150,20,"")
TextGadget(2,20,50,70,20,"language2=")
StringGadget(3,100,50,150,20,"")
Repeat
Event = WaitWindowEvent() ; This line waits until an event is received from Windows
WindowID = EventWindow() ; The Window where the event is generated, can be used in the gadget procedures
GadgetID = EventGadget() ; Is it a gadget event?
EventType = EventType() ; The event type
Select EventType()
Case #PB_EventType_Focus
If GadgetID=1
ActivateKeyboardLayout_(hkl1,#KLF_REORDER)
ElseIf GadgetID=3
ActivateKeyboardLayout_(hkl2,#KLF_REORDER)
EndIf
EndSelect
Until event=#PB_Event_CloseWindow
End
Re: change language
Shift+Alt does not switch any language. It switches the keyboard layout.
Re: change language
yeah, i think its this, but only two questions
i runned your exemple and now i've got the arabic language on my computer, how can i delete it (it don't appear in the control panel)
i saw un api : UnloadKeyboardLayout_ but i didnt understand what to put in it, i've tried : UnloadKeyboardLayout_(hkl1) and UnloadKeyboardLayout_("00000401") but its not working
and also, thats good for switching laguage input, but how can i get the current language? let's say i want to display in french if the input language is french, russian if its russian, and english if english
and finnaly, where did you find the language list?
thanks a lot
i runned your exemple and now i've got the arabic language on my computer, how can i delete it (it don't appear in the control panel)
i saw un api : UnloadKeyboardLayout_ but i didnt understand what to put in it, i've tried : UnloadKeyboardLayout_(hkl1) and UnloadKeyboardLayout_("00000401") but its not working
and also, thats good for switching laguage input, but how can i get the current language? let's say i want to display in french if the input language is french, russian if its russian, and english if english
and finnaly, where did you find the language list?
thanks a lot
Re: change language
because the keyboard layout switch doesnt affect the whole system, but just a thread. ofc nothing will change if you debug the code within the ide like that.effis wrote:it return the same value before and after shift+alt
look:
Code: Select all
If OpenWindow(0, 0, 0, 205, 30, "Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(0, 5, 5, 140, 20, "")
ButtonGadget(1, 150, 5, 50, 20, "Click")
SetActiveGadget(0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
If EventGadget() = 1
Debug "User Language:"
Select GetUserDefaultLangID_() & $03FF
Case #LANG_ENGLISH
Debug "#LANG_ENGLISH"
Case #LANG_GERMAN
Debug "#LANG_GERMAN"
Case #LANG_FRENCH
Debug "#LANG_FRENCH"
Default
Debug "?"
EndSelect
Debug ""
Debug "Keyboard Layout:"
Select GetKeyboardLayout_(0) & $03FF
Case #LANG_ENGLISH
Debug "#LANG_ENGLISH"
Case #LANG_GERMAN
Debug "#LANG_GERMAN"
Case #LANG_FRENCH
Debug "#LANG_FRENCH"
Default
Debug "?"
EndSelect
Debug ""
EndIf
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
EndIf : Endnco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: change language
thanks gabriel
i made this code
is it correct?
and thanks nco2k, i think your code is very good
i made this code
Code: Select all
num=4
Dim lan.s(num,3)
lan(1,1)="0000040c":lan(1,2)="french"
lan(2,1)="0000040d":lan(2,2)="hebrew"
lan(3,1)="00000409":lan(3,2)="english"
lan(4,1)="00000408":lan(4,2)="?"
For k=1 To num
lan(k,3)=Str(LoadKeyboardLayout_(lan(k,1),#KLF_REORDER))
Next
OpenWindow(1,200,100,500,300,"Language Test",#PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget |#PB_Window_ScreenCentered)
For k=1 To num
TextGadget(#PB_Any,20,30*k+2,70,20,lan(k,2))
StringGadget(k,100,30*k,150,20,"")
Next
SetActiveGadget(1)
Repeat
Event = WaitWindowEvent()
GadgetID = EventGadget()
EventType = EventType()
Select EventType()
Case #PB_EventType_Focus
If GadgetID>0 And GadgetID<num+1
ActivateKeyboardLayout_(Val(lan(GadgetID,3)),#KLF_REORDER)
EndIf
EndSelect
Until event=#PB_Event_CloseWindow
For k=1 To num
UnloadKeyboardLayout_(Val(lan(k,3)))
Next
Endand thanks nco2k, i think your code is very good
Re: change language
looks fine!
Good continuation
Good continuation



