Example #1
0
        /// <summary>
        /// gets all translations and assign translation to a text
        /// so that it can show the right translation to the users
        /// </summary>
        /// <param name="item">item</param>
        private static void AssignTranslations(i18nText item)
        {
            Check.Require(allTranslations != null, "InitAlli18nTexts should must be called before assigning translations");

            foreach (var tran in allTranslations)
            {
                if (tran.StringTextID == item.StringTextID)
                {
                    item.SetTranslation(tran);
                }
            }
        }
Example #2
0
        public static void Add(i18nText item)
        {
            Check.Require(dic != null, "InitAlli18nTexts should must be called before adding translations");

            Check.Require(item != null, "item argument should not be null");
            if (dic.ContainsKey(item.StringTextID) == false)
            {
                dic.TryAdd(item.StringTextID, item);
                AddItemToDatabase(item);
                AssignTranslations(item);
            }

            // for debug purposes, we refresh the whole translations on local host
            // to test views without resta
            if (FWUtils.WebUIUtils.IsLocalHost() == true)
            {
                LoadAllTranslations(true);
                AssignTranslations(item);
            }
        }
Example #3
0
        /// <summary>
        /// adds a text item to database for translation
        /// </summary>
        /// <param name="item">item</param>
        private static void AddItemToDatabase(i18nText item)
        {
            IFWStringTextService service = (IFWStringTextService)EntityFactory.GetEntityServiceByName("StringText", "");

            service.AddItemToDatabase(item);
        }