flutter_csv_localization 0.1.2

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new46

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

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

example

Key,fr,en
dates.weekday.monday,lundi,monday
dates.weekday.tuesday,mardi,tuesday
dates.weekday.wednesday,mercredi,wednesday
dates.weekday.thursday,jeudi,thursday
dates.weekday.friday,vendredi,friday
dates.weekday.saturday,samedi,saturday
dates.weekday.sunday,dimanche,sunday

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:


dependencies:
  flutter_csv_localization: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
0.1.2 Apr 15, 2019 Go to the documentation of flutter_csv_localization 0.1.2 Download flutter_csv_localization 0.1.2 archive
0.1.1 Apr 9, 2019 Go to the documentation of flutter_csv_localization 0.1.1 Download flutter_csv_localization 0.1.1 archive
0.1.0 Apr 9, 2019 Go to the documentation of flutter_csv_localization 0.1.0 Download flutter_csv_localization 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
87
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

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)

29 out of 29 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. (-1.49 points)

Analysis of bin/generate.dart reported 3 hints:

line 1 col 8: Unused import: 'dart:convert'.

line 13 col 7: Use isNotEmpty instead of length

line 19 col 1: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

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

Analysis of lib/src/parser.dart reported 3 hints:

line 8 col 3: The class 'Future' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 8 col 31: The class 'Stream' was not exported from 'dart:core' until version 2.1, but this code is required to be able to run on earlier versions.

line 23 col 14: Use isNotEmpty instead of length

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

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
args ^1.5.1 1.5.1
code_builder ^3.2.0 3.2.0
csv ^4.0.3 4.0.3
dart_style ^1.2.7 1.2.7
meta ^1.1.7 1.1.7
recase ^2.0.1 2.0.1
Transitive dependencies
analyzer 0.36.0
async 2.2.0
built_collection 4.2.0
built_value 6.4.0
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
fixnum 0.10.9
front_end 0.1.15
glob 1.1.7
kernel 0.3.15
matcher 0.12.5
package_config 1.0.5
path 1.6.2
pub_semver 1.4.2
quiver 2.0.3
source_span 1.5.5
stack_trace 1.9.3
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+10
yaml 2.1.15