auto_localization 0.1.12

  • Readme
  • Changelog
  • Example
  • Installing
  • 79

auto_localization #

Flutter package to dynamically translate your app.

This plugin will AUTOMATICALLY detect the app Localization and translate the text.


So the point was to find a way to convincely translate text in all the languages. To do that we create this system who seam to works really well.

There is even a cache system to make it faster.

Normally our translation is composed by three part text | The text to translate

language | The end language of the text (if null will be taken the default of the device)

target | The argument of the translation (We added this because in certain circumstances translation were not accurate, i.e.

translateText("Bailey's irish cream", language: "it", alwaysTranslate: true) //--> Result in "La crema irlandese di Bailey" which is wrong
translateText("Bailey's irish cream", language: "it", target: "cocktail", alwaysTranslate: true) //--> Result in "Bailey's irish cream" which is correct



Set base language into your main to not translate the text when the language is the same to which you write your app:


When you create an element you can set alwaysTranslate = TRUE and it will be translated event if the app language and device language matches, it's used to translate dynamic text, like something written by a user.

translateText("Bailey's irish cream", language: "it", target: "cocktail", alwaysTranslate: true)

Wrap your Text widget with this:

TextLocal(Text("Plugin example app"))
AutoSizeTextLocal(AutoSizeTextLocal("Plugin example app"))

If you need to create your own Translated widget you could act like this

class TextLocal extends StatefulWidget {
  final Text text;
  final String target;
  final String lang;
  final bool alwaysTranslate;

  TextLocal(this.text,{this.lang,, this.alwaysTranslate=false});

  _TextLocalState createState() => _TextLocalState();

class _TextLocalState extends State<TextLocal> {

  String trans;

  void initState() {

  String cachedString="";
  translate() async {;
    trans=await translateText(, language: widget.lang, target:, alwaysTranslate: widget.alwaysTranslate);
      setState(() {

  Widget build(BuildContext context) {
    return Text(
      strutStyle: widget.text.strutStyle,
      softWrap: widget.text.softWrap,
      semanticsLabel: widget.text.semanticsLabel,
      textScaleFactor: widget.text.textScaleFactor,
      maxLines: widget.text.maxLines,
      textWidthBasis: widget.text.textWidthBasis,
      textDirection: widget.text.textDirection,
      overflow: widget.text.overflow,
      locale: widget.text.locale,
      textAlign: widget.text.textAlign,
      key: widget.text.key,


Convert your String with this (Need to be async):

String x= await translateText("hello");

0.1.12 #

  • Created a system to TARGET the translation
  • Optimized SQL query
  • Added base language
  • Fixed bug who stuck the text
  • Support for AutoSizeText


auto_localization_example #

Demonstrates how to use the auto_localization plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

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

  auto_localization: ^0.1.12

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support 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:auto_localization/auto_localization.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/auto_localization.dart.

Run flutter format to format lib/auto_localization.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
auto_size_text ^2.1.0 2.1.0
flutter 0.0.0
sqflite ^1.1.6 1.1.7+1
synchronized ^2.1.0+1 2.1.0+1
translator ^0.1.2 0.1.2
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.11 1.14.12
http 0.12.0+2
http_parser 3.1.3
meta 1.1.7
path 1.6.4
pedantic 1.8.0+1
sky_engine 0.0.99
source_span 1.5.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies