|
/*
File: FormPLoc.cs
Version: 1.0
Author:
Anne Gunn (ompeag at wyoming dot com)
Copyright:
Copyright (c) 2004, Anne Gunn.
License:
This module is distributed under the MIT License.
http://www.opensource.org/licenses/mit-license.php
Notes:
This module is a Windows gui wrapper for the pseudolocalization enginen.
See pLocalize.cs for more info.
*/
using pseudoLocalizer;
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace pseudoLocalizer
{
/// <summary>
/// FormPLoc is a gui interface to the pseudoLocalization engine
/// </summary>
public class FormPLoc : System.Windows.Forms.Form
{
private System.Windows.Forms.Button buttonExit;
private System.Windows.Forms.Button buttonTranslate;
private System.Windows.Forms.Button buttonCopy;
private System.Windows.Forms.TextBox TextIn;
private System.Windows.Forms.Label LabelIn;
private System.Windows.Forms.Label labelLocal;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.TextBox TextLocal;
private pLocalizeEngine pLoc = new pLocalizeEngine ();
public FormPLoc()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
}
public void setTextIn (string newText)
{
TextIn.Text = newText;
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonExit = new System.Windows.Forms.Button();
this.buttonTranslate = new System.Windows.Forms.Button();
this.buttonCopy = new System.Windows.Forms.Button();
this.TextIn = new System.Windows.Forms.TextBox();
this.LabelIn = new System.Windows.Forms.Label();
this.labelLocal = new System.Windows.Forms.Label();
this.TextLocal = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// buttonExit
//
this.buttonExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonExit.Location = new System.Drawing.Point(312, 168);
this.buttonExit.Name = "buttonExit";
this.buttonExit.Size = new System.Drawing.Size(72, 48);
this.buttonExit.TabIndex = 2;
this.buttonExit.Text = "Exit";
this.buttonExit.Click += new System.EventHandler(this.buttonExit_Click);
//
// buttonTranslate
//
this.buttonTranslate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonTranslate.Location = new System.Drawing.Point(312, 24);
this.buttonTranslate.Name = "buttonTranslate";
this.buttonTranslate.Size = new System.Drawing.Size(72, 48);
this.buttonTranslate.TabIndex = 0;
this.buttonTranslate.Text = "Translate";
this.buttonTranslate.Click += new System.EventHandler(this.buttonTranslate_Click);
//
// buttonCopy
//
this.buttonCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCopy.Enabled = false;
this.buttonCopy.Location = new System.Drawing.Point(312, 96);
this.buttonCopy.Name = "buttonCopy";
this.buttonCopy.Size = new System.Drawing.Size(72, 48);
this.buttonCopy.TabIndex = 1;
this.buttonCopy.Text = "Copy to Clipboard";
this.buttonCopy.Click += new System.EventHandler(this.buttonCopy_Click);
//
// TextIn
//
this.TextIn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TextIn.Location = new System.Drawing.Point(24, 32);
this.TextIn.Multiline = true;
this.TextIn.Name = "TextIn";
this.TextIn.Size = new System.Drawing.Size(248, 136);
this.TextIn.TabIndex = 3;
this.TextIn.Text = "<type or cut-and-paste the text you want to translate here>";
//
// LabelIn
//
this.LabelIn.Location = new System.Drawing.Point(8, 8);
this.LabelIn.Name = "LabelIn";
this.LabelIn.Size = new System.Drawing.Size(136, 16);
this.LabelIn.TabIndex = 4;
this.LabelIn.Text = "Text to translate:";
//
// labelLocal
//
this.labelLocal.Location = new System.Drawing.Point(8, 184);
this.labelLocal.Name = "labelLocal";
this.labelLocal.Size = new System.Drawing.Size(136, 16);
this.labelLocal.TabIndex = 6;
this.labelLocal.Text = "pseudoLocalized text:";
//
// TextLocal
//
this.TextLocal.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TextLocal.Location = new System.Drawing.Point(24, 208);
this.TextLocal.Multiline = true;
this.TextLocal.Name = "TextLocal";
this.TextLocal.Size = new System.Drawing.Size(248, 136);
this.TextLocal.TabIndex = 5;
this.TextLocal.Text = "";
//
// FormPLoc
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(400, 374);
this.Controls.Add(this.labelLocal);
this.Controls.Add(this.TextLocal);
this.Controls.Add(this.LabelIn);
this.Controls.Add(this.TextIn);
this.Controls.Add(this.buttonCopy);
this.Controls.Add(this.buttonTranslate);
this.Controls.Add(this.buttonExit);
this.Name = "FormPLoc";
this.Text = "pseudoLocalizer";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] argv)
{
FormPLoc fpLoc = new FormPLoc();
if (argv.Length > 0)
{
fpLoc.setTextIn (argv[0]);
}
Application.Run(fpLoc);
}
private void buttonExit_Click(object sender, System.EventArgs e)
{
Application.Exit ();
}
private void buttonTranslate_Click(object sender, System.EventArgs e)
{
string OriginalText = TextIn.Text;
string LocalText = pLoc.Localize (OriginalText);
TextLocal.Text = LocalText;
buttonCopy.Enabled = true;
}
private void buttonCopy_Click(object sender, System.EventArgs e)
{
Clipboard.SetDataObject(TextLocal.Text);
}
} // class FormPLoc
} // namespace pseudoLocalizer
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.