diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGloss/HCSynthByGloss.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGloss/HCSynthByGloss.cs index 465f057d64..8d6cd40bcc 100644 --- a/Src/Utilities/HCSynthByGloss/HCSynthByGloss/HCSynthByGloss.cs +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGloss/HCSynthByGloss.cs @@ -19,6 +19,9 @@ using SIL.Machine.Translation; using SIL.HCSynthByGloss; using SIL.Utils; +using HCSynthByGlossLib; +using System.Globalization; +using System.Threading; namespace SIL.HCSynthByGloss { @@ -26,51 +29,62 @@ class HCSynthByGloss { static void Main(string[] args) { + const int iLocale = 0; + const int iArgH = 1; + const int iHcFile = 2; + const int iArgG = 3; + const int iGlossFile = 4; + const int iArgO = 5; + const int iOutputFile = 6; + const int iArgT = 7; + const int iArgS = 8; + bool doTracing = false; bool showTracing = false; int argCount = args.Count(); - if (argCount != 6 || args[0] != "-h" || args[2] != "-g" || args[4] != "-o") + if (argCount > 0 ) + { + Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(args[iLocale]); + } + if (argCount != 7 || args[iArgH] != "-h" || args[iArgG] != "-g" || args[iArgO] != "-o") { - if (argCount == 7 && args[6] == "-t") + if (argCount == 8 && args[iArgT] == "-t") { doTracing = true; } - else if (argCount == 8 && args[6] == "-t" && args[7] == "-s") + else if (argCount == 9 && args[iArgT] == "-t" && args[iArgS] == "-s") { doTracing = true; showTracing = true; } else { - Console.WriteLine("Usage:"); - Console.WriteLine( - "HCSynthByGloss -h HC.xml_file -g gloss_file -o output (-t (-s))" - ); - Console.WriteLine("\t-t = turn on tracing"); - Console.WriteLine( - "\t-s = show the tracing result in the system default web browser; -s is only valid when also using -t" - ); + Console.WriteLine(HCSynthByGlossStrings.ksUsage); + Console.WriteLine(HCSynthByGlossStrings.ksCommandLineUsage); + Console.WriteLine(HCSynthByGlossStrings.ksTurnOnTracing); + Console.WriteLine(HCSynthByGlossStrings.ksShowTracing); Environment.Exit(1); } } - if (!File.Exists(args[1])) + if (!File.Exists(args[iHcFile])) { - Console.WriteLine("Could not find file '" + args[1] + "'."); + Console.WriteLine(HCSynthByGlossStrings.ksCouldNotFindFile + args[iHcFile] + "'."); Environment.Exit(2); } - if (!File.Exists(args[3])) + if (!File.Exists(args[iGlossFile])) { - Console.WriteLine("Could not find file '" + args[3] + "'."); + Console.WriteLine(HCSynthByGlossStrings.ksCouldNotFindFile + args[iGlossFile] + "'."); Environment.Exit(3); } - var dll = new HCSynthByGlossDll(args[5]); - dll.SetHcXmlFile(args[1]); - dll.SetGlossFile(args[3]); + var dll = new HCSynthByGlossDll(args[iOutputFile]); + dll.LocaleCode = args[iLocale]; + dll.SetHcXmlFile(args[iHcFile]); + dll.SetGlossFile(args[iGlossFile]); dll.DoTracing = doTracing; dll.ShowTracing = showTracing; var result = dll.Process(); - Console.WriteLine("Processing result: " + result + "."); + Console.WriteLine(HCSynthByGlossStrings.ksProcessingResult + result + "."); } } } diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossDll/HCSynthByGlossDll.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGlossDll/HCSynthByGlossDll.cs index 6efb58d9f8..8fbfa0ba5d 100644 --- a/Src/Utilities/HCSynthByGloss/HCSynthByGlossDll/HCSynthByGlossDll.cs +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossDll/HCSynthByGlossDll.cs @@ -1,10 +1,14 @@ using HCSynthByGloss; +using HCSynthByGlossLib; +using Icu; using SIL.Machine.Morphology.HermitCrab; using SIL.Utils; using System; +using System.Globalization; using System.IO; using System.Reflection; using System.Text; +using System.Threading; using System.Xml.XPath; using System.Xml.Xsl; @@ -17,10 +21,11 @@ public class HCSynthByGlossDll public string HcXmlFile { get; set; } = ""; public string GlossFile { get; set; } = ""; public string OutputFile { get; set; } = ""; - public string kSuccess { get; } = "Success!"; - public string kError1 { get; } = "Could not find "; - public string kHCXmlFile { get; } = "HC XML file"; - public string kGlossFile { get; } = "Gloss file"; + public string LocaleCode { get; set; } = "en"; + public string kSuccess { get; } = HCSynthByGlossStrings.ksSuccess; + public string kError1 { get; } = HCSynthByGlossStrings.ksCouldNotFind; + public string kHCXmlFile { get; } = HCSynthByGlossStrings.ksHCXmlFile; + public string kGlossFile { get; } = HCSynthByGlossStrings.ksGlossFile; public string kError2 { get; } = " '"; public string kError3 { get; } = "'"; Language synLang; @@ -55,7 +60,7 @@ public string SetGlossFile(string value) public string Process() { - + Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(LocaleCode); if (!File.Exists(HcXmlFile)) { return kError1 + kHCXmlFile + kError2 + HcXmlFile + kError3; diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossDll/HCSynthByGlossDllTests/HCSynthByGlossDllTests.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGlossDll/HCSynthByGlossDllTests/HCSynthByGlossDllTests.cs index 4330afad34..d4a4fc8788 100644 --- a/Src/Utilities/HCSynthByGloss/HCSynthByGlossDll/HCSynthByGlossDllTests/HCSynthByGlossDllTests.cs +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossDll/HCSynthByGlossDllTests/HCSynthByGlossDllTests.cs @@ -81,8 +81,17 @@ public void ProcessTest() [Test] public void ProcessBadInputFilesTest() + { + CheckErrors("en"); + CheckErrors("es"); + CheckErrors("de"); + CheckErrors("fr"); + } + + private void CheckErrors(string localeCode) { dll = new HCSynthByGlossDll(tempFile); + dll.LocaleCode = localeCode; result = dll.Process(); Assert.AreEqual(dll.kError1 + dll.kHCXmlFile + dll.kError2 + "" + dll.kError3, result); result = dll.SetHcXmlFile(hcConfig); diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossLib.csproj b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossLib.csproj index 6389379d04..05f2134816 100644 --- a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossLib.csproj +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossLib.csproj @@ -46,4 +46,44 @@ Properties\CommonAssemblyInfo.cs + + + HCSynthByGlossStrings.de.resx + True + True + + + HCSynthByGlossStrings.fr.resx + True + True + + + HCSynthByGlossStrings.es.resx + True + True + + + True + True + HCSynthByGlossStrings.resx + + + + + HCSynthByGlossStrings.de.Designer.cs + PublicResXFileCodeGenerator + + + HCSynthByGlossStrings.fr.Designer.cs + PublicResXFileCodeGenerator + + + HCSynthByGlossStrings.es.Designer.cs + PublicResXFileCodeGenerator + + + PublicResXFileCodeGenerator + HCSynthByGlossStrings.Designer.cs + + \ No newline at end of file diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.Designer.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.Designer.cs new file mode 100644 index 0000000000..41187e51d5 --- /dev/null +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.Designer.cs @@ -0,0 +1,180 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace HCSynthByGlossLib { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class HCSynthByGlossStrings { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal HCSynthByGlossStrings() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HCSynthByGlossLib.HCSynthByGlossStrings", typeof(HCSynthByGlossStrings).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to HCSynthByGloss locale -h HC.xml_file -g gloss_file -o output (-t (-s)). + /// + public static string ksCommandLineUsage { + get { + return ResourceManager.GetString("ksCommandLineUsage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find . + /// + public static string ksCouldNotFind { + get { + return ResourceManager.GetString("ksCouldNotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find file '. + /// + public static string ksCouldNotFindFile { + get { + return ResourceManager.GetString("ksCouldNotFindFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Duplicate gloss(es) found for '. + /// + public static string ksDuplicateGlossFoundFor { + get { + return ResourceManager.GetString("ksDuplicateGlossFoundFor", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gloss file. + /// + public static string ksGlossFile { + get { + return ResourceManager.GetString("ksGlossFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to HC XML file. + /// + public static string ksHCXmlFile { + get { + return ResourceManager.GetString("ksHCXmlFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to One or more glosses not found:. + /// + public static string ksOneOrMoreGlossesNotFound { + get { + return ResourceManager.GetString("ksOneOrMoreGlossesNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Processing result: . + /// + public static string ksProcessingResult { + get { + return ResourceManager.GetString("ksProcessingResult", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to \t-s = show the tracing result in the system default web browser; -s is only valid when also using -t. + /// + public static string ksShowTracing { + get { + return ResourceManager.GetString("ksShowTracing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Success!. + /// + public static string ksSuccess { + get { + return ResourceManager.GetString("ksSuccess", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to synthesis may not work.. + /// + public static string ksSynthesisMayNotWork { + get { + return ResourceManager.GetString("ksSynthesisMayNotWork", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to \t-t = turn on tracing. + /// + public static string ksTurnOnTracing { + get { + return ResourceManager.GetString("ksTurnOnTracing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Usage:. + /// + public static string ksUsage { + get { + return ResourceManager.GetString("ksUsage", resourceCulture); + } + } + } +} diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.de.Designer.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.de.Designer.cs new file mode 100644 index 0000000000..c5050502d1 --- /dev/null +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.de.Designer.cs @@ -0,0 +1,180 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace HCSynthByGlossLib { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class HCSynthByGlossStrings___Copy__2_ { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal HCSynthByGlossStrings___Copy__2_() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HCSynthByGlossLib.HCSynthByGlossStrings - Copy (2)", typeof(HCSynthByGlossStrings___Copy__2_).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to HCSynthByGloss -h HC.xml_file -g gloss_file -o output (-t (-s)). + /// + public static string ksCommandLineUsage { + get { + return ResourceManager.GetString("ksCommandLineUsage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find . + /// + public static string ksCouldNotFind { + get { + return ResourceManager.GetString("ksCouldNotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find file '. + /// + public static string ksCouldNotFindFile { + get { + return ResourceManager.GetString("ksCouldNotFindFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Duplicate gloss(es) found for '. + /// + public static string ksDuplicateGlossFoundFor { + get { + return ResourceManager.GetString("ksDuplicateGlossFoundFor", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gloss file. + /// + public static string ksGlossFile { + get { + return ResourceManager.GetString("ksGlossFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to HC XML file. + /// + public static string ksHCXmlFile { + get { + return ResourceManager.GetString("ksHCXmlFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to One or more glosses not found: . + /// + public static string ksOneOrMoreGlossesNotFound { + get { + return ResourceManager.GetString("ksOneOrMoreGlossesNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Processing result: . + /// + public static string ksProcessingResult { + get { + return ResourceManager.GetString("ksProcessingResult", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to \t-s = show the tracing result in the system default web browser; -s is only valid when also using -t. + /// + public static string ksShowTracing { + get { + return ResourceManager.GetString("ksShowTracing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Success!. + /// + public static string ksSuccess { + get { + return ResourceManager.GetString("ksSuccess", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to synthesis may not work.. + /// + public static string ksSynthesisMayNotWork { + get { + return ResourceManager.GetString("ksSynthesisMayNotWork", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to \t-t = turn on tracing. + /// + public static string ksTurnOnTracing { + get { + return ResourceManager.GetString("ksTurnOnTracing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Usage:. + /// + public static string ksUsage { + get { + return ResourceManager.GetString("ksUsage", resourceCulture); + } + } + } +} diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.de.resx b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.de.resx new file mode 100644 index 0000000000..6aa43fe4d5 --- /dev/null +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.de.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + HCSynthByGloss Ländereinstellung -h HC.xml_Archiv -g Glossar -o Ausgabe(-t (-s)) + + + Konnte nicht gefunden werden + + + Die Datei ' + + + Es wurden doppelte Einträge für ' gefunden + + + Glossar + + + HC XML Archiv + + + Eine oder mehrere Erläuterungen wurden nicht gefunden: + + + Verarbeitungsergebnis: + + + \t-s = Zeigt das Tracing-Ergebnis im standardmäßigen Webbrowser des Systems an; -s ist nur gültig, wenn auch -t verwendet wird + + + Geschafft! + + + die Synthese funktioniert möglicherweise nicht. + + + \t-t = Tracing aktivieren + + + Verwendung: + + \ No newline at end of file diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.es.Designer.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.es.Designer.cs new file mode 100644 index 0000000000..3836ca4ee2 --- /dev/null +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.es.Designer.cs @@ -0,0 +1,180 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace HCSynthByGlossLib { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class HCSynthByGlossStrings_es { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal HCSynthByGlossStrings_es() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HCSynthByGlossLib.HCSynthByGlossStrings_es", typeof(HCSynthByGlossStrings_es).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to HCSynthByGloss -h HC.xml_file -g gloss_file -o output (-t (-s)). + /// + public static string ksCommandLineUsage { + get { + return ResourceManager.GetString("ksCommandLineUsage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find . + /// + public static string ksCouldNotFind { + get { + return ResourceManager.GetString("ksCouldNotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find file '. + /// + public static string ksCouldNotFindFile { + get { + return ResourceManager.GetString("ksCouldNotFindFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Duplicate gloss(es) found for '. + /// + public static string ksDuplicateGlossFoundFor { + get { + return ResourceManager.GetString("ksDuplicateGlossFoundFor", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gloss file. + /// + public static string ksGlossFile { + get { + return ResourceManager.GetString("ksGlossFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to HC XML file. + /// + public static string ksHCXmlFile { + get { + return ResourceManager.GetString("ksHCXmlFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to One or more glosses not found: . + /// + public static string ksOneOrMoreGlossesNotFound { + get { + return ResourceManager.GetString("ksOneOrMoreGlossesNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Processing result: . + /// + public static string ksProcessingResult { + get { + return ResourceManager.GetString("ksProcessingResult", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to \t-s = show the tracing result in the system default web browser; -s is only valid when also using -t. + /// + public static string ksShowTracing { + get { + return ResourceManager.GetString("ksShowTracing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Success!. + /// + public static string ksSuccess { + get { + return ResourceManager.GetString("ksSuccess", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to synthesis may not work.. + /// + public static string ksSynthesisMayNotWork { + get { + return ResourceManager.GetString("ksSynthesisMayNotWork", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to \t-t = turn on tracing. + /// + public static string ksTurnOnTracing { + get { + return ResourceManager.GetString("ksTurnOnTracing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Usage:. + /// + public static string ksUsage { + get { + return ResourceManager.GetString("ksUsage", resourceCulture); + } + } + } +} diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.es.resx b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.es.resx new file mode 100644 index 0000000000..372806e5a2 --- /dev/null +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.es.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + HCSynthByGloss configuración_regional -h HC.xml_archivo -g archivo_de_glosas -o resultado (-t (-s)) + + + No se ha encontrado + + + No se ha encontrado el archivo ' + + + Se han encontrado entradas de glosario duplicadas para ' + + + Archivo de glosas + + + Archivo XML de HC + + + No se han encontrado una o varias glosas: + + + Resultado del procesamiento: + + + \t-s = muestra el resultado del seguimiento en el navegador web predeterminado del sistema; la opción -s solo es válida si también se utiliza la opción -t + + + ¡Éxito! + + + es posible que la síntesis no funcione. + + + \t-t = activar el trazado + + + Uso: + + \ No newline at end of file diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.fr.Designer.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.fr.Designer.cs new file mode 100644 index 0000000000..beb6928a00 --- /dev/null +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.fr.Designer.cs @@ -0,0 +1,180 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace HCSynthByGlossLib { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class HCSynthByGlossStrings___Copy__3_ { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal HCSynthByGlossStrings___Copy__3_() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HCSynthByGlossLib.HCSynthByGlossStrings - Copy (3)", typeof(HCSynthByGlossStrings___Copy__3_).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to HCSynthByGloss -h HC.xml_file -g gloss_file -o output (-t (-s)). + /// + public static string ksCommandLineUsage { + get { + return ResourceManager.GetString("ksCommandLineUsage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find . + /// + public static string ksCouldNotFind { + get { + return ResourceManager.GetString("ksCouldNotFind", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Could not find file '. + /// + public static string ksCouldNotFindFile { + get { + return ResourceManager.GetString("ksCouldNotFindFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Duplicate gloss(es) found for '. + /// + public static string ksDuplicateGlossFoundFor { + get { + return ResourceManager.GetString("ksDuplicateGlossFoundFor", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Gloss file. + /// + public static string ksGlossFile { + get { + return ResourceManager.GetString("ksGlossFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to HC XML file. + /// + public static string ksHCXmlFile { + get { + return ResourceManager.GetString("ksHCXmlFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to One or more glosses not found: . + /// + public static string ksOneOrMoreGlossesNotFound { + get { + return ResourceManager.GetString("ksOneOrMoreGlossesNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Processing result: . + /// + public static string ksProcessingResult { + get { + return ResourceManager.GetString("ksProcessingResult", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to \t-s = show the tracing result in the system default web browser; -s is only valid when also using -t. + /// + public static string ksShowTracing { + get { + return ResourceManager.GetString("ksShowTracing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Success!. + /// + public static string ksSuccess { + get { + return ResourceManager.GetString("ksSuccess", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to synthesis may not work.. + /// + public static string ksSynthesisMayNotWork { + get { + return ResourceManager.GetString("ksSynthesisMayNotWork", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to \t-t = turn on tracing. + /// + public static string ksTurnOnTracing { + get { + return ResourceManager.GetString("ksTurnOnTracing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Usage:. + /// + public static string ksUsage { + get { + return ResourceManager.GetString("ksUsage", resourceCulture); + } + } + } +} diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.fr.resx b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.fr.resx new file mode 100644 index 0000000000..7302505d55 --- /dev/null +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.fr.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + HCSynthByGloss paramètres_régionaux -h HC.xml_fichier -g fichier_de_glossaire -o résultat (-t (-s)) + + + Impossible de trouver + + + Fichier introuvable ' + + + Des entrées de glossaire en double ont été trouvées pour ' + + + Fichier de glossaire + + + Fichier de HC XML + + + Une ou plusieurs gloses introuvables : + + + Résultat du traitement : + + + \t-s = affiche le résultat du traçage dans le navigateur Web par défaut du système ; l'option -s n'est valable que si l'option -t est également utilisée + + + C'est réussi ! + + + la synthèse pourrait ne pas fonctionner. + + + \t-t = activer le traçage + + + Utilisation : + + \ No newline at end of file diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.resx b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.resx new file mode 100644 index 0000000000..775ddfa0cb --- /dev/null +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HCSynthByGlossStrings.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + HCSynthByGloss locale -h HC.xml_file -g gloss_file -o output (-t (-s)) + + + Could not find + + + Could not find file ' + + + Duplicate gloss(es) found for ' + + + Gloss file + + + HC XML file + + + One or more glosses not found: + + + Processing result: + + + \t-s = show the tracing result in the system default web browser; -s is only valid when also using -t + + + Success! + + + synthesis may not work. + + + \t-t = turn on tracing + + + Usage: + + \ No newline at end of file diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HcXmlTraceManager.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HcXmlTraceManager.cs index 23bd823829..35d5492751 100644 --- a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HcXmlTraceManager.cs +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/HcXmlTraceManager.cs @@ -737,53 +737,6 @@ private XElement CreateAllomorphElement(Allomorph allomorph) new XElement("Gloss", allomorph.Morpheme.Gloss), new XElement("Category", cat) ); - - //bool isNull = (bool?)allomorph.Properties[IsNull] ?? false; - //if (isNull) - //{ - // var slotID = (int)allomorph.Morpheme.Properties[SlotID]; - // //IMoInflAffixSlot slot; - // //if (!m_cache.ServiceLocator.GetInstance().TryGetObject(slotID, out slot)) - // // return null; - - // var nullInflTypeID = (int)allomorph.Morpheme.Properties[InflTypeID]; - // //ILexEntryInflType nullInflType; - // //if (!m_cache.ServiceLocator.GetInstance().TryGetObject(nullInflTypeID, out nullInflType)) - // // return null; - - // //var isPrefix = (bool)allomorph.Properties[IsPrefix]; - // //return new XElement("Allomorph", new XAttribute("id", 0), new XAttribute("type", isPrefix ? MoMorphTypeTags.kMorphPrefix : MoMorphTypeTags.kMorphSuffix), - // // new XElement("Form", "^0"), - // // new XElement("Morpheme", new XAttribute("id", 0), new XAttribute("type", "infl"), - // // new XElement("HeadWord", string.Format("Automatically generated null affix for the {0} irregularly inflected form", nullInflType.Name.BestAnalysisAlternative.Text)), - // // new XElement("Gloss", (nullInflType.GlossPrepend.BestAnalysisAlternative.Text == "***" ? "" : nullInflType.GlossPrepend.BestAnalysisAlternative.Text) - // // + (nullInflType.GlossAppend.BestAnalysisAlternative.Text == "***" ? "" : nullInflType.GlossAppend.BestAnalysisAlternative.Text)), - // // new XElement("Category", slot.OwnerOfClass().Abbreviation.BestAnalysisAlternative.Text), - // // new XElement("Slot", new XAttribute("optional", slot.Optional), slot.Name.BestAnalysisAlternative.Text))); - //} - - //var formID = allomorph.Properties[FormID]; - - ////var formID = (int?)allomorph.Properties[FormID] ?? 0; - ////IMoForm form; - ////if (formID == 0 || !m_cache.ServiceLocator.GetInstance().TryGetObject(formID, out form)) - //// return null; - //var formID2 = allomorph.Properties[FormID2]; - ////var formID2 = (int?)allomorph.Properties[FormID2] ?? 0; - - //var msaID = allomorph.Morpheme.Properties[MsaID]; - ////IMoMorphSynAnalysis msa; - ////if (!m_cache.ServiceLocator.GetInstance().TryGetObject(msaID, out msa)) - //// return null; - - //var inflTypeID = allomorph.Morpheme.Properties[InflTypeID]; - ////var inflTypeID = (int?)allomorph.Morpheme.Properties[InflTypeID] ?? 0; - ////ILexEntryInflType inflType = null; - ////if (inflTypeID != 0 && !m_cache.ServiceLocator.GetInstance().TryGetObject(inflTypeID, out inflType)) - //// return null; - - ////return CreateAllomorphElement("Allomorph", form, msa, inflType, formID2 != 0); - //return new XElement("sumpn"); } void ITraceManager.CompoundingRuleNotUnapplied(IMorphologicalRule rule, int subruleIndex, Word input, FailureReason reason, object failureObj) diff --git a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/Synthesizer.cs b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/Synthesizer.cs index 66a9ebd1ad..1b150f5465 100644 --- a/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/Synthesizer.cs +++ b/Src/Utilities/HCSynthByGloss/HCSynthByGlossLib/Synthesizer.cs @@ -2,6 +2,7 @@ // This software is licensed under the LGPL, version 2.1 or later // (http://www.gnu.org/licenses/lgpl-2.1.html) +using HCSynthByGlossLib; using SIL.Machine.FeatureModel; using SIL.Machine.Morphology; using SIL.Machine.Morphology.HermitCrab; @@ -127,7 +128,7 @@ private void CollectMissingGlosses( List morphemes ) { - sb.Append(" One or more glosses not found:"); + sb.Append(HCSynthByGlossStrings.ksOneOrMoreGlossesNotFound); var glossesFound = new List(); foreach (Morpheme morpheme in morphemes) { @@ -173,7 +174,7 @@ private bool CheckForDuplicates(Morpher morpher, StringBuilder sb, List