public virtual XLRTargetNode loadNode(System.Globalization.CultureInfo fileLocale, System.String fileId, System.Globalization.CultureInfo locale, System.String id)
        {
            System.String key = getKey(fileLocale, fileId);
            XLRFile       f   = (XLRFile)filedict[key];

            if (f == null)
            {
                System.String resource = key.replaceAll("\\.", "/") + ".xlr";
                //UPGRADE_ISSUE: Method 'java.lang.ClassLoader.getResource' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassLoader'"
                //UPGRADE_ISSUE: Method 'java.lang.Class.getClassLoader' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetClassLoader'"
                System.Uri url = GetType().getClassLoader().getResource(resource);

                if (url != null)
                {
                    f             = new XLRFile(this, fileId, url);
                    filedict[key] = f;
                }
            }
            if (f != null)
            {
                f.load();
                XLRMessageNode messageNode = (XLRMessageNode)nodedict[id];
                if (messageNode != null)
                {
                    XLRTargetNode targetNode = messageNode.getTarget(locale.ToString());
                    return(targetNode);
                }
            }

            return(null);
        }
        public virtual ILocalizedText getLocalizedText(System.Globalization.CultureInfo locale, System.String id)
        {
            XLRMessageNode messageNode = (XLRMessageNode)nodedict[id];
            XLRTargetNode  targetNode  = null;

            if (messageNode != null)
            {
                targetNode = messageNode.getTarget(locale.ToString());
            }

            if (targetNode == null)
            {
                targetNode = checkLocales(locale, id);
            }

            if (targetNode == null)
            {
                return(null);
            }

            return(new XLRLocalizedText(this, targetNode));
        }
Example #3
0
			public override void  startElement(System.String uri, System.String localName, System.String qName, SaxAttributesSupport attributes)
			{
				XLRNode current = null;
				if (context.Count > 0)
				{
					current = (XLRNode) context[context.Count - 1];
				}
				
				// common shortcuts...
				System.String locale = attributes.GetValue("locale");
				if (locale == null)
					locale = fileLocale;
				System.String text = attributes.GetValue("text");
				
				XLRNode node = null;
				if ("messages".Equals(qName))
				{
					fileLocale = attributes.GetValue("locale");
					if (attributes.GetValue("idbase") != null)
						base_Renamed = attributes.GetValue("idbase");
				}
				else if ("message".Equals(qName))
				{
					System.String id = attributes.GetValue("id");
					
					if (base_Renamed != null)
						id = base_Renamed + "." + id;
					
					node = (XLRMessageNode) nodedict[id];
					if (node == null)
					{
						node = new XLRMessageNode(id);
						nodedict[id] = node;
					}
					if ((text != null) && (locale != null))
					// check errors
					{
						XLRTargetNode targetNode = new XLRTargetNode(locale);
						node.children.Add(targetNode);
						XLRTextNode textNode = new XLRTextNode(text);
						targetNode.children.Add(textNode);
					}
					
					
					context.Add(node);
				}
				else if ("target".Equals(qName))
				{
					node = new XLRTargetNode(locale);
					if (text != null)
						node.children.Add(new XLRTextNode(text));
					
					current.children.Add(node);
					context.Add(node);
				}
				else if ("text".Equals(qName))
				{
					System.String value_Renamed = attributes.GetValue("value");
					
					node = new XLRTextNode(value_Renamed);
					
					current.children.Add(node);
					context.Add(node);
				}
				else if ("variable".Equals(qName))
				{
					System.String name = attributes.GetValue("name");
					
					node = new XLRVariableNode(name);
					current.children.Add(node);
					context.Add(node);
				}
				else if ("match".Equals(qName))
				{
					node = new XLRMatchNode(attributes.GetValue("variable"), attributes.GetValue("pattern"));
					if (text != null)
						node.children.Add(new XLRTextNode(text));
					
					current.children.Add(node);
					context.Add(node);
				}
				else if ("select".Equals(qName))
				{
					node = new XLRChoiceNode();
					current.children.Add(node);
					context.Add(node);
				}
				else
				{
					//UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
					throw new SAXParseException("blorp", null); // fixme
				}
			}
            public override void  startElement(System.String uri, System.String localName, System.String qName, SaxAttributesSupport attributes)
            {
                XLRNode current = null;

                if (context.Count > 0)
                {
                    current = (XLRNode)context[context.Count - 1];
                }

                // common shortcuts...
                System.String locale = attributes.GetValue("locale");
                if (locale == null)
                {
                    locale = fileLocale;
                }
                System.String text = attributes.GetValue("text");

                XLRNode node = null;

                if ("messages".Equals(qName))
                {
                    fileLocale = attributes.GetValue("locale");
                    if (attributes.GetValue("idbase") != null)
                    {
                        base_Renamed = attributes.GetValue("idbase");
                    }
                }
                else if ("message".Equals(qName))
                {
                    System.String id = attributes.GetValue("id");

                    if (base_Renamed != null)
                    {
                        id = base_Renamed + "." + id;
                    }

                    node = (XLRMessageNode)nodedict[id];
                    if (node == null)
                    {
                        node         = new XLRMessageNode(id);
                        nodedict[id] = node;
                    }
                    if ((text != null) && (locale != null))
                    // check errors
                    {
                        XLRTargetNode targetNode = new XLRTargetNode(locale);
                        node.children.Add(targetNode);
                        XLRTextNode textNode = new XLRTextNode(text);
                        targetNode.children.Add(textNode);
                    }


                    context.Add(node);
                }
                else if ("target".Equals(qName))
                {
                    node = new XLRTargetNode(locale);
                    if (text != null)
                    {
                        node.children.Add(new XLRTextNode(text));
                    }

                    current.children.Add(node);
                    context.Add(node);
                }
                else if ("text".Equals(qName))
                {
                    System.String value_Renamed = attributes.GetValue("value");

                    node = new XLRTextNode(value_Renamed);

                    current.children.Add(node);
                    context.Add(node);
                }
                else if ("variable".Equals(qName))
                {
                    System.String name = attributes.GetValue("name");

                    node = new XLRVariableNode(name);
                    current.children.Add(node);
                    context.Add(node);
                }
                else if ("match".Equals(qName))
                {
                    node = new XLRMatchNode(attributes.GetValue("variable"), attributes.GetValue("pattern"));
                    if (text != null)
                    {
                        node.children.Add(new XLRTextNode(text));
                    }

                    current.children.Add(node);
                    context.Add(node);
                }
                else if ("select".Equals(qName))
                {
                    node = new XLRChoiceNode();
                    current.children.Add(node);
                    context.Add(node);
                }
                else
                {
                    //UPGRADE_ISSUE: Constructor 'org.xml.sax.SAXParseException.SAXParseException' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_orgxmlsaxSAXParseExceptionSAXParseException_javalangString_orgxmlsaxLocator'"
                    throw new SAXParseException("blorp", null);                     // fixme
                }
            }