static public QtTranslation CreatNewTranslation(CultureInfo targetCulture) { XmlRacine ts = new XmlRacine("TS"); ts.SetAttribute("language", targetCulture.Name); ts.SetAttribute("version", "2.1"); return(new QtTranslation(ts.OwnerDocument)); }
public XmlDocument GetXmlDocument() { XmlRacine ts = new XmlRacine("TS"); ts.SetAttribute("language", Language.Name); ts.SetAttribute("version", Version.ToString()); foreach (QtTranslationContext ctx in Dictionary.Values) { XmlElement context = ts.AppendElement("context"); context.AppendElement("name").AppendText(ctx.Name); foreach (QtTranslationMessage msg in ctx) { XmlElement message = context.AppendElement("message"); foreach (var loc in msg.Locations) { XmlElement location = message.AppendElement("location"); location.SetAttribute("filename", loc.Filename); location.SetAttribute("line", loc.Line.ToString()); } message.AppendElement("source").AppendText(msg.Source); if (!msg.Comment.IsNullOrWhiteSpace()) { message.AppendElement("comment").AppendText(msg.Comment); } message.AppendElement("translation").AppendText(msg.Translation); } } return(ts.OwnerDocument); }