コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TmxQueryManager"/> class.
 /// </summary>
 /// <param name="rootElement">The root element.</param>
 /// <param name="sessionModel">The session model.</param>
 public TmxQueryManager(XElement rootElement, TranslatorSessionModel sessionModel)
 {
     _model       = sessionModel;
     _rootElement = rootElement;
     /* extract the source language */
     _srcLangString = (from el in _rootElement.Elements("header") select el.Attribute("srclang").Value).FirstOrDefault();
     /* extract all possible destination languages */
     foreach (var destLang in (from tr in _rootElement.Elements("body").Elements("tu").Elements("tuv").Where(e => (string)e.Attribute(_xmlns + "lang") != _srcLangString) select tr.Attribute(_xmlns + "lang")))
     {
         if (!_destLangStrings.Contains(destLang.Value))
         {
             _destLangStrings.Add(destLang.Value);
         }
     }
     Debug.Assert(_srcLangString != null, "_srcLangString != null");
     sessionModel.SourceLanguageTmx   = new CultureInfo(_srcLangString);
     sessionModel.DestinationLanguage = new CultureInfo(_destLangStrings[0]);
     /* cache all tu-elements */
     _tuElements = _rootElement.Elements("body").Elements("tu");
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TmxExporter"/> class.
 /// </summary>
 /// <param name="translationItems">The translation items.</param>
 /// <param name="model">The model.</param>
 public TmxExporter(TranslatorSessionModel model)
 {
     _model = model;
 }