Jump to content

Google translator (coded languages)


Giggo
 Share

Recommended Posts

hello forums!

is possible add tradution to language > example text: Ãëàâíîå ìåíþ 

the program translate Russian: Ãëàâíîå ìåíþ  to Главное меню I would also like to translate it in reverse

example2: if I write this text Main menu I would like the output texts > Ãëàâíîå ìåíþ 

 

code:

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>

Switch @OSLang
    Case 0410 To 0409
        $1 = "Traduci"
        $2 = "Copia"
        $3 = "Cancella Box 1"
        $4 = "Cancella Box 2"
        $5 = "Traduttore Google" ;Gui Name
    Case Else
        $1 = "Translate"
        $2 = "Copy"
        $3 = "Cancel Box 1"
        $4 = "Cancel Box 2"
        $5 = "Google Translator" ;Gui Name
EndSwitch

$hGui = GUICreate($5, 1016, 849, -1, -1)

$eInput = GUICtrlCreateEdit("", 8, 40, 1000, 400)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xFFFFE1)

$eOutput = GUICtrlCreateEdit("", 8, 442, 1000, 400)
GUICtrlSetFont(-1, 11, 400, 0, "Arial")
GUICtrlSetBkColor(-1, 0xFFFFE1)

$BtnRun = GUICtrlCreateButton($1, 5, 8, 100, 23)
$BtnCopy = GUICtrlCreateButton($2, 110, 8, 100, 23)

$BtnCancelBox_1 = GUICtrlCreateButton($3, 289, 8, 100, 23)
$BtnCancelBox_2 = GUICtrlCreateButton($4, 395, 8, 100, 23)

$cb1 = GUICtrlCreateCombo("", 892, 8, 50, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))

GUICtrlSetData(-1, "en|it|ru|es|fr|ro|ja|de|ar", "en")
GUICtrlSetFont(-1, 10, 400, 0, "Courier new")

$cb2 = GUICtrlCreateCombo("", 956, 8, 50, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE))
GUICtrlSetData(-1, "it|en|ru|es|fr|ro|ja|de|ar", "it")
GUICtrlSetFont(-1, 10, 400, 0, "Courier new")

GUISetState(@SW_SHOW)



While 1
         $nMsg = GUIGetMsg()
         Switch $nMsg
                   Case $GUI_EVENT_CLOSE
                            ExitLoop
                            Case $BtnCancelBox_1
                            GUICtrlSetData($eInput, "")
                            Case $BtnCancelBox_2
                            GUICtrlSetData($eOutput, "")
        Case $BtnRun

            $Trad = GUICtrlRead($eInput)
            $Url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" & GUICtrlRead($cb1) & "&tl=" & GUICtrlRead($cb2) & "&dt=t&q=" & $Trad
            $URLData = BinaryToString(InetRead($Url), 4)
            $URLOutput = StringMid($URLData, 5, StringInStr($URLData, '","')-5) & @CRLF
            GUICtrlSetData($eOutput, $URLOutput)
            
Case $BtnCopy
Local $sText = GUICtrlRead($eOutput)
If $sText <> "" Then
ClipPut($sText)
EndIf
    EndSwitch
WEnd

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...