fidley / ABAPFavorites

ABAP Favorites Eclipse Plugin
https://abapblog.com
37 stars 6 forks source link

Quick fix for instant translation #64

Closed MDagni closed 5 years ago

MDagni commented 5 years ago

Hi Lukasz.

I have an idea for a new Quick fix option: Instant translation using Google Translate.

You know in the standard SAP programs, many of the comments are in German. For people who don't speak German, a translation option which appears after selecting the text and pressing Ctrl+1 would be wonderful. You can use Google Translate API for this purpose.

After I select the text and choose Translate from quick fixes, the resulting text could appear in a popup, just like what you get with pressing F2. If it's not possible, the internal browser of Eclipse can be used.

Also the target language could be an option. I am Turkish but I mostly prefer translation to English (as Google handles it better than Turkish), so in the preferences there can be an option to choose the target languages I want. Then these languages can appear as separate quick fix options, e.g. Translate to English, Translate to Turkish.

Do you think this is feasible?

fidley commented 5 years ago

Hi Mehmet,

Good idea. I'll check if this is possible, but probably yes 😁

I'll check after my holidays.

Cheers Łukasz

W dniu pon., 5.08.2019 o 22:12 Mehmet Dağnilak notifications@github.com napisał(a):

Hi Lukasz.

I have an idea for a new Quick fix option: Instant translation using Google Translate.

You know in the standard SAP programs, many of the comments are in German. For people who don't speak German, a translation option which appears after selecting the text and pressing Ctrl+1 would be wonderful. You can use Google Translate API for this purpose.

After I select the text and choose Translate from quick fixes, the resulting text could appear in a popup, just like what you get with pressing F2. If it's not possible, the internal browser of Eclipse can be used.

Also the target language could be an option. I am Turkish but I mostly prefer translation to English (as Google handles it better than Turkish), so in the preferences there can be an option to choose the target languages I want. Then these languages can appear as separate quick fix options, e.g. Translate to English, Translate to Turkish.

Do you think this is feasible?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fidley/ABAPFavorites/issues/64?email_source=notifications&email_token=AB4LWA6PYOWXRJKOH7QXC3DQDCCRFA5CNFSM4IJOPVF2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HDO773A, or mute the thread https://github.com/notifications/unsubscribe-auth/AB4LWAZM5K6XY3GQW4BWRM3QDCCRFANCNFSM4IJOPVFQ .

fidley commented 5 years ago

Google API needs an API Key which is valid only for certain number of calls. The other option is to use Cloud version of API but also this rather is paid. The same is for Microsoft API, but in this case there are 2 Millions of chars monthly for free. This could be a starting point and there could be a possibility to use own API key to get own limit. https://docs.microsoft.com/en-us/azure/cognitive-services/translator/quickstart-translate?pivots=programming-language-java should be the starting point in here.

fidley commented 5 years ago

done but the issue should be in https://github.com/fidley/ABAPQuickFix

MDagni commented 5 years ago

Thanks Lukasz, it works well :) Although it may require some improvement. It would be nice if it removes the * and " marks before translating. Also the quick fix dialog delays a bit because it translates before displaying I guess..

fidley commented 5 years ago

Yeah there is always place for improvement. So far the translation is done before displaying the possibility to translate, but only in case in your selection you have a comment. I will check if this is possible to switch the behavior.

BTW why do you want to get rid of " and * before translating? These are the marks that allows me to put back the comment in correct place.

MDagni commented 5 years ago

If the comment contains multiple lines, they appear in the text and break the meaning. For example in this screen (include FV45EF0E_EINTEILUNG_VORDATUM ):

image

* Bei Änderung des Gültig-ab-Datums wird geprueft, ob es * * Einteilungen gibt, die vor dem Gülig-ab-Datum liegen *

If you could remove the *'s and combine the text into one line:

Bei Änderung des Gültig-ab-Datums wird geprueft, ob es Einteilungen gibt, die vor dem Gülig-ab-Datum liegen

It makes a meaningful sentence.

fidley commented 5 years ago

image

Should be now ok for you with this Preferences settings ON

fidley commented 5 years ago

Please close the issue if this solves your problem :)

MDagni commented 5 years ago

Looks wonderful! Thank you very much. You're a good man :)