private LocalizationValue this[RozkladLocalization rozkladLocalization, string text] { get { if (!rozkladLocalization.Values.TryGetValue(text, out var value)) { value = _localizations[DefaultLanguage].Values[text]; // log } return(new LocalizationValue(value)); } }
public static void Validate( RozkladLocalization rozkladLocalization) { if (string.IsNullOrEmpty(rozkladLocalization.ShortName)) { throw new Exception( "Short name is not specified in localization file"); } if (string.IsNullOrEmpty(rozkladLocalization.FullName)) { throw new Exception( $"Full name is not specified in {rozkladLocalization.ShortName} localization"); } var missingKeys = new List <string>(); var emptyKeys = new List <string>(); foreach (var checkKey in LocalizationValuesKeys) { if (rozkladLocalization.Values.TryGetValue(checkKey, out string value)) { if (string.IsNullOrEmpty(value)) { emptyKeys.Add(checkKey); } } else { missingKeys.Add(checkKey); } } if (!missingKeys.Any() && !emptyKeys.Any()) { return; } throw RozkladLocalizationValidationException.Create(missingKeys, emptyKeys, rozkladLocalization.ShortName); }