validateConfig method

Future<bool> validateConfig()

Validate configuration format and content

Implementation

Future<bool> validateConfig() async {
  try {
    final config = await loadConfig();

    if (!config.isValid) {
      throw Exception(
        'Configuration is invalid: languages and strings must not be empty',
      );
    }

    // Validate language codes (basic check)
    for (final lang in config.languages) {
      if (lang.length < 2 || lang.length > 5) {
        throw Exception('Invalid language code: $lang');
      }
    }

    return true;
  } catch (e) {
    throw Exception('Configuration validation failed: ${e.toString()}');
  }
}