load static method

Future<MigrationConfig> load(
  1. String path
)

Load configuration from a YAML file

Implementation

static Future<MigrationConfig> load(String path) async {
  final file = File(path);
  if (!file.existsSync()) {
    throw Exception('Configuration file not found: $path');
  }

  final contents = await file.readAsString();
  final yaml = loadYaml(contents) as Map;

  return MigrationConfig(
    keyStrategy: yaml['key_strategy'] as String? ?? 'msgid',
    featureMappings: _parseFeatureMappings(yaml['feature_mappings']),
    excludePatterns: _parseStringList(yaml['exclude']),
    autoExtractThreshold: yaml['auto_extract_threshold'] as int? ?? 80,
    sourceLocale: yaml['source_locale'] as String? ?? 'en',
    targetLocales: _parseStringList(yaml['target_locales']),
    preserveFormatting: yaml['preserve_formatting'] as bool? ?? true,
    stableIdsForVolatile: yaml['stable_ids_for_volatile'] as bool? ?? false,
  );
}