localizely_sdk 1.2.0

  • Readme
  • Changelog
  • Installing
  • new68

Localizely SDK #

SDK setup #

  1. Update pubspec.yaml file:
dependencies:
  ...
  localizely_sdk: ^1.2.0

flutter_intl:
  ...
  localizely:
    ota_enabled: true # Required for Over-the-air translation updates
  1. Trigger localization files generation by Flutter Intl IDE plugin or by intl_utils library

  2. Initialize Localizely SDK (e.g. main.dart file):

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();

    Localizely.updateTranslations().then( // Call 'updateTranslations' after localization delegates initialization
        (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)])));
  }
}

Change Log #

All notable changes to the "localizely_sdk" will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.2.0 - 2020-05-26 #

  • Add support for Flutter web

1.1.0 - 2020-05-11 #

  • Improve API communication

1.0.0 - 2020-05-11 #

  • Initial release

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  localizely_sdk: ^1.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:localizely_sdk/localizely_sdk.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on May 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev

Health suggestions

Format lib/src/api/api.dart.

Run dartfmt to format lib/src/api/api.dart.

Format lib/src/model/bundle_data.dart.

Run dartfmt to format lib/src/model/bundle_data.dart.

Format lib/src/model/label.dart.

Run dartfmt to format lib/src/model/label.dart.

Fix additional 9 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/parser/parser.dart (Run dartfmt to format lib/src/parser/parser.dart.)
  • lib/src/platform/platform.dart (Run dartfmt to format lib/src/platform/platform.dart.)
  • lib/src/platform/platform_stub.dart (Run dartfmt to format lib/src/platform/platform_stub.dart.)
  • lib/src/proxy/proxy.dart (Run dartfmt to format lib/src/proxy/proxy.dart.)
  • lib/src/sdk.dart (Run dartfmt to format lib/src/sdk.dart.)
  • lib/src/sdk_data.dart (Run dartfmt to format lib/src/sdk_data.dart.)
  • lib/src/service/labels_service.dart (Run dartfmt to format lib/src/service/labels_service.dart.)
  • lib/src/store/store.dart (Run dartfmt to format lib/src/store/store.dart.)
  • lib/src/util/util.dart (Run dartfmt to format lib/src/util/util.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (logger, petitparser).

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and localizely_sdk.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
http ^0.12.0 0.12.1
intl ^0.16.0 0.16.1
logger ^0.8.0 0.8.3 0.9.1
package_info ^0.4.0 0.4.0+18
petitparser >=1.1.3 <3.0.0 2.4.0 3.0.4
shared_preferences ^0.5.6 0.5.7+3
uuid ^2.0.4 2.0.4
Transitive dependencies
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.5
flutter 0.0.0
flutter_web_plugins 0.0.0
http_parser 3.1.4
io 0.3.4
meta 1.1.8
path 1.7.0
shared_preferences_macos 0.0.1+9
shared_preferences_platform_interface 1.0.4
shared_preferences_web 0.1.2+7
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
pedantic ^1.8.0 1.9.0
test ^1.9.4