Skip to content

Releases

live_translate 1.0.0

Choose a tag to compare

@AbhiCodebugger AbhiCodebugger released this 19 Oct 07:30

The first stable release of live_translate, a drop-in Flutter widget that turns the camera into a live, offline translator. From here on, breaking changes come only in a major version.

flutter pub add live_translate

Then follow the platform setup. The attached APK is the example app, built from this tag, so you can try it on an Android phone.

Highlights

  • iOS model downloads now finish. On iPhone, the live view used to stay on "downloading" after a language's first model download. The held picture now gets translated as soon as the model arrives, without moving the camera.
  • Measured performance. On a Samsung Galaxy M17, a read takes a median of 75 ms. On an iPhone 14 it takes 35 ms. Labels appear about 0.4 s after you hold the phone still, and the view's own work costs about 1 ms per camera frame. See Performance.
  • Faster label repaint while the camera moves: about 2.6× faster on the host benchmark, with identical output.
  • A complete API reference, an FAQ and a contributing guide in the README.

Breaking changes

Most apps need no changes.

Before Now What to change
TranslatedParagraph.sourceLanguage was a String? BCP-47 code a non-null TranslateLanguage Use .bcpCode where a string was used, drop null checks, and pass sourceLanguage: when building one in tests.
TextScript was an enum a final class with constants Nothing for TextScript.latin, TextScript.devanagari, values or name. A switch expression over a TextScript needs a _ case.

LiveTranslateException and SourceStatus stay sealed. New subtypes will come only in a major version, while new scripts can come in a minor one.

Fixed

  • iOS: model downloads finish. google_mlkit_translation never reports the end of a download on iOS. So the source status stayed on "downloading", and TranslationModels.download hung or threw ModelNotDownloaded for a model that did download. On iOS, a download now completes once its model is on the device, and fails if the model hasn't arrived after 5 minutes. Android is unchanged.
  • iOS: wifiOnly is documented as having no effect, because ML Kit always downloads on any network there.

New

  • Changing LiveTranslateView.resolution restarts the camera at the new resolution.
  • LiveTranslateController.scripts and sourceLanguages report what the view reads and expects.
  • OverlayStyle.copyWith and toString.
  • The debug HUD shows the view's own work per camera frame: N fps · frame A.A ms avg, W.W max.
  • Labels repaint faster, and picking up the page's colours is about 20% faster.
  • README: Performance and Size impact sections, with the tools to measure them again.
  • README: Latin-only Android apps need -dontwarn com.google.mlkit.vision.text.devanagari.** in proguard-rules.pro, or release builds fail in R8.

Full changelog: v0.2.1...v1.0.0

live_translate 0.2.1

Choose a tag to compare

@AbhiCodebugger AbhiCodebugger released this 16 Oct 18:55

Docs only; no code changes.

  • Android setup: release builds need three ProGuard rules. Without them, flutter build apk --release fails with "Missing classes detected while running R8", because google_mlkit_text_recognition refers to the Chinese, Japanese and Korean recognizers that apps don't include. The README shows the android/app/proguard-rules.pro to add, and the example app now has it.

live_translate 0.2.0

Choose a tag to compare

@AbhiCodebugger AbhiCodebugger released this 16 Oct 18:39

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. The OverlayBuilder receives 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.
  • SourceStatus and LiveTranslateController.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 with null, without restarting the camera. The most recent change wins, whether from the controller or the widget.
  • PipelineMetrics and LiveTranslateController.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.