AndroidLocalizationer supports Baidu translation

Original URL: https://blog.csdn.net/wjskeepmaking/article/details/78817915

foreword

Dear friends, if you want to support multiple languages ​​in Android projects, most of them will use an internationalization plug-in AndroidLocalizationer, which provides Microsoft and Google translations, but recently, I found that this plug-in always reported a null pointer exception. Several articles say that you need to apply for an ID, but Google Translation ID is charged, and Microsoft Translation ID doesn't know how to apply for it (anyway, I haven't gotten it for a long time, so I don't want to waste time to explore). 
Since AndroidLocalizationer is open source, I tried to see if I could add Baidu translation in it. After some experiments, I finally got it. Now I will share this result with you (Baidu translation may not be very good, so I can only use it)

Download and install the plugin

  • click to download
  • Find Plugins in Settings, click Install plugin form disk…

    write picture description here

    Select the AndroidLocalization.jar you just downloaded, click ok, and restart Android Studio.

Apply for Baidu Translate APP ID

Enter the  official website of Baidu Translation Development Platform, apply for an account if you do not have an account, and then click on Product Services – General Translation API, as shown below

write picture description here

You will see some introductions about the general translation API, including the billing standard (currently no more than 2 million characters per month are free, which is completely enough for personal use) 
. After filling in the basic personal information when applying, you must also fill in the general Translate API service information, such as:

project content
website or app Fill in the app name
Related URLs www.baidu.com (fill in whatever you want)
Website or app introduction  
server address No need to fill in

The above content can be modified later. In fact, these are not the key. The key is to apply for the APPID and the secret key 
. After the application is completed, you can find the APPID and secret key in the developer information column of the management console.

Fill in APPID and secret key

After restarting Android Studio, AndroidLocalization will be found in Other Settings in Settings:

write picture description here

Baidu Translate is selected by default, and you can use it after filling in APPID and SecretKey respectively.

write picture description here

Baidu Translate supports a lot less languages ​​than Google's, but it is basically enough, as follows:

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325647672&siteId=291194637