Bloom.Book.RuntimeInformationInjector.MakePageLabelLocalizable C# (CSharp) Method

MakePageLabelLocalizable() private static method

Adds a script to the page that triggers i18n after the page is fully loaded.
private static MakePageLabelLocalizable ( HtmlDom singlePageHtmlDom, string>.Dictionary d ) : void
singlePageHtmlDom HtmlDom
d string>.Dictionary
return void
        private static void MakePageLabelLocalizable(HtmlDom singlePageHtmlDom, Dictionary<string, string> d)
        {
            foreach (XmlElement element in singlePageHtmlDom.RawDom.SelectNodes("//*[contains(@class, 'pageLabel')]"))
            {
                if (!element.HasAttribute("data-i18n"))
                {
                    var englishLabel = element.InnerText;
                    var key = "TemplateBooks.PageLabel." + englishLabel;
                    AddTranslationToDictionaryUsingEnglishAsKey(d, key, englishLabel);

                    element.SetAttribute("data-i18n", key);
                }
            }
        }