Improved the LocalizationTool and updated the Localization build script to also include the WizardForm project.

git-svn-id: https://duplicati.googlecode.com/svn/trunk@252 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
kenneth.skovhede@gmail.com
2009-08-10 17:55:29 +00:00
parent 3f0178b7d7
commit bfc8450488
7 changed files with 136 additions and 112 deletions
+9 -4
View File
@@ -115,7 +115,6 @@ namespace Duplicati.GUI
//The official Mono SQLite provider is also broken with less than 3.6.3
MessageBox.Show(string.Format(Strings.Program.WrongSQLiteVersion, System.Data.SQLite.SQLiteConnection.SQLiteVersion, "3.6.3"), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
System.Data.IDbConnection con = new System.Data.SQLite.SQLiteConnection();
@@ -138,9 +137,15 @@ namespace Duplicati.GUI
if (!string.IsNullOrEmpty(new Datamodel.ApplicationSettings(DataConnection).DisplayLanguage))
try
{
System.Threading.Thread.CurrentThread.CurrentUICulture =
System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.GetCultureInfo(new Datamodel.ApplicationSettings(DataConnection).DisplayLanguage);
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo(new Datamodel.ApplicationSettings(DataConnection).DisplayLanguage);
try
{
System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
}
catch
{
//We still get the userinterface translated, but numbers and other formating is incorrect :(
}
}
catch(Exception ex)
{
Binary file not shown.
Binary file not shown.
+42 -30
View File
@@ -1,33 +1,45 @@
<root>
<assembly name="Duplicati" folder="GUI" namespace="Duplicati.GUI">
<exclude>Datamodel</exclude>
</assembly>
<assembly name="Duplicati.Datamodel" folder="GUI\Datamodel">
<exclude>Datamodel</exclude>
</assembly>
<assembly name="Duplicati.CommandLine" folder="CommandLine">
<exclude>Decrypter</exclude>
</assembly>
<assembly name="Duplicati.Library.Core" folder="Library\Core" />
<assembly name="Duplicati.Library.Main" folder="Library\Main" />
<assembly name="Duplicati.Library.Encryption" folder="Library\Encryption" />
<assembly name="Duplicati.Library.SharpExpect" folder="Library\SharpExpect" />
<assembly name="Duplicati.Library.Compression" folder="Library\Compression" />
<assembly name="Duplicati.Library.Encryption" folder="Library\Encryption" />
<assembly name="Duplicati.Library.SharpRSync" folder="Library\SharpRSync" />
<configuration name="Duplicati">
<assembly name="Duplicati" folder="GUI" namespace="Duplicati.GUI">
<exclude>Datamodel</exclude>
</assembly>
<assembly name="Duplicati.Datamodel" folder="GUI\Datamodel">
<exclude>Datamodel</exclude>
</assembly>
<assembly name="Duplicati.CommandLine" folder="CommandLine">
<exclude>Decrypter</exclude>
</assembly>
<assembly name="Duplicati.Library.Core" folder="Library\Core" />
<assembly name="Duplicati.Library.Main" folder="Library\Main" />
<assembly name="Duplicati.Library.Encryption" folder="Library\Encryption" />
<assembly name="Duplicati.Library.SharpExpect" folder="Library\SharpExpect" />
<assembly name="Duplicati.Library.Compression" folder="Library\Compression" />
<assembly name="Duplicati.Library.Encryption" folder="Library\Encryption" />
<assembly name="Duplicati.Library.SharpRSync" folder="Library\SharpRSync" />
<assembly name="Duplicati.Library.Backend.BackendInterface" folder="Library\Backend\BackendInterface" />
<assembly name="Duplicati.Library.Backend.BackendLoader" folder="Library\Backend\BackendLoader" />
<assembly name="Duplicati.Library.Backend.FTP" folder="Library\Backend\FTP" />
<assembly name="Duplicati.Library.Backend.File" folder="Library\Backend\File" />
<assembly name="Duplicati.Library.Backend.SSH" folder="Library\Backend\SSH" />
<assembly name="Duplicati.Library.Backend.S3" folder="Library\Backend\S3" />
<assembly name="Duplicati.Library.Backend.WEBDAV" folder="Library\Backend\WEBDAV" />
<assembly name="Duplicati.Library.Backend.CloudFiles" folder="Library\Backend\CloudFiles" />
<keyfile>..\GUI\Duplicati.snk</keyfile>
<versionassembly>..\GUI\bin\release\Duplicati.exe</versionassembly>
<sourcefolder>..</sourcefolder>
<outputfolder>compiled</outputfolder>
<productname>Duplicati</productname>
<assembly name="Duplicati.Library.Backend.BackendInterface" folder="Library\Backend\BackendInterface" />
<assembly name="Duplicati.Library.Backend.BackendLoader" folder="Library\Backend\BackendLoader" />
<assembly name="Duplicati.Library.Backend.FTP" folder="Library\Backend\FTP" />
<assembly name="Duplicati.Library.Backend.File" folder="Library\Backend\File" />
<assembly name="Duplicati.Library.Backend.SSH" folder="Library\Backend\SSH" />
<assembly name="Duplicati.Library.Backend.S3" folder="Library\Backend\S3" />
<assembly name="Duplicati.Library.Backend.WEBDAV" folder="Library\Backend\WEBDAV" />
<assembly name="Duplicati.Library.Backend.CloudFiles" folder="Library\Backend\CloudFiles" />
<keyfile>..\GUI\Duplicati.snk</keyfile>
<versionassembly>..\GUI\bin\release\Duplicati.exe</versionassembly>
<sourcefolder>..</sourcefolder>
<outputfolder>compiled</outputfolder>
<productname>Duplicati</productname>
</configuration>
<configuration name="WizardForm">
<assembly name="System.Windows.Forms.Wizard" folder="WizardForm" />
<keyfile>..\..\WizardForm\WizardForm.snk</keyfile>
<versionassembly>..\GUI\bin\release\System.Windows.Forms.Wizard.dll</versionassembly>
<sourcefolder>..\..</sourcefolder>
<outputfolder>compiled</outputfolder>
<productname>WizardForm</productname>
</configuration>
</root>
@@ -45,7 +45,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>..\..\Duplicati\Localization\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+82 -75
View File
@@ -110,62 +110,67 @@ namespace LocalizationTool
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(System.IO.Path.Combine(Application.StartupPath, "configuration.xml"));
string sourcefolder = System.IO.Path.GetFullPath(Duplicati.Library.Core.Utility.AppendDirSeperator(doc.SelectSingleNode("root/sourcefolder").InnerText));
string outputfolder = System.IO.Path.GetFullPath(Duplicati.Library.Core.Utility.AppendDirSeperator(System.IO.Path.Combine(Application.StartupPath, culture)));
string target = System.IO.Path.Combine(outputfolder, culture);
foreach (string s in Duplicati.Library.Core.Utility.EnumerateFiles(sourcefolder))
foreach (System.Xml.XmlNode conf in doc.SelectNodes("root/configuration"))
{
if (s.ToLower().StartsWith(Application.StartupPath.ToLower()))
continue;
string outputfolder = System.IO.Path.GetFullPath(Duplicati.Library.Core.Utility.AppendDirSeperator(System.IO.Path.Combine(Application.StartupPath, culture)));
string sourcefolder = Duplicati.Library.Core.Utility.AppendDirSeperator(System.IO.Path.GetFullPath(conf["sourcefolder"].InnerText));
if (s.EndsWith(".resx"))
foreach (System.Xml.XmlNode fn in conf.SelectNodes("assembly"))
{
string targetName = System.IO.Path.Combine(outputfolder, s.Substring(sourcefolder.Length));
string csFile = System.IO.Path.ChangeExtension(s, ".cs");
bool isForm = System.IO.File.Exists(csFile);
if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(targetName)))
System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(targetName));
if (isForm)
System.IO.File.Copy(s, targetName, true); //Copy the updated resx
targetName = targetName.Substring(0, targetName.Length - "resx".Length) + culture + ".resx";
if (System.IO.File.Exists(targetName))
{
//TODO: Merge
}
else
foreach (string s in Duplicati.Library.Core.Utility.EnumerateFiles(System.IO.Path.Combine(sourcefolder, fn.Attributes["folder"].Value)))
{
if (isForm) //Form
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(targetName))
sw.Write(Properties.Resources.Empty_resx);
else
System.IO.File.Copy(s, targetName);
}
if (s.ToLower().StartsWith(Application.StartupPath.ToLower()))
continue;
System.Xml.XmlDocument doc2 = new System.Xml.XmlDocument();
doc2.Load(s);
foreach(System.Xml.XmlNode n in doc2.SelectNodes("root/data"))
if (n.Attributes["type"] != null && n.Attributes["type"].Value == "System.Resources.ResXFileRef, System.Windows.Forms")
if (s.EndsWith(".resx"))
{
string relname = n["value"].InnerText;
relname = relname.Substring(0, relname.IndexOf(";"));
string sourceRes = System.IO.Path.GetFullPath(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(s), relname));
string targetRes = System.IO.Path.GetFullPath(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(targetName), relname));
if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(targetRes)))
System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(targetRes));
string targetName = System.IO.Path.Combine(outputfolder, s.Substring(sourcefolder.Length));
string csFile = System.IO.Path.ChangeExtension(s, ".cs");
bool isForm = System.IO.File.Exists(csFile);
if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(targetName)))
System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(targetName));
if (isForm)
System.IO.File.Copy(s, targetName, true); //Copy the updated resx
targetName = targetName.Substring(0, targetName.Length - "resx".Length) + culture + ".resx";
if (System.IO.File.Exists(targetName))
{
//TODO: Merge
}
else
{
if (isForm) //Form
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(targetName))
sw.Write(Properties.Resources.Empty_resx);
else
System.IO.File.Copy(s, targetName);
}
System.Xml.XmlDocument doc2 = new System.Xml.XmlDocument();
doc2.Load(s);
foreach (System.Xml.XmlNode n in doc2.SelectNodes("root/data"))
if (n.Attributes["type"] != null && n.Attributes["type"].Value == "System.Resources.ResXFileRef, System.Windows.Forms")
{
string relname = n["value"].InnerText;
relname = relname.Substring(0, relname.IndexOf(";"));
string sourceRes = System.IO.Path.GetFullPath(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(s), relname));
string targetRes = System.IO.Path.GetFullPath(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(targetName), relname));
if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(targetRes)))
System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(targetRes));
if (!System.IO.File.Exists(targetRes))
System.IO.File.Copy(sourceRes, targetRes);
}
if (!System.IO.File.Exists(targetRes))
System.IO.File.Copy(sourceRes, targetRes);
}
}
}
}
@@ -194,41 +199,43 @@ namespace LocalizationTool
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(System.IO.Path.Combine(Application.StartupPath, "configuration.xml"));
string keyfile = doc.SelectSingleNode("root/keyfile").InnerText;
string versionassembly = doc.SelectSingleNode("root/versionassembly").InnerText;
string sourcefolder = doc.SelectSingleNode("root/sourcefolder").InnerText;
string outputfolder = doc.SelectSingleNode("root/outputfolder").InnerText;
string productname = doc.SelectSingleNode("root/productname").InnerText;
foreach (System.Xml.XmlNode n in doc.SelectNodes("root/assembly"))
foreach (System.Xml.XmlNode conf in doc.SelectNodes("root/configuration"))
{
List<string> excludes = new List<string>();
foreach (System.Xml.XmlNode x in n.SelectNodes("exclude"))
excludes.Add(x.InnerText);
string keyfile = conf["keyfile"].InnerText;
string versionassembly = conf["versionassembly"].InnerText;
string outputfolder = conf["outputfolder"].InnerText;
string productname = conf["productname"].InnerText;
string assemblyName = n.Attributes["name"].Value;
string folder = n.Attributes["folder"].Value;
string @namespace = n.Attributes["namespace"] == null ? assemblyName : n.Attributes["namespace"].Value;
foreach (string bf in System.IO.Directory.GetDirectories(Application.StartupPath))
foreach (System.Xml.XmlNode n in conf.SelectNodes("assembly"))
{
string culture = System.IO.Path.GetFileName(bf);
List<string> excludes = new List<string>();
foreach (System.Xml.XmlNode x in n.SelectNodes("exclude"))
excludes.Add(x.InnerText);
try
string assemblyName = n.Attributes["name"].Value;
string folder = n.Attributes["folder"].Value;
string @namespace = n.Attributes["namespace"] == null ? assemblyName : n.Attributes["namespace"].Value;
foreach (string bf in System.IO.Directory.GetDirectories(Application.StartupPath))
{
System.Globalization.CultureInfo.GetCultureInfo(culture);
}
catch
{
continue;
}
string culture = System.IO.Path.GetFileName(bf);
string outfolder = System.IO.Path.GetFullPath( System.IO.Path.Combine(outputfolder, culture));
if (!System.IO.Directory.Exists(outfolder))
System.IO.Directory.CreateDirectory(outfolder);
try
{
System.Globalization.CultureInfo.GetCultureInfo(culture);
}
catch
{
continue;
}
ResXCompiler.CompileResxFiles(System.IO.Path.Combine(bf, folder), excludes, @namespace, System.IO.Path.Combine(outfolder, assemblyName + ".resources.dll"), System.IO.Path.GetFullPath(versionassembly), keyfile, culture, productname);
string outfolder = System.IO.Path.GetFullPath(System.IO.Path.Combine(outputfolder, culture));
if (!System.IO.Directory.Exists(outfolder))
System.IO.Directory.CreateDirectory(outfolder);
ResXCompiler.CompileResxFiles(System.IO.Path.Combine(bf, folder), excludes, @namespace, System.IO.Path.Combine(outfolder, assemblyName + ".resources.dll"), System.IO.Path.GetFullPath(versionassembly), keyfile, culture, productname);
}
}
}
}
+2 -2
View File
@@ -114,9 +114,9 @@ namespace System.Windows.Forms.Wizard
_BackButton.Enabled = m_visited.Count > 0;
if (m_isLastPage)
_NextButton.Text = Strings.Dialog.NextButtonText;
else
_NextButton.Text = Strings.Dialog.FinishButtonText;
else
_NextButton.Text = Strings.Dialog.NextButtonText;
}
public virtual void UpdateDisplay()