Example #1
0
 /// <summary>
 /// Recognize language and set to txt 
 /// Translate if is needed and put into *.xlf
 /// </summary>
 /// <param name="requireUserDecision"></param>
 /// <param name="text"></param>
 /// <param name="key2"></param>
 public void Add(bool requireUserDecision, string text, string key2 = null)
 {
     #region Recognize language and set to txt 
     // If A2 is path, A1 is text
     if (FS.ExistsFile(text))
     {
         return;
     }
     this.requireUserDecision = requireUserDecision;
     acceptHotkey.Tag = key2;
     if (TextLang.IsCzech(text))
     {
         l = Langs.cs;
         //rbCs.IsChecked = true;
     }
     else
     {
         // not to lb but directly to l. manybe in UC will raise event handler to set l, but in XlfEngine not. 
         l = Langs.en;
         //rbEn.IsChecked = true;
     }
     ClearTextBoxes(false, true);
     txtText.Text = text;
     #endregion
     #region Process text
     if (l == Langs.en)
     {
         // Insert as content of <target>
         // Will use only english so czech don't translate now
         Add();
     }
     else
     {
         string englishTranslate = null;
         englishTranslate = TranslateHelper.Instance.Translate(text, "en", "cs");
         if (char.IsUpper(text[0]))
         {
             englishTranslate = SH.FirstCharUpper(englishTranslate);
         }
         txtEnglishTranslate.Text = englishTranslate;
         ThisApp.SetStatus(TypeOfMessage.Error, "Press enter to add or delete to exit");
         if (requireUserDecision)
         {
             waitingForUserDecision = true;
         }
         else
         {
             Accept(acceptHotkey);
         }
     }
     #endregion
 }
Example #2
0
    public void GenerateFilesCsFileFilterTests()
    {
        var fi = GetConsts();

        foreach (var item in fi)
        {
            if (item.Name.EndsWith("Pp"))
            {
                var path = FS.Combine(p, "auto", "+" + item.GetValue(null));
                if (!FS.ExistsFile(path, false))
                {
                    TF.WriteAllText(path, "a");
                }
            }
        }
    }