コード例 #1
0
 private static void context_AfterItemAutoTranslation(object sender, AutoTranslationEventArgs<AutoTranslationResult> e)
 {
     // there is a problem with Microsoft translator and results have a space at the end, although original text does not
     // following code removes that obsolete character
     var translationResult = e.Item;
     if (translationResult.Text.EndsWith(" ", StringComparison.InvariantCultureIgnoreCase) && !translationResult.OriginalText.EndsWith(" ", StringComparison.InvariantCultureIgnoreCase))
     {
         translationResult.Text = translationResult.Text.Substring(0, translationResult.Text.Length - 1);
     }
 }
コード例 #2
0
ファイル: ExclusionsPlugIn.cs プロジェクト: sebasbaumh/ResEx
 /// <summary>
 /// Before translating an item, replace with placeholders all the texts that should not be exluded.
 /// the placeholders will be replaced back with the original text after the translation
 /// See <see cref="context_AfterItemAutoTranslation"/>
 /// </summary>
 private void context_BeforeItemAutoTranslation(object sender, AutoTranslationEventArgs<AutoTranslationItem> e)
 {
     // pass strings from exclusion manager to exclude items that should not be translated
     e.Item.Text = this.exclusionManager.Exclude(e.Item.Text);
 }
コード例 #3
0
ファイル: ExclusionsPlugIn.cs プロジェクト: sebasbaumh/ResEx
 /// <summary>
 /// Replaces placeholders - created by <see cref="context_BeforeItemAutoTranslation"/> -  back to original texts
 /// </summary>
 private void context_AfterItemAutoTranslation(object sender, AutoTranslationEventArgs<AutoTranslationResult> e)
 {
     e.Item.Text = this.exclusionManager.Restore(e.Item.Text);
 }