void TranslateComponent(PackageItem item)
{
if (_stringsSource == null)
return;
Dictionary<string, string> strings;
if (!_stringsSource.TryGetValue(this.id + item.id, out strings))
return;
string ename, elementId, value;
XML cxml, dxml;
int dcnt = item.displayList.Length;
for (int i = 0; i < dcnt; i++)
{
cxml = item.displayList[i].desc;
ename = cxml.name;
elementId = cxml.GetAttribute("id");
if (cxml.HasAttribute("tooltips"))
{
if (strings.TryGetValue(elementId + "-tips", out value))
cxml.SetAttribute("tooltips", value);
}
dxml = cxml.GetNode("gearText");
if (dxml != null)
{
if (strings.TryGetValue(elementId + "-texts", out value))
dxml.SetAttribute("values", value);
if (strings.TryGetValue(elementId + "-texts_def", out value))
dxml.SetAttribute("default", value);
}
if (ename == "text" || ename == "richtext")
{
if (strings.TryGetValue(elementId, out value))
cxml.SetAttribute("text", value);
if (strings.TryGetValue(elementId + "-prompt", out value))
cxml.SetAttribute("prompt", value);
}
else if (ename == "list")
{
XMLList.Enumerator et = cxml.GetEnumerator("item");
int j = 0;
while (et.MoveNext())
{
if (strings.TryGetValue(elementId + "-" + j, out value))
et.Current.SetAttribute("title", value);
j++;
}
}
else if (ename == "component")
{
dxml = cxml.GetNode("Button");
if (dxml != null)
{
if (strings.TryGetValue(elementId, out value))
dxml.SetAttribute("title", value);
if (strings.TryGetValue(elementId + "-0", out value))
dxml.SetAttribute("selectedTitle", value);
continue;
}
dxml = cxml.GetNode("Label");
if (dxml != null)
{
if (strings.TryGetValue(elementId, out value))
dxml.SetAttribute("title", value);
continue;
}
dxml = cxml.GetNode("ComboBox");
if (dxml != null)
{
if (strings.TryGetValue(elementId, out value))
dxml.SetAttribute("title", value);
XMLList.Enumerator et = dxml.GetEnumerator("item");
int j = 0;
while (et.MoveNext())
{
if (strings.TryGetValue(elementId + "-" + j, out value))
et.Current.SetAttribute("title", value);
j++;
}
continue;
}
}
}
}