lsaudon / l10nization_cli

A Command-Line Interface to find unused l10n translations from an arb file.

Home Page:https://pub.dev/packages/l10nization_cli

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

L10nization_cli

Pub Version Pub Points License: MIT

A Command-Line Interface to find unused l10n translations from an arb file.


Getting Started 🚀

If the CLI application is available on pub, activate globally via:

dart pub global activate l10nization_cli

Usage

# Check unused translations
l10nization check-unused <folder-of-app>

Cases considered

return Text(context.l10n.hello);
final l10n = AppLocalizations.of(context);
return Text(l10n.a);
final l10n = context.l10n;
return Text(l10n.a);
return Text(AppLocalizations.of(context).a);
class MyWidget extends StatelessWidget {
  const MyWidget({
    required this.l10n,
    super.key,
  });

  final AppLocalizations l10n;

  @override
  Widget build(BuildContext context) {
    return Text(l10n.helloMoon);
  }
}
extension AppLocalizationsExtension on AppLocalizations {
  String byKey(final String value) {
    switch (value) {
      case 'helloMars':
        return helloMars;
      default:
        throw Exception();
    }
  }
}
String function(AppLocalizations l10n) {
  return l10n.helloMoon;
}
String function(AppLocalizations l10n) => l10n.helloMoon;
final l10n = context.l10n;
return Text(l10n.a(b));
return Text(context.l10n.a(b));

Running locally

dart pub global activate --source=path . && l10nization check-unused example

Running Tests with coverage 🧪

To run all unit tests use the following command:

dart pub global activate coverage
dart test --coverage=coverage
dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info

To view the generated coverage report you can use lcov.

# Generate Coverage Report
genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
open coverage/index.html

Build version

dart run build_runner build -d

Generated by the Very Good CLI 🤖

About

A Command-Line Interface to find unused l10n translations from an arb file.

https://pub.dev/packages/l10nization_cli

License:MIT License


Languages

Language:Dart 99.7%Language:Kotlin 0.3%