flutter_csv_localization 0.3.1

  • Readme
  • Changelog
  • Installing
  • 79

Flutter localizations generator from CSV files. #

Generates a localizations delegate from a CSV file.

Usage #

Install globally the tool :

$ pub global activate flutter_csv_localization


Then run the generator :

$ pub global run flutter_csv_localization:generate -o example.g.dart example.csv

Google Sheet #

Make sure that your sheet is shared :


Extract from the link the DOCID and SHEETID values : https://docs.google.com/spreadsheets/d/<DOCID>/edit#gid=<SHEETID>) :

Run the command :

$ pub global run flutter_csv_localization:generate -g -o example.g.dart <DOCID>/<SHEETID>

Example #

.csv -> .dart

CSV format #

The csv file should have :

  • Row
    • Column 0 : "Key"
    • then each supported language code ("en", "fr", ...)
  • Following rows for labels
    • Column 0 : the label key (can be a hierarchy, separated by dots)
    • then each translation based on language code of the column



Roadmap / Ideas #

  • [ ] Multiple values per label (plural, gender, ...)
  • [ ] Native labels (plist, xml, ...)

Why ? #

I find the Flutter internationalization tools not really easy to use, and I wanted a simple tool for sharing translations.

1.0.0 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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

  flutter_csv_localization: ^0.3.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:flutter_csv_localization/flutter_csv_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 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21


Detected platforms: Flutter, other

Primary library: package:flutter_csv_localization/flutter_csv_localization.dart with components: io.

Health issues and suggestions

Document public APIs. (-1 points)

30 out of 30 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.

Fix bin/generate.dart. (-0.50 points)

Analysis of bin/generate.dart reported 1 hint:

line 30 col 5: DO use curly braces for all flow control structures.

Fix lib/src/localizations.dart. (-0.50 points)

Analysis of lib/src/localizations.dart reported 1 hint:

line 39 col 9: Use isNotEmpty instead of length

Fix lib/src/parser.dart. (-0.50 points)

Analysis of lib/src/parser.dart reported 1 hint:

line 35 col 13: Use isNotEmpty instead of length

Format lib/src/builder.dart.

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

Maintenance suggestions

The package description is too short. (-13 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

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

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
args ^1.5.1 1.5.2
code_builder ^3.2.0 3.2.0
csv ^4.0.3 4.0.3
dart_style ^1.2.7 1.3.1
http ^0.12.0 0.12.0+2
meta ^1.1.7 1.1.7
recase ^2.0.1 2.0.1
Transitive dependencies
analyzer 0.38.5
async 2.4.0
built_collection 4.2.2
built_value 6.7.1
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.3
csslib 0.16.1
fixnum 0.10.9
front_end 0.1.27
glob 1.2.0
html 0.14.0+3
http_parser 3.1.3
js 0.6.1+1
kernel 0.3.27
matcher 0.12.5
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
path 1.6.4
pedantic 1.8.0+1
pub_semver 1.4.2
quiver 2.0.5
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+12
yaml 2.2.0