polyglot 1.0.0-dev copy "polyglot: ^1.0.0-dev" to clipboard
polyglot: ^1.0.0-dev copied to clipboard

outdated

i18n DSL and compiler for Angular2 Dart.

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"';
  }
}

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

i18n DSL and compiler for Angular2 Dart.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

args, barback, code_builder, string_scanner

More

Packages that depend on polyglot