B4A Library [Library] New B4ATranslator

Hi guys, today I am pleased to introduce my new B4ATranslator library.

Based on Bing Translator.

The zip contain the library and demo.

Go to this address below and register to get your own key.


The Link below show a Complete video how u can get your client id and client secret. I ope it´s use full.


http://wordfast.fi/blog/cat-tools/2...nslator-api-with-client-id-and-client-secret/

Any comment will be appreciated.


Thanks in advance


B4ATranslator
Author:
Giuseppe Salvi
Version: 1

  • Fields:
    • ARABIC As String
    • BULGARIAN As String
    • CATALAN As String
    • CHINESE_SIMPLIFIED As String
    • CHINESE_TRADITIONAL As String
    • CZECH As String
    • DANISH As String
    • DUTCH As String
    • ENGLISH As String
    • ESTONIAN As String
    • FINNISH As String
    • FRENCH As String
    • GERMAN As String
    • GREEK As String
    • HAITIAN As String
    • HEBREW As String
    • HINDI As String
    • HMONG As String
    • HUNGARIAN As String
    • INDONESIAN As String
    • ITALIAN As String
    • JAPANESE As String
    • KOREAN As String
    • LATVIAN As String
    • LITHUANIAN As String
    • MALAY As String
    • NORWEGIAN As String
    • PERSIAN As String
    • POLISH As String
    • PORTUGUESE As String
    • ROMANIAN As String
    • RUSSIAN As String
    • SLOVAK As String
    • SLOVENIAN As String
    • SPANISH As String
    • SWEDISH As String
    • THAI As String
    • TURKISH As String
    • UKRAINIAN As String
    • URDU As String
    • VIETNAMESE As String
  • B4ATranslator
    Permissions:
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.INTERNET
    Properties:
    • ApiKey As String
      Get or Set the ApiKey
      Example:
      a.ApiKey = "XXXXXXXXXXXXXXXXXXXXXXXXX"
    • ClientId As String
      Get or Set the ClientId
      Example:
      a.ClientId = "XXXXXXXXXXXXXXXXXXXXXXXXX"
    • ClientSecret As String
      Get or Set the ClientSecret
      Example:
      a.ClientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXX"
    • LangForTrans As String [read only]
      Return one of the language to be used for translation
    • LanguagesForList As ArrayList [read only]
      Return the list of the Languages to be diplayed
    • LanguagesForTranslation As ArrayList [read only]
      Return the list of the languages to be used for translation
    • Source As String
      Get or Set Source Language for translation
      Example:
      a.Source = "en"
    • Target As String
      Get or Set Target Language for translation
      Example:
      a.Targt = "it"
    • Text As String
      Get or Set text to be Translated
      Example:
      a.Text = "blablablablablabla"
    • Translate As TextView [write only]
      Translates text set before in a.text
      Example:
      a.Translation = Label1
 

Attachments

  • ICOSTranslator v1.0.zip
    61.1 KB · Views: 516
  • pic1.png
    pic1.png
    21.4 KB · Views: 570
  • pic2.png
    pic2.png
    37.9 KB · Views: 623
  • B4ATranslator v1.10 Lib.zip
    41.7 KB · Views: 385
Last edited:

pierpa

Member
Licensed User
Longtime User
hello,

is bing service modified? I need your library, But I cannot make it work
 

pierpa

Member
Licensed User
Longtime User
thank you.

i managed to make it work.

i just messed client ID and client secret. then i found this in microsoft docs:

6567.clip_5F00_image014_5F00_24729FC4.png
 

pierpa

Member
Licensed User
Longtime User
Now it works as i wrote. With client id and client secret.

Where do i get that apikey?
 

MoraviaVenus

Member
Licensed User
Longtime User
HI lonleystar,

I wanted to use your library, but when I run your application, by an attempt to translate word I get message: java.lang.Exception: [microsoft-translator-api] Error retrieving translation : Not trusted server certificate.

Please, what is the reason and how should I avoid it?

I used my own a.ClientId and a.ClientSecret and I didn't use a.ApiKey (I don't know where to get it :( ).

Thank you.
 

MoraviaVenus

Member
Licensed User
Longtime User
Hi lonleystar,

when i remove my own a.ClientId + a.ClientSecret and use your a.ApiKey, it works smoothly.

Can I use the ApiKey you provided for my application? Are there any consequences/limitations?

Honestly, I don't understand quite well what the ApiKey is (or how can I get my own). Could you please write some theory around ApiKey?

Thank you.
 

alexb

Member
Licensed User
Longtime User
Hi Guiseppe, thanks for the nice library!
Please could you extend the library by one Feature? My wish is that the target of the Translation does not have to be a view (like a Label in your example) but simply a string. I would need to process the translated text further on and I was not able to retrieve the translated text from the Label (by trying for example: Dim TranslatedText As String = Lbl.text). So I am really stuck here.
I could probably do the modification of the LIB myself if you would be willing to release the source code rather than adding new code.

And another question: is it possible to set 'AutoDetect' as source language?
Thanks a lot!
alex
 
Last edited:

cimperia

Active Member
Licensed User
Longtime User
I have been developing a similar tool + library using Microsoft (Bing) Service Translator. Be aware that since 2012, the Bing API does not accept new ApiKey. Have a look at this video to find out more: Microsoft Translator Service

If you want to know how to use the service, here's a step by step tutorial.
 

lonleystar

Well-Known Member
Licensed User
Longtime User
I have been developing a similar tool + library using Microsoft (Bing) Service Translator. Be aware that since 2012, the Bing API does not accept new ApiKey. Have a look at this video to find out more: Microsoft Translator Service

If you want to know how to use the service, here's a step by step tutorial.


Hi, Sonday I fix my computer I had problems with the computer reseller.

Anyway I'm back and I'll fix all plugins.

Sorry for the inconvenience and thx for the tip.
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Giuseppe, thanks for this library
Can you add in proprierties xx.Source this parameter if empty the response will include the result of language auto-detection.
As this DOCUMENTATION.
Thank you
Marco
 

ManuelGG

Member
Licensed User
Longtime User
Hello, need a change in the lib B4ATranslator which incorporates a function that returns the translation directly and not on a VIEW, i.e.:

NewText = MyTranlator.Translate("Original Text")
 
Top