2222 * under the License.
2323 */
2424
25-
26- using System ;
27- using System . Collections . Generic ;
28- using System . Collections . Specialized ;
29- using System . Drawing ;
30- using System . Linq ;
31- using System . Text ;
32- using System . Windows . Forms ;
33- using System . Xml ;
34- using System . Xml . XPath ;
35- using SourceGrid ;
36- using SourceGrid . Cells . Views ;
37- using BorderStyle = System . Windows . Forms . BorderStyle ;
38-
3925namespace YAF . TranslateApp
4026{
27+ using System ;
28+ using System . Collections . Generic ;
29+ using System . Collections . Specialized ;
30+ using System . Drawing ;
31+ using System . Linq ;
32+ using System . Text ;
33+ using System . Windows . Forms ;
34+ using System . Xml ;
35+ using System . Xml . XPath ;
36+
37+ using SourceGrid ;
38+ using SourceGrid . Cells . Views ;
39+
40+ using BorderStyle = System . Windows . Forms . BorderStyle ;
41+
42+ /// <summary>
43+ ///
44+ /// </summary>
4145 public partial class TranslateForm : Form
4246 {
4347 #region Private instance variables
@@ -289,6 +293,7 @@ void TbxTextChanged(object sender, EventArgs e)
289293 {
290294 btnSave . Enabled = true ;
291295 }
296+
292297 /// <summary>
293298 /// Auto Translate The Selected Resource via Google Translator
294299 /// </summary>
@@ -304,8 +309,6 @@ void MenuItemClick(object sender, EventArgs e)
304309 TextBox tbx = ( TextBox ) contextMenu . SourceControl ;
305310 TextBoxTranslation tbt = ( TextBoxTranslation ) tbx . Tag ;
306311
307- tbx . Text = Translator . TranslateText ( tbx . Text , string . Format ( "{0}|{1}" , sLangCodeSrc , sLangCodeDest ) ) ;
308-
309312 RangeRegion region = grid1 . Selection . GetSelectionRegion ( ) ;
310313 PositionCollection poss = region . GetCellsPositions ( ) ;
311314
@@ -317,8 +320,8 @@ void MenuItemClick(object sender, EventArgs e)
317320
318321 // Update Translations List
319322 translations . Find ( check =>
320- check . sPageName . Equals ( tbt . pageName ) && check . sResourceName . Equals ( tbt . resourceName ) ) .
321- sLocalizedValue = tbx . Text ;
323+ check . PageName . Equals ( tbt . pageName ) && check . ResourceName . Equals ( tbt . resourceName ) ) .
324+ LocalizedValue = tbx . Text ;
322325
323326 // tlpTranslations.Focus();
324327 }
@@ -347,8 +350,8 @@ void TbxLostFocus(object sender, EventArgs e)
347350
348351 // Update Translations List
349352 translations . Find ( check =>
350- check . sPageName . Equals ( tbt . pageName ) && check . sResourceName . Equals ( tbt . resourceName ) ) .
351- sLocalizedValue = tbx . Text ;
353+ check . PageName . Equals ( tbt . pageName ) && check . ResourceName . Equals ( tbt . resourceName ) ) .
354+ LocalizedValue = tbx . Text ;
352355
353356 //tlpTranslations.Focus();
354357
@@ -617,10 +620,10 @@ private void CreatePageResourceControl(string pageName, string resourceName, str
617620
618621 Translation translation = new Translation
619622 {
620- sPageName = pageName ,
621- sResourceName = resourceName ,
622- sResourceValue = srcResourceValue ,
623- sLocalizedValue = dstResourceValue
623+ PageName = pageName ,
624+ ResourceName = resourceName ,
625+ ResourceValue = srcResourceValue ,
626+ LocalizedValue = dstResourceValue
624627 } ;
625628
626629 translations . Add ( translation ) ;
@@ -769,23 +772,23 @@ private bool SaveTransalation()
769772 foreach ( Translation trans in translations )
770773 {
771774 // <page></page>
772- if ( ! trans . sPageName . Equals ( currentPageName , StringComparison . OrdinalIgnoreCase ) )
775+ if ( ! trans . PageName . Equals ( currentPageName , StringComparison . OrdinalIgnoreCase ) )
773776 {
774777 if ( ! String . IsNullOrEmpty ( currentPageName ) )
775778 {
776779 xw . WriteFullEndElement ( ) ;
777780 }
778781
779- currentPageName = trans . sPageName ;
782+ currentPageName = trans . PageName ;
780783
781784 xw . WriteStartElement ( "page" ) ;
782785 xw . WriteAttributeString ( "name" , currentPageName ) ;
783786
784787 }
785788
786789 xw . WriteStartElement ( "Resource" ) ;
787- xw . WriteAttributeString ( "tag" , trans . sResourceName ) ;
788- xw . WriteString ( trans . sLocalizedValue ) ;
790+ xw . WriteAttributeString ( "tag" , trans . ResourceName ) ;
791+ xw . WriteString ( trans . LocalizedValue ) ;
789792 xw . WriteFullEndElement ( ) ;
790793 }
791794
@@ -832,7 +835,7 @@ public static List<T> RemoveDuplicateSections<T>(List<T> list) where T : Transla
832835 }*/
833836
834837 foreach ( T item1 in
835- list . Where ( item1 => finalList . Find ( check => check . sPageName . Equals ( item1 . sPageName ) && check . sResourceName . Equals ( item1 . sResourceName ) ) == null ) )
838+ list . Where ( item1 => finalList . Find ( check => check . PageName . Equals ( item1 . PageName ) && check . ResourceName . Equals ( item1 . ResourceName ) ) == null ) )
836839 {
837840 finalList . Add ( item1 ) ;
838841 }
@@ -887,58 +890,10 @@ private void CheckPendingOnlyCheckedChanged(object sender, EventArgs e)
887890 #endregion
888891
889892 /// <summary>
890- /// Translate all Pending Ressources with Google Translator
893+ /// Handles the Load event of the TranslateForm control.
891894 /// </summary>
892- /// <param name="sender"></param>
893- /// <param name="e"></param>
894- private void AutoTranslateAll ( object sender , EventArgs e )
895- {
896- progressBar . Maximum = grid1 . Rows . Count ;
897- progressBar . Minimum = 0 ;
898-
899- progressBar . Value = 0 ;
900-
901- Cursor = Cursors . WaitCursor ;
902-
903- for ( int i = 0 ; i < grid1 . Rows . Count ; i ++ )
904- {
905- progressBar . Value = i ;
906-
907- if ( grid1 [ i , 2 ] . Editor == null ) continue ;
908-
909- SourceGrid . Cells . Editors . TextBox tbx = ( SourceGrid . Cells . Editors . TextBox ) grid1 [ i , 2 ] . Editor ;
910-
911- TextBoxTranslation tbt = ( TextBoxTranslation ) tbx . Control . Tag ;
912-
913- if ( ! tbx . Control . ForeColor . Equals ( Color . Red ) ) continue ;
914-
915- tbx . Control . Text = Translator . TranslateText ( tbx . Control . Text ,
916- string . Format ( "{0}|{1}" , sLangCodeSrc , sLangCodeDest ) ) ;
917-
918- tbx . Control . ForeColor = tbt . srcResourceValue . Equals ( tbx . Control . Text , StringComparison . OrdinalIgnoreCase )
919- ? Color . Red
920- : Color . Black ;
921-
922- // Update Translations List
923- translations . Find ( check =>
924- check . sPageName . Equals ( tbt . pageName ) &&
925- check . sResourceName . Equals ( tbt . resourceName ) ) .
926- sLocalizedValue = tbx . Control . Text ;
927-
928-
929- grid1 [ i , 2 ] . View = tbt . srcResourceValue . Equals ( tbx . Control . Text , StringComparison . OrdinalIgnoreCase )
930- ? cellLocalResourceRed
931- : cellLocalResource ;
932-
933- grid1 [ i , 2 ] . Value = tbx . Control . Text ;
934- }
935-
936- grid1 . Update ( ) ;
937-
938-
939- Cursor = Cursors . Default ;
940- }
941-
895+ /// <param name="sender">The source of the event.</param>
896+ /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
942897 private void TranslateForm_Load ( object sender , EventArgs e )
943898 {
944899 checkPendingOnly . Checked = Properties . Settings . Default . ShowPendingOnly ;
0 commit comments