public static UpdateContentLanguageClasses ( |
||
elementOrDom | ||
settings | ||
vernacularIso | string | |
contentLanguageIso2 | string | |
contentLanguageIso3 | string | |
Результат | void |
/// <summary> /// Returns the sequence of bloom-editable divs that would normally be created as the content of an empty bloom-translationGroup, /// given the current collection and book settings, with the classes that would normally be set on them prior to editing to make the right ones visible etc. /// </summary> public static string GetDefaultTranslationGroupContent(XmlNode pageOrDocumentNode, Book currentBook) { // First get a XMLDocument so that we can start creating elements using it. XmlDocument ownerDocument = pageOrDocumentNode?.OwnerDocument; if (ownerDocument == null) // the OwnerDocument child can be null if pageOrDocumentNode is a document itself { if (pageOrDocumentNode is XmlDocument) { ownerDocument = pageOrDocumentNode as XmlDocument; } else { return(""); } } // We want to use the usual routines that insert the required bloom-editables and classes into existing translation groups. // To make this work we make a temporary translation group // Since one of the routines expects the TG to be a descendant of the element passed to it, we make another layer of temporary wrapper around the translation group as well var containerElement = ownerDocument.CreateElement("div"); containerElement.SetAttribute("class", "bloom-translationGroup"); var wrapper = ownerDocument.CreateElement("div"); wrapper.AppendChild(containerElement); PrepareElementsInPageOrDocument(containerElement, currentBook.BookData); TranslationGroupManager.UpdateContentLanguageClasses(wrapper, currentBook.BookData, currentBook.Language1IsoCode, currentBook.Language2IsoCode, currentBook.Language3IsoCode); return(containerElement.InnerXml); }