Exemple #1
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Removes the specified translation unit variant.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public void RemoveVariant(TransUnitVariant tuv)
 {
     if (tuv != null)
     {
         RemoveVariant(tuv.Lang);
     }
 }
Exemple #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds a translation unit variant having the specified language id and value.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public bool AddOrReplaceVariant(string langId, string value)
        {
            var tuv = new TransUnitVariant();

            tuv.Lang  = langId;
            tuv.Value = value;
            return(AddOrReplaceVariant(tuv));
        }
Exemple #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Removes the variant for the specified language.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void RemoveVariant(string langId)
        {
            TransUnitVariant tuv = GetVariantForLang(langId);

            if (tuv != null)
            {
                Variants.Remove(tuv);
            }
        }
Exemple #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds the specified variant.
        /// </summary>
        /// <param name="tuv">The variant.</param>
        /// <returns>true if the variant was successfully added. Otherwise, false.</returns>
        /// ------------------------------------------------------------------------------------
        public bool AddOrReplaceVariant(TransUnitVariant tuv)
        {
            if (tuv == null || tuv.IsEmpty)
            {
                return(false);
            }

            // If a variant exists for the specified language, then remove it first.
            RemoveVariant(tuv.Lang);

            Variants.Add(tuv);
            return(true);
        }