| | | 1 | | using Newtonsoft.Json.Linq; |
| | | 2 | | using ValidateLib.ErrorsAndWarnings.Warnings; |
| | | 3 | | using ValidateLib.Metadata.Descriptors; |
| | | 4 | | using ValidateLib.Metadata.Properties.AtomicProperties; |
| | | 5 | | using ValidateLib.UtilityClasses; |
| | | 6 | | |
| | | 7 | | namespace ValidateLib.Metadata.PropertyParsers.InheritedProperties |
| | | 8 | | { |
| | | 9 | | internal class LangPropertyParser : PropertyParserBase<InheritedPropertiesDescriptor>, IPropertyParser<InheritedProp |
| | | 10 | | { |
| | 1 | 11 | | public LangPropertyParser(List<Warning> warnings, InheritedPropertiesDescriptor descriptor) : base(warnings, des |
| | | 12 | | { |
| | 1 | 13 | | } |
| | | 14 | | |
| | | 15 | | public void ParseProperty(JProperty property) |
| | | 16 | | { |
| | 1 | 17 | | if (property.Value.Type != JTokenType.String) |
| | | 18 | | { |
| | 0 | 19 | | Warnings.Add(WarningFactory.GetStringPropertyWrongValueWarning(property.Value, property.Name, property.V |
| | 0 | 20 | | Descriptor.lang = new AtomicPropertyString("und"); |
| | | 21 | | } |
| | | 22 | | else |
| | | 23 | | { |
| | 1 | 24 | | if (!LanguageUtilityClass.IsCorrectLanguageCode(property.Value.ToString())) |
| | | 25 | | { |
| | 1 | 26 | | Warnings.Add(WarningFactory.GetLangWrongValueWarning(property.ToString())); |
| | 1 | 27 | | Descriptor.lang = new AtomicPropertyString("und"); |
| | | 28 | | } |
| | | 29 | | else |
| | | 30 | | { |
| | 1 | 31 | | Descriptor.lang = new AtomicPropertyString(property.Value.ToString()); |
| | | 32 | | } |
| | | 33 | | } |
| | 1 | 34 | | } |
| | | 35 | | } |
| | | 36 | | } |