コード例 #1
0
        /// <summary>
        /// Make a translation of the summary data in the current language
        /// </summary>
        /// <param name="value">value format to translate</param>
        /// <returns>the text translated</returns>
        public string Translate(string value)
        {
            o2Mate.LocaleGroup group = new LocaleGroup();
            string             groupName, localeName;

            if (group.ExtractGroupAndName(value, out groupName, out localeName))
            {
                if (group.Exists(groupName))
                {
                    o2Mate.ILocaleSet set = group.Get(groupName);
                    if (set.ExistsOne(localeName, System.Threading.Thread.CurrentThread.CurrentUICulture.Name))
                    {
                        return(set.Get(localeName, System.Threading.Thread.CurrentThread.CurrentUICulture.Name));
                    }
                    else
                    {
                        return(value);
                    }
                }
                else
                {
                    return(value);
                }
            }
            else
            {
                return(value);
            }
        }
コード例 #2
0
        /// <summary>
        /// Update summary from html element
        /// </summary>
        /// <param name="elem">html element object</param>
        public void Update(System.Windows.Forms.HtmlElement elem)
        {
            this.context     = elem.GetAttribute("context");
            this.name        = elem.GetAttribute("name");
            this.description = elem.GetAttribute("description");
            this.type        = elem.GetAttribute("typeLegende");
            this.expression  = elem.GetAttribute("expression");
            this.commentaire = elem.GetAttribute("commentaire");
            this.free        = Boolean.Parse(elem.GetAttribute("free"));
            o2Mate.LocaleGroup group = new LocaleGroup();
            string             groupName, localeName;

            if (group.ExtractGroupAndName(this.description, out groupName, out localeName))
            {
                if (!group.Exists(groupName))
                {
                    group.Create(groupName);
                }
                o2Mate.ILocaleSet set = group.Get(groupName);
                if (!set.ExistsOne(localeName, "fr-FR"))
                {
                    set.Add(localeName, "fr-FR", "");
                }
                if (!set.ExistsOne(localeName, "en-US"))
                {
                    set.Add(localeName, "en-US", "");
                }
            }
            if (group.ExtractGroupAndName(this.commentaire, out groupName, out localeName))
            {
                if (!group.Exists(groupName))
                {
                    group.Create(groupName);
                }
                o2Mate.ILocaleSet set = group.Get(groupName);
                if (!set.ExistsOne(localeName, "fr-FR"))
                {
                    set.Add(localeName, "fr-FR", "");
                }
                if (!set.ExistsOne(localeName, "en-US"))
                {
                    set.Add(localeName, "en-US", "");
                }
            }
        }