/// <summary> /// get the translation of the block (falls through to nested content) /// </summary> private TranslationValue GetBlockValue(string displayName, JToken block, CultureInfoView culture) { if (block == null) { return(null); } if (block is JObject jBlock) { if (!jBlock.ContainsKey("content")) { return(null); } var content = jBlock.Value <JArray>("content"); return(ValueMapperFactory.GetMapperSource( Constants.PropertyEditors.Aliases.NestedContent, displayName, content, culture)); } return(null); }
private static JToken GetBlockTranslation(JToken value, TranslationValue translationValue, CultureInfoView sourceCulture, CultureInfoView targetCulture) { if (value is JObject jValue) { if (jValue.ContainsKey("content")) { var content = jValue.Value <JArray>("content"); var result = (string)ValueMapperFactory.GetMapperTarget( Constants.PropertyEditors.Aliases.NestedContent, content, translationValue, sourceCulture, targetCulture); if (result != null) { value["content"] = JToken.Parse(result); } } } return(value); }