gsheet_to_arb 0.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 42

GSheet to ARB #

pub package

Imports Application Resource Bundle (ARB) from Google Sheets

https://github.com/googlei18n/app-resource-bundle/wiki/ApplicationResourceBundleSpecification

Usage #

Import ARB files from the Google Sheet #

  1. Setup plugin configuration

  2. To import ARB files from Google Sheet run the gsheet_to_arb:import program.

     pub run gsheet_to_arb:import --config gsheet_to_arb.yaml
    
  3. Optionally generate Dart classes from the ARB files using gsheet_to_arb:arb_to_dart program.

     pub run gsheet_to_arb:arb_to_dart --config gsheet_to_arb.yaml
    

Setup #

1. Copy Google Sheet template #

  1. Open sample Google spreadsheet template available at:

  2. Copy sample to your Drive account

    • File -> Make a copy
  3. Save DOCUMENT_ID of the Google spreadsheet

2. Authenticate #

Create Google Sheets API credentials either by using Client or Server authentication.

3. Configure your Dart project #

  1. Add gsheet_to_arb dev dependency to the pubspec.yaml

     dev_dependencies:
       gsheet_to_arb: ^0.0.6
    
  2. Updated dependencies pub update

  3. Create plugin configuration

     pub run gsheet_to_arb:import --create-config gsheet_to_arb.yaml
    
  4. Update plugin configuration gsheet_to_arb.yaml e.g.

     gsheet_to_arb:
       arb_file_prefix: 'intl'
       output_directory: 'lib/src/i18n'
       gsheet:
         document_id: '<DOCUMENT_ID>'
         sheet_id: '0'
         auth:
           service_account_key_path: "~/.ssh/gsheet-to-arb-server-config.json"
    

TODO #

  • Support ARB plurals

0.0.6 #

  • Category prefix configuration

0.0.5 #

  • Support placeholders in ARB resources

0.0.4 #

  • Server-side (private key) authentication

0.0.3 #

  • Generate dart class from arb file

0.0.2 #

  • Import ARB from Google Sheets

0.0.1 #

  • Initial version

example/README.md

Scripts #

Import from Google Sheets:

pub run gsheet_to_arb:import --config gsheet_to_arb.yaml

Generate Messages

pub run gsheet_to_arb:arb_to_dart --config gsheet_to_arb.yaml

Use this package as a library

1. Depend on it

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


dependencies:
  gsheet_to_arb: ^0.0.6

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:gsheet_to_arb/gsheet_to_arb.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
16
Health:
Code health derived from static analysis. [more]
91
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
36
Overall:
Weighted score of the above. [more]
42
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.12.21

Health suggestions

Fix lib/src/arb/intl_translation_helper.dart. (-4.41 points)

Analysis of lib/src/arb/intl_translation_helper.dart reported 9 hints, including:

line 19 col 22: Unnecessary new keyword.

line 20 col 22: Unnecessary new keyword.

line 37 col 54: Unnecessary new keyword.

line 39 col 16: Unnecessary new keyword.

line 45 col 18: Unnecessary new keyword.

Fix bin/arb_to_dart.dart. (-1 points)

Analysis of bin/arb_to_dart.dart reported 2 hints:

line 15 col 16: Unnecessary new keyword.

line 26 col 7: Use isEmpty instead of length

Fix bin/import.dart. (-1 points)

Analysis of bin/import.dart reported 2 hints:

line 16 col 16: Unnecessary new keyword.

line 25 col 7: Use isEmpty instead of length

Fix additional 7 files with analysis or formatting issues. (-2.50 points)

Additional issues in the following files:

  • lib/src/arb/arb_serializer.dart (2 hints)
  • lib/src/arb/arb_generator.dart (1 hint)
  • lib/src/sheet/sheet_parser.dart (1 hint)
  • lib/src/utils/log.dart (1 hint)
  • lib/src/arb_to_class_generator.dart (Run dartfmt to format lib/src/arb_to_class_generator.dart.)
  • lib/src/config/plugin_config.dart (Run dartfmt to format lib/src/config/plugin_config.dart.)
  • lib/src/config/plugin_config_helper.dart (Run dartfmt to format lib/src/config/plugin_config_helper.dart.)

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

exitCode: -15 stdout: Exceeded timeout of 0:10:00.000000 parsing /tmp/pub-dartlang-dartdocMNEHYT/pkg/lib/gsheet_to_arb.dart... parsing /dart-sdk/lib/core/core.dart... parsing /dart-sdk/lib/collection/collection.dart... parsing /dart-sdk/lib/internal/internal.dart... parsing /dart-sdk/lib/async/async.dart... parsing /dart-sdk/lib/convert/convert.dart... parsing /dart-sdk/lib/typed_data/typed_data.dart... parsing /dart-sdk/lib/math/math.dart... parsing /tmp/pub-dartlang-dartdocMNEHYT/pkg/lib/src/sheet/sheet_parser.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/googleapis-0.52.0+1/lib/sheets/v4.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/_discoveryapis_commons-0.1.9/lib/_discoveryapis_commons.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/_discoveryapis_commons-0.1.9/lib/src/clients.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/http-0.12.0+2/lib/http.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/http-0.12.0+2/lib/src/client.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/http-0.12.0+2/lib/src/base_client.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/http-0.12.0+2/lib/src/base_request.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/http-0.12.0+2/lib/src/byte_stream.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/http-0.12.0+2/lib/src/streamed_response.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/http-0.12.0+2/lib/src/base_response.dart... [...] parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/intl-0.15.8/lib/src/lazy_locale_data.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/intl-0.15.8/lib/src/file_data_reader.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/petitparser-2.4.0/lib/src/debug/continuation.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/petitparser-2.4.0/lib/src/debug/profile.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/petitparser-2.4.0/lib/src/debug/output.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/petitparser-2.4.0/lib/src/reflection/transform.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/petitparser-2.4.0/lib/src/reflection/iterable.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/petitparser-2.4.0/lib/src/debug/progress.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/petitparser-2.4.0/lib/src/debug/trace.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/petitparser-2.4.0/lib/src/reflection/optimize.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/big_int_serializer.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/date_time_serializer.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/duration_serializer.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/int64_serializer.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/fixnum-0.10.11/lib/fixnum.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/json_object_serializer.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/num_serializer.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/double_serializer.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/uri_serializer.dart... parsing /tmp/pub-cache-dirWWOCMC/hosted/pub.dartlang.org/built_value-7.0.0/lib/src/bool_serializer.dart... stderr: Exceeded timeout of 0:10:00.000000 Documenting gsheet_to_arb...

Support latest dependencies. (-40 points)

The version constraint in pubspec.yaml does not support the latest published versions for 4 dependencies (analyzer, googleapis, intl, json_annotation).

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Package is getting outdated. (-4.38 points)

The package was last published 54 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
analyzer >=0.33.0-alpha.0 <0.34.0 0.33.6+1 0.39.2+1
args >=0.12.1 <2.0.0 1.5.2
code_builder ^3.1.3 3.2.1
dart_style ^1.0.0 1.2.0 1.3.3
file_utils ^0.1.1 0.1.3
googleapis ^0.52.0+1 0.52.0+1 0.54.0
googleapis_auth ^0.2.6 0.2.11
intl >=0.15.3 <0.16.0 0.15.8 0.16.0
intl_translation ^0.17.2 0.17.4 0.17.7
json_annotation ^2.0.0 2.4.0 3.0.0
logging ^0.11.3+2 0.11.3+2
path >=0.9.0 <2.0.0 1.6.4
recase ^2.0.0+1 2.0.1
Transitive dependencies
_discoveryapis_commons 0.1.9
async 2.4.0
built_collection 4.3.0
built_value 7.0.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
fixnum 0.10.11
front_end 0.1.6+9 0.1.29
glob 1.2.0
globbing 0.3.0
html 0.14.0+3
http 0.12.0+2
http_parser 3.1.3
js 0.6.1+1
kernel 0.3.6+9 0.3.29
matcher 0.12.6
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
pedantic 1.9.0
petitparser 2.4.0
plugin 0.2.0+3
pub_semver 1.4.2
quiver 2.1.2+1
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+13
yaml 2.2.0
Dev dependencies
build_runner ^1.0.0
json_serializable ^2.0.0
test ^1.2.0