akhilkedia / AllTrans

Completely Translate Android apps in-place aka Google translate in Chrome
Other
389 stars 32 forks source link

[Not issue, but question] Possibility to export strings that were translated? #3

Closed james-s-w-clark closed 6 years ago

james-s-w-clark commented 6 years ago

This could be very exciting to combine with the Hanzi2Anki project: https://github.com/danielt998/HanziToAnki. Essentially, generating flashcards for studying Chinese from the vocab inside an app.

I got the impression that with AllTrans, strings were translated only when a new activity/screen in an app was loaded (and not in advance) - would this allow detected strings to be grouped (by activity name)?

Going one step further, would it be possible to do the same for the Android system? E. G. Grab the strings for the 1) settings menu, 2) quick access tiles (flashlight, wifi), etc.

I guess Android has to load these strings from a file though, and is open source - thus it should be possible to get all of these. Regardless, grouping words by activity/screen and exporting them would be fantastic.

akhilkedia commented 6 years ago

You are correct, AllTrans translates strings when the are "set" in a TextView (by calling TextView.SetText), and so yes, strings can be grouped by activity.

Exporting these strings (grouped by activity) would also be super easy - If debug mode is enabled, AllTrans does print the string to the logcat (Along with other information). You can make minor changes in code to write strings to a file instead. Let me know if you need pointers as to where exactly you need to make these changes.

Regarding settings and quick tiles, my guess is Android will load those strings from a Strings.xml file for the settings app/system UI/Framework. You should be able to find this file in AOSP.