Repository navigation
live_translate 0.2.0
Breaking: two names from 0.1.0 are renamed before 1.0 to say what they hold. Each item is a paragraph of text, not a single line:
| 0.1.0 | 0.2.0 |
|---|---|
TranslatedLine |
TranslatedParagraph |
LiveTranslateController.lines |
LiveTranslateController.paragraphs |
The fields of TranslatedParagraph are unchanged.
Breaking: OverlayStyle.maxFontSize (default 28) now caps a label's starting size. Large headings that used to get labels as big as the heading now stop at 28; raise maxFontSize to get them back.
New:
LiveTranslateView.overlayBuilder: draw the translations yourself. TheOverlayBuilderreceives the shown paragraphs, in the view's coordinates, and replaces the built-in labels.LiveTranslateView.onParagraphsChanged: called whenever the shown paragraphs change, with or without a controller.LiveTranslateView.onFrozen: called with the frozen picture's paragraphs once its translation is shown, and again if it is read again.LiveTranslateView.placeholderBuilder: shown while the camera starts, in place of the progress indicator.SourceStatusandLiveTranslateController.sourceStatus: where finding the source language stands (searching, guessed, downloading, ready, unsupported, not found or download failed), to show progress before the first translation.LiveTranslateController.setSourceLanguages: change the expected source languages, or go back to detection withnull, without restarting the camera. The most recent change wins, whether from the controller or the widget.PipelineMetricsandLiveTranslateController.metrics: how long each shown read took (recognition, translation, colour sampling and total), how many paragraphs it translated, and whether it was frozen.LiveTranslateView.showDebugHud: a small panel over the camera with the latest read's timings and the frame rate, for development.
Improved:
- Faster first translation: a steady picture whose language isn't settled is read again every second, so short text confirms its language without moving the phone. After three reads that find no language, the status says so.
- Paragraph ids now stay the same while the view keeps reading a paragraph in the same place: re-reads while the language settles, after a download or a target change, after a small pan, and on freeze. A new scene gets new ids, so an id can key a widget.
- Languages that can't be translated, such as lorem ipsum identified as Latin, no longer outvote a translatable language in the same script.
- A Devanagari paragraph identified only as a language ML Kit can't translate, such as a Hindi sign taken for Nepali, is now translated from Hindi or Marathi instead of being left untranslated. Before, a short Hindi sign could show nothing at all.
- The example app adds model management, a sheet to copy the read text, the source status on its language chip, and replay tests that run saved photos through the real pipeline on a device.
Known issue (Android release builds): R8 fails with "Missing classes detected while running R8" for the Chinese, Japanese and Korean recognizers. Add these lines to android/app/proguard-rules.pro in your app:
-dontwarn com.google.mlkit.vision.text.chinese.**
-dontwarn com.google.mlkit.vision.text.japanese.**
-dontwarn com.google.mlkit.vision.text.korean.**
Attached: live_translate-example-0.2.0.apk, the example app as a release build. It is signed with debug keys, so install it by sideloading.