feat(i18n): add redesign strings and translate Escuchar rename to 11 locales
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
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<String> supportedArbLocales = [
|
||||
'ar',
|
||||
'bn',
|
||||
'de',
|
||||
'en',
|
||||
'es',
|
||||
'fr',
|
||||
'hi',
|
||||
'id',
|
||||
'it',
|
||||
'ja',
|
||||
'pt',
|
||||
'ru',
|
||||
'zh',
|
||||
];
|
||||
|
||||
/// Reads and decodes `lib/l10n/app_<locale>.arb` as a JSON map.
|
||||
Map<String, dynamic> readArb(String locale) {
|
||||
final file = File('lib/l10n/app_$locale.arb');
|
||||
return json.decode(file.readAsStringSync()) as Map<String, dynamic>;
|
||||
}
|
||||
|
||||
/// Real translation keys only -- excludes ICU metadata entries (`@key`)
|
||||
/// and the `@@locale` marker, which are not themselves translatable
|
||||
/// strings.
|
||||
Set<String> realKeys(Map<String, dynamic> arb) {
|
||||
return arb.keys.where((key) => !key.startsWith('@')).toSet();
|
||||
}
|
||||
Reference in New Issue
Block a user