B4A Library TRADUTTORE YANDEX

Hello everyone this is a library that is based on YouTuber bee free.
Simply request an API key ..

This is an example of code:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim trad As Traduttore
    Dim webextra As WebViewExtras
    Private WebView1 As WebView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("1")
   
    trad.ImpostaTraduttore ("it","en","{API KEY}","ciao come stai")

    webextra.addJavascriptInterface(WebView1, "B4A") ' per scaricare html
    Log(trad.Richiesta )
    WebView1.LoadUrl (trad.Richiesta )
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub WebView1_PageFinished (url As String) 
    Log("Webview_finito")
        Dim Javascript As String
           Javascript="B4A.CallSub('ProcessHTML', false, document.documentElement.outerHTML)"
           Log("PageFinished: "&Javascript)
           webextra.executeJavascript(WebView1, Javascript)
       
End Sub

Sub ProcessHTML(HTML As String) 

    trad.Traduci_Testo(HTML)
    Log (trad.Testo_Tradotto)           
End Sub
 

Attachments

  • Libreria Yandex translator.zip
    2.8 KB · Views: 165

LucaMs

Expert
Licensed User
Longtime User
Thank you for sharing.

When you have time, you should list and describe properties and methods of the library.

(Also, you could make it even more automatic, without the user/programmer must create the objects you've created in the sample source, inserting them into the library).

Thanks again.
 

androidappl

Active Member
Licensed User
Longtime User
[quote = "LucaMs, post: 287333, membri: 51.832"] Grazie per la condivisione.

Quando avete tempo, si dovrebbe elencare e descrivere le proprietà ei metodi della biblioteca.

(Inoltre, è possibile rendere ancora più automatica, senza che l'utente / programmatore deve creare gli oggetti che hai creato in origine di esempio, inserendoli nella libreria).

Grazie ancora. [/ QUOTE]

hello again haha,
Now you'll see the power of google translate haha. (My english)
Definitely do list and describe the properties and methods of the library.

Unfortunately you can not make it automatic because it does not work if you put in the library as rely on a library webextras
 

LucaMs

Expert
Licensed User
Longtime User
Anch'io uso Google Translate, altrimenti impiegherei ore per un post e non sarei a 4.443 ;)

Unfortunately you can not make it automatic because it does not work if you put in the library as rely on a library webextras

I'm not so sure, but... I understand that it is an unpaid extra work :D
 

androidappl

Active Member
Licensed User
Longtime User
Anch'io uso Google Translate, altrimenti impiegherei ore per un post e non sarei a 4.443 ;)

Purtroppo non si può rendere automatico perché non funziona se si mette nella libreria come fare affidamento su un webextras biblioteca

Io non sono così sicuro, ma ... ho capito che si tratta di un lavoro extra non retribuito : D[/ QUOTE]

Ci ho provato veloce ma ci ho provato..
 
Top