An open API service indexing awesome lists of open source software.

https://github.com/rootsoft/localazy_sdk

A Flutter OTA implementation for Localazy
https://github.com/rootsoft/localazy_sdk

Last synced: over 1 year ago
JSON representation

A Flutter OTA implementation for Localazy

Awesome Lists containing this project

README

          

# Localazy SDK

[![pub package](https://img.shields.io/pub/v/localazy_sdk.svg)](https://pub.dev/packages/localazy_sdk)

This package provides [Over-the-Air translation updates](#over-the-air-translation-updates) from the Localazy platform on top of the Intl package.

## Platform Support

| Android | iOS | Web | MacOS | Linux | Windows |
| :-----: | :-: | :-: | :---: | :---: | :-----: |
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |

## Over-the-Air translation updates

Update translations for your Flutter applications over the air. [Learn more](https://localazy.com/tags/ota)

Works with projects that use Flutter Intl IDE plugin / `intl_utils`.

### Setup for Flutter Intl

1\. Update `pubspec.yaml` file


dependencies:
...
localazy_sdk: ^1.0.0

2\. Trigger localization files generation by Flutter Intl IDE plugin or by [intl_utils](https://pub.dev/packages/intl_utils) library

3\. Initialize Localazy SDK


import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:localazy_sdk/localazy_sdk.dart';
import 'generated/l10n.dart';

void main() {
Localazy.init(
'cdn id',
fileName: 'intl.arb',
cacheFolder: path.join((await getTemporaryDirectory()).path, 'translations'),
);
Localazy.setAppVersion('1.0.0');

runApp(
LocalazyApp(
router: router,
),
);
}

class LocalazyApp extends StatelessWidget {
final GoRouter router;

const LocalazyApp({
required this.router,
Key? key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerConfig: router,
title: Env.appName,
theme: appTheme(),
debugShowCheckedModeBanner: false,
builder: (context, child) {
return LocalazyBuilder(
defaultLocale: Locale(Intl.getCurrentLocale()),
supportedLocales: S.delegate.supportedLocales,
builder: (context) => child ?? const SizedBox.shrink(),
);
},
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
);
}
}