polyglot 1.0.0-dev+1

  • README.md
  • Installing
  • Versions
  • 34

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

We analyzed this package on Aug 20, 2018, and provided a score, details, and suggestions below. Analysis was completed with status tool failures using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: unsure

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

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

Fix platform conflicts.

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Maintain CHANGELOG.md.

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

Package is getting outdated.

The package was released 87 weeks ago.

Package is pre-release.

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

The description is too short.

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

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0