intl_flavors_codegen 0.0.2 copy "intl_flavors_codegen: ^0.0.2" to clipboard
intl_flavors_codegen: ^0.0.2 copied to clipboard

discontinuedreplaced by: jimtl_codegen
SDKDart

Intl utility to manage multi ARB files to manage flavors in your app

example/lib/main.dart

import 'package:intl/intl.dart';
import 'package:intl_flavors/intl_flavors.dart';
import 'package:intl_flavors_codegen_example/main_messages_all.dart';

main() async {
  Intl.defaultLocale = 'en';
  await initializeMessages(Intl.defaultLocale!, 'default');
  final translations = Translations();
  print(translations.test);
  print(translations.testAndAge(5));
  print(translations.testAndGender('gender'));
  print(translations.testAndPlural(5));
}

@GenerateIntl(locales: const {'fr'}, generateFlutterDelegate: false)
class Translations {
  String get test => Intl.message('test', name: 'test');

  String testAndAge(int age) => Intl.message('Test have $age years old', args: [age], name: 'testAndAge');

  String testAndGender(String gender) => Intl.gender(gender, name: 'testAndGender', args: [gender], male: 'Test is male', other: 'Test is unknown', female: 'Test is female');

  String testAndPlural(int number) => Intl.plural(
        number,
        args: [number],
        name: 'testAndPlural',
        one: 'Test is alone',
        many: 'Test is a lot',
        few: 'Test is few',
        other: 'Test is other',
      );
}
0
likes
110
points
5
downloads

Documentation

API reference

Publisher

verified publisherjaumard.com

Weekly Downloads

Intl utility to manage multi ARB files to manage flavors in your app

License

MIT (license)

Dependencies

analyzer, build, intl, intl_flavors, intl_generator, path, source_gen

More

Packages that depend on intl_flavors_codegen