Localizely logo
  • Home
  • Getting started
  • How it works
  • Pricing
  • FAQ
Sign up

Flutter In-Context Editing

Instantly see how your translations fit on a real device while you type

Documentation

On a phone screen, a translation that is a few characters too long can overflow, wrap awkwardly, or push a layout out of shape. Finding those problems by rebuilding the app after every change is slow. In-Context Editing removes that loop for Flutter apps: you type a translation in Localizely and see it rendered on your device or in a browser as you type.

Seeing each string where it actually appears also gives translators the context they need to choose the right wording, so quality improves alongside layout.

In-Context Editing complements your translation workflow rather than replacing it. It is meant for development and testing: the changes you make this way are visible only while the app is connected to Localizely. To ship them, you still upload, translate, and download as usual.

Integration

Most Flutter apps are localized with the intl package and a tool that generates the localization code. The sections below show how to add In-Context Editing to such a project. Pick the tab that matches your setup.

The gen_l10n tool is the standard way of localizing Flutter applications. It ships with the Flutter SDK and generates the localization code as part of the build. This guide assumes your app is already localized with it. If not, start with our guide to setting up localization with the gen_l10n tool, then come back here to enable In-Context Editing.

A complete sample app with In-Context Editing is available on GitHub.

Step 1: Add the Localizely SDK

Add the localizely_sdk dependency to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  intl: any
  localizely_sdk: ^2.7.7

Save the file and fetch the package:

flutter pub get

Step 2: Generate the localization file

Recent Flutter versions no longer generate localization code as a synthetic package, so make sure your l10n.yaml file writes the generated code into your lib directory. The sample app uses the following configuration:

arb-dir: lib/l10n
template-arb-file: intl_en.arb
output-localization-file: app_localizations.dart
output-dir: lib/l10n/generated

Then generate the localization file the SDK needs:

dart run localizely_sdk:generate

Note: In Flutter 3.22.0, running the command dart run localizely_sdk:generate may produce false analyzer errors. This issue has been resolved in Flutter 3.22.1. If you need to use 3.22.0 and encounter these errors, running flutter pub get again should fix the problem.

To regenerate the code automatically whenever your .arb files change, add build_runner to your dev_dependencies and run it in watch mode:

flutter pub add build_runner -d
dart run build_runner watch

Once the localization file is generated, point the localizationsDelegates and supportedLocales properties of your MaterialApp widget at it.

...
import 'l10n/generated/localizely_localizations.dart';

class MyApp extends StatelessWidget {
  ...

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      ...
      localizationsDelegates: LocalizelyLocalizations.localizationsDelegates,
      supportedLocales: LocalizelyLocalizations.supportedLocales,
      ...
    );
  }
}

Step 3: Wrap the root of the app

Wrap the root of your app in the LocalizelyInContextEditing widget in main.dart:

...
import 'package:localizely_sdk/localizely_sdk.dart';

void main() {
  runApp(
    LocalizelyInContextEditing(
      enabled: true, // set to false to disable In-Context Editing for production app builds
      child: MyApp(),
    ),
  );
}

...

Step 4: Connect your app with Localizely

Run your app. On launch it opens a connection screen that asks for a token from Localizely.

To get the token, open the Translations page of your project in Localizely and click the button. The dialog that opens shows everything you need, including the token.

Flutter In-Context Editing open dialog

Enter the token in the app to connect.

Flutter In-Context Editing authenticate by entering token

A confirmation message tells you the app is now connected to Localizely.

Note: The localizely_sdk >=2.4.0 <2.5.0 requires an update of min platform versions:
- Android: Required Android SDK 21 or newer (update minSdkVersion to 21 in the android/app/build.gradle file).
- iOS: Required iOS 11 or newer and an update of the Info.plist file with the NSCameraUsageDescription.
As of version 2.5.0, these updates are no longer required due to changes in implementation.

Note: The localizely_sdk >=2.4.0 <2.5.0 uses the QR code scanner on mobile apps to connect. This way of connecting is abandoned. In case you are prompted to scan the QR code, please update the localizely_sdk to the latest available version.

Step 5: Translate

Start translating in Localizely. Each change appears on the connected device as you type, so you can see immediately whether the text fits.

Flutter In-Context Editing demo

Tired of manually editing translation files?

Our platform streamlines software localization for you.

Try now for Free
Localizely logo
About
Free tools
Boring stuff
  • Privacy Policy
  • Terms of Service
  • Cookie Policy
Newsletter
Copyrights 2026 © Localizely