string GetDefaultVariantValue(TransUnit tu) { var variant = tu.GetVariantForLang(LocalizationManager.kDefaultLang); if (variant == null) { return(null); } return(variant.Value); }
/// ------------------------------------------------------------------------------------ /// <summary> /// If a translation unit does not already exist for the id in the specified /// translation unit, then the translation unit is added. Otherwise, if the variant /// for the specified language does not exist in the translation unit, it is added. /// </summary> /// ------------------------------------------------------------------------------------ internal void AddTransUnitOrVariantFromExisting(TransUnit tu, string langId) { var variantToAdd = tu.GetVariantForLang(langId); if (variantToAdd == null || AddTransUnit(tu)) { return; } var existingTu = GetTransUnitForId(tu.Id); //notice, we don't care if there is already a string in there for this language //(that was the source of a previous bug), because the tmx of language X should //surely take precedence, as source of the translation, over other language's //tms files which, by virtue of their alphabetica order (e.g. arabic), came //first. This probably only effects English, as it has variants in all the other //languages. Previously, Arabic would be processed first, so when English came //along, it was too late. existingTu.AddOrReplaceVariant(variantToAdd); }