Bloom.Collection.CollectionSettings.GetLanguage2Name C# (CSharp) Метод

GetLanguage2Name() публичный Метод

public GetLanguage2Name ( string inLanguage ) : string
inLanguage string
Результат string
        public string GetLanguage2Name(string inLanguage)
        {
            try
            {
                //TODO: we are going to need to show "French" as "Français"... but if the name isn't available, we should have a fall-back mechanism, at least to english
                //So, we'd rather have GetBestLanguageMatch()

                return GetLanguageName(Language2Iso639Code, inLanguage);
            }
            catch (Exception)
            {
                Debug.Fail("check this out. BL-193 Reproduction");
                // a user reported this, and I saw it happen once: had just installed 0.8.38, made a new vernacular
                //project, added a picture dictionary, the above failed (no debugger, so I don't know why).
                return "L2-Unknown-" + Language2Iso639Code;
            }
        }

Usage Example

        public static void AddUIDictionaryToDom(HtmlDom pageDom, CollectionSettings collectionSettings)
        {
            XmlElement dictionaryScriptElement = pageDom.RawDom.SelectSingleNode("//script[@id='ui-dictionary']") as XmlElement;
            if (dictionaryScriptElement != null)
                dictionaryScriptElement.ParentNode.RemoveChild(dictionaryScriptElement);

            dictionaryScriptElement = pageDom.RawDom.CreateElement("script");
            dictionaryScriptElement.SetAttribute("type", "text/javascript");
            dictionaryScriptElement.SetAttribute("id", "ui-dictionary");
            var d = new Dictionary<string, string>();

            d.Add(collectionSettings.Language1Iso639Code, collectionSettings.Language1Name);
            if (!String.IsNullOrEmpty(collectionSettings.Language2Iso639Code) && !d.ContainsKey(collectionSettings.Language2Iso639Code))
                d.Add(collectionSettings.Language2Iso639Code, collectionSettings.GetLanguage2Name(collectionSettings.Language2Iso639Code));
            if (!String.IsNullOrEmpty(collectionSettings.Language3Iso639Code) && !d.ContainsKey(collectionSettings.Language3Iso639Code))
                d.Add(collectionSettings.Language3Iso639Code, collectionSettings.GetLanguage3Name(collectionSettings.Language3Iso639Code));

            d.Add("vernacularLang", collectionSettings.Language1Iso639Code);//use for making the vernacular the first tab
            d.Add("{V}", collectionSettings.Language1Name);
            d.Add("{N1}", collectionSettings.GetLanguage2Name(collectionSettings.Language2Iso639Code));
            d.Add("{N2}", collectionSettings.GetLanguage3Name(collectionSettings.Language3Iso639Code));

            AddLocalizedHintContentsToDictionary(pageDom, d, collectionSettings);

            dictionaryScriptElement.InnerText = String.Format("function GetDictionary() {{ return {0};}}", JsonConvert.SerializeObject(d));

            pageDom.Head.InsertAfter(dictionaryScriptElement, pageDom.Head.LastChild);
        }
All Usage Examples Of Bloom.Collection.CollectionSettings::GetLanguage2Name