Share My Creation MLKIT TRANSLATION - the final frontier

2.png
gxlate1.png
 

drgottjr

Expert
Licensed User
Longtime User
here's a working version (at least on my pixel3 (12) and pixel6 (14) b4a 13 beta 02:

SEE POST BELOW FOR LATEST VERSION

it's on the big side. i think it's because it comes with a default english language model. all the modules are about 30mb. they're stored in the app's internal storage, not in the apk, but my guess is the english module is in apk. the app downloads languages as needed. if you delete the app and reinstall, you lose whatever languages you've downloaded. i'm trying to harden it, but i've only looked for common mistakes (like not chosing a language or not actually trying to translate anything). i'll leave it up for a while in case there's any interest.

UPDATE: i had to adjust the sharing settings on google drive. apologies to any forum members who may have tried and were turned away.
 
Last edited:

drgottjr

Expert
Licensed User
Longtime User
so, here's a fairly useful version for download. adds, deletes, lists available languages. lets you copy the translation to the clipboard.

ADDED: 01 SEP, 2024 - latest version checks to make sure you're online before trying to add languages.


technical stuff TL;NR:
there is a known issue with mlkit relating to the way in which it downloads various modules
(text recognition and translation and possibly others). it uses the Tasks api, which is different
from its own (now deprecated) asynctask api. for whatever reason, the Tasks api runs
asynchronously on the main thread. long story short, there is no way to stop one of these Tasks
if it hangs. in other words, if you're downloading a language model and there's a problem, you
hang. and even though you might expect an ANR exception (because the Task is running on the main
thread), there is none. and there is no method available in the Tasks api to cause the Task to
quit. since the translation language models are 30MB's, network issues during download are possible.
 

Attachments

  • 1.png
    1.png
    19.5 KB · Views: 36
Last edited:
Top