import 'dart:convert'; import 'dart:io'; /// All 13 supported locale codes backing `lib/l10n/app_*.arb`. /// /// `flutter test` always runs with the working directory set to the /// package root, so `lib/l10n/...` below resolves correctly without any /// extra path juggling. const List supportedArbLocales = [ 'ar', 'bn', 'de', 'en', 'es', 'fr', 'hi', 'id', 'it', 'ja', 'pt', 'ru', 'zh', ]; /// Reads and decodes `lib/l10n/app_.arb` as a JSON map. Map readArb(String locale) { final file = File('lib/l10n/app_$locale.arb'); return json.decode(file.readAsStringSync()) as Map; } /// Real translation keys only -- excludes ICU metadata entries (`@key`) /// and the `@@locale` marker, which are not themselves translatable /// strings. Set realKeys(Map arb) { return arb.keys.where((key) => !key.startsWith('@')).toSet(); }