/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the localized value for the specified id. If formatForDisplay is true, then /// the string will have ampersands and newlines converted so the text is displayed /// nicely at runtime. /// </summary> /// ------------------------------------------------------------------------------------ public string GetValueForExactLangAndId(string langId, string id, bool formatForDisplay) { var tu = TmxDocument.GetTransUnitForId(id); if (tu == null) { return(null); } var tuv = tu.GetVariantForLang(langId); if (tuv == null) { return(null); } var value = tuv.Value; if (value == null) { return(null); } if (formatForDisplay && s_literalNewline != null) { value = value.Replace(s_literalNewline, kOSRealNewline); } if (formatForDisplay && _ampersandReplacement != null) { value = value.Replace(_ampersandReplacement, "&"); } return(value); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the category for the specified id. /// </summary> /// ------------------------------------------------------------------------------------ internal LocalizationCategory GetCategory(string id) { TMXTransUnit tu = TmxDocument.GetTransUnitForId(id); if (tu != null) { string category = tu.GetPropValue(kCategoryPropTag); try { return((LocalizationCategory)Enum.Parse(typeof(LocalizationCategory), category)); } catch { } } return(LocalizationCategory.Other); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the priority for the specified id. /// </summary> /// ------------------------------------------------------------------------------------ internal LocalizationPriority GetPriority(string id) { TMXTransUnit tu = TmxDocument.GetTransUnitForId(id); if (tu != null) { string priority = tu.GetPropValue(kPriorityPropTag); try { return((LocalizationPriority)Enum.Parse(typeof(LocalizationPriority), priority)); } catch { } } return(LocalizationPriority.NotLocalizable); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the group for the specified id. /// </summary> /// ------------------------------------------------------------------------------------ internal string GetGroup(string id) { TMXTransUnit tu = TmxDocument.GetTransUnitForId(id); return(tu == null ? null : tu.GetPropValue(kGroupPropTag)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the comment for the specified id. /// </summary> /// ------------------------------------------------------------------------------------ public string GetComment(string id) { TMXTransUnit tu = TmxDocument.GetTransUnitForId(id); return(tu == null || tu.Notes.Count == 0 ? null : tu.Notes[0].Text); }