gsheet_to_arb 0.0.6

  • Readme
  • Changelog
  • Example
  • Installing
  • 47

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]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
47
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

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

Health suggestions

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

Analysis of bin/arb_to_dart.dart reported 1 hint:

line 26 col 7: Use isEmpty instead of length

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

Analysis of bin/import.dart reported 1 hint:

line 25 col 7: Use isEmpty instead of length

Fix lib/src/arb/arb_generator.dart. (-0.50 points)

Analysis of lib/src/arb/arb_generator.dart reported 1 hint:

line 20 col 54: Use ; instead of {} for empty constructor bodies.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • 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.)
  • lib/src/sheet/sheet_parser.dart (Run dartfmt to format lib/src/sheet/sheet_parser.dart.)

Maintenance issues and suggestions

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.

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.0
args >=0.12.1 <2.0.0 1.5.2
code_builder ^3.1.3 3.2.0
dart_style ^1.0.0 1.2.0 1.3.2
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.10
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.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.6+9 0.1.28
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.28
matcher 0.12.6
meta 1.1.7
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
pedantic 1.8.0+1
petitparser 2.4.0
plugin 0.2.0+3
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
Dev dependencies
build_runner ^1.0.0
json_serializable ^2.0.0
test ^1.2.0