Support & Downloads

Quisque actraqum nunc no dolor sit ametaugue dolor. Lorem ipsum dolor sit amet, consyect etur adipiscing elit.

s f

Contact Info
198 West 21th Street, Suite 721
New York, NY 10010
youremail@yourdomain.com
+88 (0) 101 0000 000
Follow Us

Flutter Over the air translation updates

Over-the-air localization SDK for Flutter apps. No more unnecessary app updates.

Introduction

Localizely lets you update translations for your Flutter applications over the air. No need to release a new version to the App Store or Google Play. Localizely lets you push updates for text translations in your mobile apps instantly.

Most common use cases: correcting typos, optimizing texts, or updating translations on the fly.

 

Getting started

Step 1: Generate SDK token

Get started by creating an SDK token inside the Over the Air page for your project. You will need the token for configuring Flutter SDK later.

Step 2: Create Distribution

Create your first distribution inside the same Over the Air section for your project. You can have multiple distributions but typically you will have one distribution per project. You will need Distribution ID for configuring your Flutter SDK later.

Step 3: Create Release

To update translations inside your apps, simply create a new release within the distribution. This will export the current state of your project and make it available to the connected Flutter apps. For each release you can specify:

  • Description: Optional info about the release
  • Min version: Optional. Define the minimal semantic version of your app that should receive the update
  • Max version: Optional. Define the maximal semantic version of your app that should receive the update

By default, each release will be visible only for your app builds that initialized Localizely SDK with the prerelease flag set to true. Using such app builds only inside your team allows you to test translation changes before you publish them to your end-users.

Step 4: Include Localizely in your project

First, you need to include localizely_sdk library in your pubspec.yaml file and update flutter_intl.localizely config:

dependencies:
  localizely_sdk: ^1.1.0
  ...

flutter_intl:
  enabled: true
  localizely:
    ota_enabled: true

Note: It is required to use Flutter Intl plugin for Android StudioVS Code or intl_utils (1.5.0 or newer) in order to generate relevant localization dart code.

Step 5: Initialize SDK

For this step you will need your SDK token (generated in step 1) and the Distribution ID (created in step 2). In your main.dart file include the following code:

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:localizely_sdk/localizely_sdk.dart'; // Import sdk package
import 'generated/l10n.dart';

void main() {
  Localizely.init('<SDK_TOKEN>', '<DISTRIBUTION_ID>'); // Init sdk 
  Localizely.setPreRelease(true); // Add this only if you want to use prereleases
  Localizely.setAppVersion('<APP_VERSION>'); // Add this only if you want to explicitly set the application version, or in cases when automatic detection is not possible (e.g. Flutter web apps)

  runApp(MaterialApp(
      onGenerateTitle: (context) => S.of(context).appTitle,
      localizationsDelegates: [
        S.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: S.delegate.supportedLocales,
      home: HomePage()));
}

class HomePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  bool _isLoading = true;

  @override
  void initState() {
    super.initState();

    // Call 'updateTranslations' after localization delegates initialization
    Localizely.updateTranslations().then(
        (response) => setState(() {
              _isLoading = false;
            }),
        onError: (error) => setState(() {
              _isLoading = false;
            }));
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text(S.of(context).pageHomeTitle)),
        body: Center(
            child: _isLoading ? CircularProgressIndicator() : Column(children: <Widget>[Text(S.of(context).welcome)])));
  }
}
Note: Ensure you have added INTERNET permission for Android devices.

Usage

String keys usage in code

There is no need to update your code, refer to the keys as usual:

S.of(context).title
Changing locale

There is no need to update your code, change locale as usual:

setState(() {
  S.load(Locale('en', 'US'));
});