Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.

Commit ad0aefc

Browse files
committed
updated
1 parent 2a78b85 commit ad0aefc

17 files changed

+142
-162
lines changed

.gitignore

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,6 @@ publish/
130130
*.pubxml
131131
*.publishproj
132132

133-
# NuGet Packages
134-
*.nupkg
135-
# The packages folder can be ignored because of Package Restore
136-
**/packages/*
137-
# except build/, which is used as an MSBuild target.
138-
!**/packages/build/
139-
# If using the old MSBuild-Integrated Package Restore, uncomment this:
140-
#!**/packages/repositories.config
141-
142133
# Windows Azure Build Output
143134
csx/
144135
*.build.csdef
@@ -181,3 +172,5 @@ UpgradeLog*.htm
181172

182173
# Microsoft Fakes
183174
FakesAssemblies/
175+
*.dll
176+
*.exe

ExtensionMethods.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,22 @@
2222
* under the License.
2323
*/
2424

25-
using System;
26-
using System.Reflection;
27-
using System.Windows.Forms;
28-
2925
namespace YAF.TranslateApp
3026
{
27+
using System;
28+
using System.Reflection;
29+
using System.Windows.Forms;
30+
31+
/// <summary>
32+
/// Extension Methods
33+
/// </summary>
3134
public static class ExtensionMethods
3235
{
36+
/// <summary>
37+
/// Doubles the buffered.
38+
/// </summary>
39+
/// <param name="tlp">The TLP.</param>
40+
/// <param name="setting">if set to <c>true</c> [setting].</param>
3341
public static void DoubleBuffered(this TableLayoutPanel tlp, bool setting)
3442
{
3543
Type dgvType = tlp.GetType();

Program.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
* under the License.
2323
*/
2424

25-
26-
using System;
27-
using System.Windows.Forms;
28-
using YAF.TranslateApp;
29-
3025
namespace YAF.TranslateApp
3126
{
27+
using System;
28+
using System.Windows.Forms;
29+
30+
/// <summary>
31+
///
32+
/// </summary>
3233
static class Program
3334
{
3435
/// <summary>

Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
[assembly: AssemblyConfiguration("")]
3939
[assembly: AssemblyCompany("Ingo Herbote")]
4040
[assembly: AssemblyProduct("YAFTranslateApp")]
41-
[assembly: AssemblyCopyright("Copyright © 2006-2010 Yet Another Forum.NET")]
41+
[assembly: AssemblyCopyright("Copyright © Yet Another Forum.NET")]
4242
[assembly: AssemblyTrademark("")]
4343
[assembly: AssemblyCulture("")]
4444

@@ -60,5 +60,5 @@
6060
// You can specify all the values or you can default the Build and Revision Numbers
6161
// by using the '*' as shown below:
6262
// [assembly: AssemblyVersion("1.0.*")]
63-
[assembly: AssemblyVersion("1.1.0.*")]
64-
[assembly: AssemblyFileVersion("1.1.0")]
63+
[assembly: AssemblyVersion("1.2.0.*")]
64+
[assembly: AssemblyFileVersion("1.2.0")]

Properties/Resources.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Properties/Settings.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TranslateForm.Designer.cs

Lines changed: 11 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

TranslateForm.cs

Lines changed: 35 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,26 @@
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-
3925
namespace 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

Comments
 (0)