/// <summary> /// Build the code - description map for the specified component and add it to <see cref="_componentCodesDescriptionMap"/>. /// </summary> /// <param name="dim"> /// The component /// </param> public void BuildCodeDescriptionMap(IComponent dim) { Dictionary <string, string> codeDescriptionMap; if (!this._componentCodesDescriptionMap.TryGetValue(dim.Id, out codeDescriptionMap)) { codeDescriptionMap = new Dictionary <string, string>(StringComparer.Ordinal); this._componentCodesDescriptionMap.Add(dim.Id, codeDescriptionMap); } else { codeDescriptionMap.Clear(); } ICodelistObject codelist = this.GetCachedCodelist(dim); string lang = this.CurrentCulture.TwoLetterISOLanguageName; foreach (ICode code in codelist.Items) { string desc = TextTypeHelper.GetText(code.Names, lang); if (string.IsNullOrEmpty(desc)) { desc = code.Id; } codeDescriptionMap.Add(code.Id, desc); } }
/// <summary> /// Get localised name for the specified artefact /// </summary> /// <param name="identifiable"> /// The artefact /// </param> /// <returns> /// The localized name if it exists or the id /// </returns> public static string GetLocalizedName(INameableObject identifiable) { CultureInfo cultureInfo = Thread.CurrentThread.CurrentUICulture; string lang = cultureInfo.TwoLetterISOLanguageName; string ret = TextTypeHelper.GetText(identifiable.Names, lang); if (string.IsNullOrEmpty(ret)) { ret = identifiable.Id; } return(ret); }