Last updated:
0 purchases
l10nization cli
L10nization_cli #
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
copied to clipboard
Usage #
# Check unused translations
l10nization check-unused <folder-of-app>
copied to clipboard
Cases considered #
return Text(context.l10n.hello);
copied to clipboard
final l10n = AppLocalizations.of(context);
return Text(l10n.a);
copied to clipboard
final l10n = context.l10n;
return Text(l10n.a);
copied to clipboard
return Text(AppLocalizations.of(context).a);
copied to clipboard
class MyWidget extends StatelessWidget {
const MyWidget({
required this.l10n,
super.key,
});
final AppLocalizations l10n;
@override
Widget build(BuildContext context) {
return Text(l10n.helloMoon);
}
}
copied to clipboard
abstract class MySuperWidget extends StatelessWidget {
const MySuperWidget({
required this.l10n,
super.key,
});
final AppLocalizations l10n;
}
class MyWidget extends MySuperWidget {
const MyWidget({
required super.l10n,
super.key,
});
@override
Widget build(BuildContext context) {
return Text(l10n.helloMoon);
}
}
copied to clipboard
extension AppLocalizationsExtension on AppLocalizations {
String byKey(final String value) {
switch (value) {
case 'helloMars':
return helloMars;
default:
throw Exception();
}
}
}
copied to clipboard
String function(AppLocalizations l10n) {
return l10n.helloMoon;
}
copied to clipboard
String function(AppLocalizations l10n) => l10n.helloMoon;
copied to clipboard
final l10n = context.l10n;
return Text(l10n.a(b));
copied to clipboard
return Text(context.l10n.a(b));
copied to clipboard
Running locally #
dart pub global activate --source=path . && l10nization check-unused example
copied to clipboard
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
copied to clipboard
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
copied to clipboard
Build version #
dart run build_runner build -d
copied to clipboard
Generated by the Very Good CLI ๐ค
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.