private void ValidateEdit(string key, string newValue) { Complain.IfNull(_dictionary); Complain.IfNull(key); Complain.IfNull(newValue); Complain.If(!_dictionary.ContainsKey(key), Complaints.KEY_NOT_FOUND); }
private void ValidateGlobalReplacement(string oldValue, string newValue) { Complain.IfNull(_dictionary); Complain.IfNull(oldValue); Complain.IfNull(newValue); Complain.If(oldValue == newValue, Complaints.CANNOT_REPLACE_WITH_IDENTICAL_VALUE, By.ThrowingAnException); }
private void ValidateTranslation(Dictionary <string, string> originalKeyValues, string originalLanguage, string targetLanguage) { Complain.IfNull(originalKeyValues); Complain.IfStringIsNullOrWhitespace(originalLanguage); Complain.IfStringIsNullOrWhitespace(targetLanguage); Complain.If(!_translationClient.ListLanguages().Select(l => l.Code).ToList().Contains(originalLanguage), $"{Constants.ORIGINAL_LANGUAGE_CODE} '{originalLanguage}' is not in the list of {_translationClient.GetType().ToString()}'s translatable languages. Please double-check the code or try a different language.", By.ThrowingAnException); Complain.If(!_translationClient.ListLanguages().Select(l => l.Code).ToList().Contains(targetLanguage), $"Target language code '{targetLanguage}' is not in the list of {_translationClient.GetType().ToString()}'s translatable languages. Please double-check the code or try a different language.", By.ThrowingAnException); }
private void ValidateSave() { Complain.IfNull(_dictionary); }