intl_utils 1.2.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 86

Intl Utils #

Dart package that creates a binding between your translations from .arb files and your Flutter app. It generates boilerplate code for official Dart Intl library and adds auto-complete for keys in Dart code.

Usage #

You can use this package directly (i.e. for Continuous Integration tools or via CLI) or leave it to Visual Studio Code or IntelliJ/Android Studio plugins to run it automatically whenever you modify ARB files.

Follow these steps to get started:

Configure package #

Add package configuration to your pubspec.yaml file. Here is a full configuration for the package:

  enabled: true # Required. Must be set to true to activate the package. Default: false
  class_name: S # Optional. Sets the name for the generated localization class. Default: S
  main_locale: en # Optional. Sets the main locale used for generating localization files. Provided value should consist of language code and optional script and country codes separated with underscore (e.g. 'en', 'en_GB', 'zh_Hans', 'zh_Hans_CN'). Default: en

Add ARB files #

Add one ARB file for each locale you need to support in your Flutter app. Add them to lib/l10n folder inside your project, and name them in a following way: intl_<LOCALE_ISO_CODE>.arb. For example: intl_en.arb or intl_en_GB.arb.

If you wonder how to format key-values content inside ARB files, here is detailed explanation.

Run command #

To generate boilerplate code for localization, run the generate program inside directory where you pubspec.yaml file is located:

  pub run intl_utils:generate

This will produce files inside lib/generated directory.

Change Log #

All notable changes to the "flutter-intl" extension will be documented in this file.

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

1.2.1 - 2020-03-30 #

  • Update order of supported locales

  • Replace dynamic with concrete type for generated Dart methods

  • Handle empty plural and gender forms

  • Update l10n.dart file template (remove localeName)

1.2.0 - 2020-03-16 #

  • Add support for locales with script code

  • Fix locale loading issue when country code is not provided

1.1.0 - 2020-02-04 #

  • Make main locale configurable

1.0.2 - 2020-01-21 #

  • Add curly-braces around placeholders when they are followed by alphanumeric or underscore character

1.0.1 - 2020-01-15 #

  • Fix trailing comma issue (l10n.dart)

  • Remove unused dependencies

1.0.0 - 2020-01-12 #

  • Initial release


Please see Usage.

Use this package as a library

1. Depend on it

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

  intl_utils: ^1.2.1

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:intl_utils/intl_utils.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 Apr 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

13 out of 13 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/src/generator.dart.

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

Format lib/src/intl_translation_helper.dart.

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

Format lib/src/label.dart.

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

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/parser.dart (Run dartfmt to format lib/src/parser.dart.)
  • lib/src/templates.dart (Run dartfmt to format lib/src/templates.dart.)
  • lib/src/utils.dart (Run dartfmt to format lib/src/utils.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (petitparser).

Homepage URL isn't helpful. (-10 points)

Update the homepage field from pubspec.yaml: link to a website about the package or use the source repository URL.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
intl_translation 0.17.9 0.17.9
path ^1.6.4 1.6.4
petitparser >=1.1.3 <3.0.0 2.4.0 3.0.2
yaml ^2.2.0 2.2.0
Transitive dependencies
_fe_analyzer_shared 2.0.0
analyzer 0.39.5
args 1.6.0
async 2.4.1
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
dart_style 1.3.3
glob 1.2.0
html 0.14.0+3
intl 0.16.1
js 0.6.1+1
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.3
pub_semver 1.4.4
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+14
Dev dependencies
pedantic ^1.9.0 1.9.0
test ^1.9.4