flutter_translate 1.5.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 93

Build Status pub package Awesome Flutter License: MIT Flutter.io


Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.

It lets you define translations for your content in different languages and switch between them easily.

Example #

Features #

  • Very easy to use
  • Pluralization support
  • Static keys support with flutter_translate_gen
  • Supports both languageCode (en) and languageCode_countryCode (en_US) locale formats
  • Automatically save & restore the selected locale with a simple implementation
  • Full support for right-to-left locales
  • Fallback locale support in case the system locale is unsupported
  • Supports both inline or nested JSON

Documentation #

Complete documentation is available on the wiki page.

To get started please see Installation, Configuration & Usage.

Examples #

Issues #

Please file any issues, bugs or feature request here.

License #

This project is licensed under the MIT License

Author #

This Flutter package is developed by Florin Bratan. You can contact me at florin@leadcode.dev

[1.0.0]

  • Initial release.

[1.0.1]

  • Removed the flutter_localizations dependency.

[1.0.2]

  • Simplified the localization initialization.

[1.1.0]

  • Implemented a global translate method.
  • Removed the static Translate class.
  • Localization is now a singleton.

[1.2.0]

  • Implemented pluralization.
  • Fixed multiple issues.
  • translate, translatePlural and changeLanguage methods are now global.

[1.2.2]

  • Missing localizations now return the full key path.

[1.2.5]

  • Fixed possible exception when adding an extra slash to the basePath

[1.3.0]

  • Implemented the onLocaleChanged callback

[1.3.1]

  • Implemented the localeToString method

[1.3.2]

  • Fixed some callback issues for onLocaleChanged

[1.4.0]

  • Implemented support for automatically saving & restoring the selected locale using shared preferences

[1.4.0+1]

  • Added the Awesome Flutter badge

[1.4.0+2]

[1.5.0]

  • Fixed the blackscreen issue on startup
  • Fixed the iOS issue regarding the device locale
  • The current device locale is now used on startup

[1.5.1]

  • Updated the flutter_device_locale dependency to avoid a possible exception
  • Updated the example to AndroidX

[1.5.2]

  • Updated the flutter_device_locale version

[1.5.3]

  • Renamed packages, updated license and links

[1.5.7]

  • Updated the examples
  • Fixed some issues with flutter_device_locale and swift

example/README.md

example #

Example project for the flutter_translate library

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_translate: ^1.5.7

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:flutter_translate/flutter_translate.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
87
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
93
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.2

Health suggestions

Fix lib/localization_provider.dart. (-0.50 points)

Analysis of lib/localization_provider.dart reported 1 hint:

line 12 col 70: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Fix lib/localized_app.dart. (-0.50 points)

Analysis of lib/localized_app.dart reported 1 hint:

line 15 col 61: 'ancestorWidgetOfExactType' is deprecated and shouldn't be used. Use findAncestorWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Format lib/configuration_validator.dart.

Run flutter format to format lib/configuration_validator.dart.

Fix additional 9 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/constants.dart (Run flutter format to format lib/constants.dart.)
  • lib/global.dart (Run flutter format to format lib/global.dart.)
  • lib/locale_file_service.dart (Run flutter format to format lib/locale_file_service.dart.)
  • lib/locale_service.dart (Run flutter format to format lib/locale_service.dart.)
  • lib/localization.dart (Run flutter format to format lib/localization.dart.)
  • lib/localization_configuration.dart (Run flutter format to format lib/localization_configuration.dart.)
  • lib/localization_delegate.dart (Run flutter format to format lib/localization_delegate.dart.)
  • lib/localized_app_state.dart (Run flutter format to format lib/localized_app_state.dart.)
  • lib/translate_preferences.dart (Run flutter format to format lib/translate_preferences.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
flutter_device_locale ^0.3.4+1 0.3.4+1
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8