SetTranslated() public method

public SetTranslated ( object obj, bool translated ) : void
obj object
translated bool
return void
Example #1
0
        public static void ReadProperty(ClassDescriptor klass, ObjectWrapper wrapper, object wrapped, XmlElement prop_node)
        {
            string             name = prop_node.GetAttribute("name");
            PropertyDescriptor prop = klass [name] as PropertyDescriptor;

            if (prop == null || !prop.CanWrite)
            {
                return;
            }

            string strval = prop_node.InnerText;

            // Skip translation context
            if (prop_node.GetAttribute("context") == "yes" && strval.IndexOf('|') != -1)
            {
                strval = strval.Substring(strval.IndexOf('|') + 1);
            }

            object value = prop.StringToValue(strval);

            prop.SetValue(wrapped, value);

            if (prop.Translatable)
            {
                if (prop_node.GetAttribute("translatable") != "yes")
                {
                    prop.SetTranslated(wrapped, false);
                }
                else
                {
                    prop.SetTranslated(wrapped, true);
                    if (prop_node.GetAttribute("context") == "yes")
                    {
                        strval = prop_node.InnerText;
                        int bar = strval.IndexOf('|');
                        if (bar != -1)
                        {
                            prop.SetTranslationContext(wrapped, strval.Substring(0, bar));
                        }
                    }

                    if (prop_node.HasAttribute("comments"))
                    {
                        prop.SetTranslationComment(wrapped, prop_node.GetAttribute("comments"));
                    }
                }
            }
        }