polyglot 1.0.0-dev+1

  • README.md
  • Installing
  • Versions
  • 0

ng2_polyglot

i18n DSL and compiler for Angular2 Dart.

Example

@languages [en, es];
 
"hello" {
    en: "Hello, world!",
    es: "¡Hola, mundo!"
}

Output:

import 'package:angular2/core.dart' show Pipe, PipeTransform;

@Pipe(name: 'polyglot')
class PolyglotPipe implements PipeTransform {
  String transform(String key, [String locale]) {
    if (key == 'hello') {
      if (locale == null) {
        return 'en';
      }
      if (locale == 'en') {
        return 'Hello, world!';
      }
      if (locale == 'es') {
        return '¡Hola, mundo!';
      }
    }
    return 'Unrecognized key: "$key"';
  }
}

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate polyglot

2. Use it

The package has the following executables:


$ polyglot

Use this package as a library

1. Depend on it

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


dependencies:
  polyglot: ^1.0.0-dev+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:polyglot/polyglot.dart';
  
Version Uploaded Documentation Archive
1.0.0-dev+1 Dec 19, 2016 Go to the documentation of polyglot 1.0.0-dev+1 Download polyglot 1.0.0-dev+1 archive
1.0.0-dev Dec 19, 2016 Go to the documentation of polyglot 1.0.0-dev Download polyglot 1.0.0-dev archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.1.0.
 
 Because polyglot depends on args >=0.2.8+2 <1.4.4 which requires SDK version <2.0.0, version solving failed.

Health suggestions

Format lib/src/cli/cli.dart.

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

Format lib/src/cli/compiler.dart.

Run dartfmt to format lib/src/cli/compiler.dart.

Format lib/src/text/ast/ast.dart.

Run dartfmt to format lib/src/text/ast/ast.dart.

Fix additional 6 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/text/ast/identifier.dart (Run dartfmt to format lib/src/text/ast/identifier.dart.)
  • lib/src/text/ast/key_value_pair.dart (Run dartfmt to format lib/src/text/ast/key_value_pair.dart.)
  • lib/src/text/ast/top_level_declaration.dart (Run dartfmt to format lib/src/text/ast/top_level_declaration.dart.)
  • lib/src/text/ast/word_declaration.dart (Run dartfmt to format lib/src/text/ast/word_declaration.dart.)
  • lib/src/text/syntax_error.dart (Run dartfmt to format lib/src/text/syntax_error.dart.)
  • lib/src/text/token_type.dart (Run dartfmt to format lib/src/text/token_type.dart.)

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

Package is getting outdated. (-97.81 points)

The package was released 103 weeks ago.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-release. (-5 points)

Pre-release versions should be used with caution, their API may change in breaking ways.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use polyglot.dart. Packages with multiple examples should use example/readme.md.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0