doRun method

  1. @override
Future<int> doRun()
override

Implementation

@override
Future<int> doRun() async {
  final config = findConfigAndSetWorkingDir();
  final l10nConfig = config.l10n;
  final args = argResults!;
  final baseLocale = args[_argLocale] as String? ?? _defaultLocale;
  final comparer = ArbComparer(l10nConfig, baseLocale);
  final notTranslatedKeys = await comparer.compare(
    () async {
      printInfo('Running extract to arb...');
      await extractLocalization(l10nConfig);
    },
  );
  if (notTranslatedKeys.isEmpty) {
    return success(
        message: 'All strings have translation for locale: $baseLocale');
  } else {
    return error(2,
        message:
            'No translations for strings: ${notTranslatedKeys.join(',')} in locale: $baseLocale');
  }
}