diff --git a/README.md b/README.md index 69e6ab4..f23b79d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Romanization.NET [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://choosealicense.com/licenses/mit/) -[![Build Status](https://img.shields.io/travis/zedseven/Romanization.net/dev?logo=travis-ci&logoColor=white)](https://travis-ci.org/zedseven/Romanization.NET) +[![Build Status](https://img.shields.io/travis/zedseven/Romanization.NET/dev?logo=travis-ci&logoColor=white)](https://travis-ci.org/zedseven/Romanization.NET) [![NuGet](https://img.shields.io/nuget/v/Romanization.NET.svg?logo=nuget)](https://www.nuget.org/packages/Romanization.NET/) [![# Issues](https://img.shields.io/github/issues/zedseven/Romanization.NET?logo=github)](https://github.com/zedseven/Romanization.NET/issues) [![Maintainability](https://img.shields.io/codeclimate/maintainability/zedseven/Romanization.NET?logo=code-climate)](https://codeclimate.com/github/zedseven/Romanization.NET/maintainability) diff --git a/Romanization/Internal/CaseAwareSub.cs b/Romanization/Internal/CaseAwareSub.cs index 7765c0f..fab4134 100644 --- a/Romanization/Internal/CaseAwareSub.cs +++ b/Romanization/Internal/CaseAwareSub.cs @@ -21,14 +21,14 @@ internal class CaseAwareSub : ISub public CaseAwareSub(string pattern, string dynamicReplacement, bool countCapturesInCasing = false) { - _findRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase); + _findRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase); _dynamicReplacement = new DynamicReplacement(dynamicReplacement); _countCapturesInCasing = countCapturesInCasing; } public CaseAwareSub(string pattern, string dynamicReplacement, RegexOptions options, bool countCapturesInCasing = false) { - _findRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | options); + _findRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | options); _dynamicReplacement = new DynamicReplacement(dynamicReplacement); _countCapturesInCasing = countCapturesInCasing; } diff --git a/Romanization/Internal/CharSub.cs b/Romanization/Internal/CharSub.cs index 77a64ca..7a6eedd 100644 --- a/Romanization/Internal/CharSub.cs +++ b/Romanization/Internal/CharSub.cs @@ -9,13 +9,13 @@ internal class CharSub : ISub public CharSub(string pattern, string substitution, bool ignoreCase = true) { - _findRegex = new Regex(pattern, ignoreCase ? RegexOptions.Compiled | RegexOptions.IgnoreCase : RegexOptions.Compiled); + _findRegex = new Regex(pattern, ignoreCase ? RegexOptions.Compiled | RegexOptions.IgnoreCase : RegexOptions.Compiled); _substitution = substitution; } public CharSub(string pattern, string substitution, RegexOptions options) { - _findRegex = new Regex(pattern, RegexOptions.Compiled | options); + _findRegex = new Regex(pattern, RegexOptions.Compiled | options); _substitution = substitution; } diff --git a/Romanization/Internal/CharSubCased.cs b/Romanization/Internal/CharSubCased.cs index 31e0042..72ab7bd 100644 --- a/Romanization/Internal/CharSubCased.cs +++ b/Romanization/Internal/CharSubCased.cs @@ -11,16 +11,16 @@ internal class CharSubCased : ISub public CharSubCased(string patternUpper, string patternLower, string substitutionUpper, string substitutionLower) { - _findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled); - _findRegexLower = new Regex(patternLower, RegexOptions.Compiled); + _findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled); + _findRegexLower = new Regex(patternLower, RegexOptions.Compiled); _substitutionUpper = substitutionUpper; _substitutionLower = substitutionLower; } public CharSubCased(string patternUpper, string patternLower, string substitutionUpper, string substitutionLower, RegexOptions options) { - _findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled | options); - _findRegexLower = new Regex(patternLower, RegexOptions.Compiled | options); + _findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled | options); + _findRegexLower = new Regex(patternLower, RegexOptions.Compiled | options); _substitutionUpper = substitutionUpper; _substitutionLower = substitutionLower; } diff --git a/Romanization/Internal/Constants.cs b/Romanization/Internal/Constants.cs index dfd3f64..de75e4b 100644 --- a/Romanization/Internal/Constants.cs +++ b/Romanization/Internal/Constants.cs @@ -15,11 +15,11 @@ internal static class Constants public static readonly string AssemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); // General Constants - public const string LatinVowels = "aeiouy"; - public const string LatinConsonants = "bcdfghjklmnpqrstvwxz"; - public const string Punctuation = @"\.?!"; + public const string LatinVowels = "aeiouy"; + public const string LatinConsonants = "bcdfghjklmnpqrstvwxz"; + public const string Punctuation = @"\.?!"; public const char IdeographicFullStop = '。'; - public const char Interpunct = '・'; + public const char Interpunct = '・'; // Replacement Characters public const string MacronA = "ā"; diff --git a/Romanization/Internal/CsvLoader.cs b/Romanization/Internal/CsvLoader.cs index b734a3e..3db13c5 100644 --- a/Romanization/Internal/CsvLoader.cs +++ b/Romanization/Internal/CsvLoader.cs @@ -34,7 +34,9 @@ public static void LoadCharacterMap(string fileName, IDictionary - /// Loads a CSV file stream into a dictionary, using the provided mapping functions to map CSV entries to dict keys & values. + /// Loads a CSV file stream into a dictionary, using the provided mapping functions to map CSV entries to dict + /// keys & values.
+ /// Note that this is a non-standard CSV parsing implementation - it only looks for the first comma. /// /// The type of the dictionary keys. /// The type of the dictionary values. diff --git a/Romanization/Internal/NumeralRenderer.cs b/Romanization/Internal/NumeralRenderer.cs index 88ca2de..fb1b5c1 100644 --- a/Romanization/Internal/NumeralRenderer.cs +++ b/Romanization/Internal/NumeralRenderer.cs @@ -36,8 +36,8 @@ public static string ToRomanNumerals(this decimal num) { 100, 'C' }, { 50, 'L' }, { 10, 'X' }, - { 5, 'V' }, - { 1, 'I' } + { 5, 'V' }, + { 1, 'I' } }; Dictionary subtractiveSteps = new Dictionary { @@ -46,7 +46,7 @@ public static string ToRomanNumerals(this decimal num) { 100, 10 }, { 50, 10 }, { 10, 1 }, - { 5, 1 } + { 5, 1 } }; Dictionary fractionRepresentations = new Dictionary { diff --git a/Romanization/Languages/Greek/Ancient/AlaLc.cs b/Romanization/Languages/Greek/Ancient/AlaLc.cs index 000bed6..af2cc8a 100644 --- a/Romanization/Languages/Greek/Ancient/AlaLc.cs +++ b/Romanization/Languages/Greek/Ancient/AlaLc.cs @@ -52,10 +52,10 @@ public sealed class AlaLc : IMultiInOutCultureSystem private readonly INumeralParsingSystem NumeralsSystem; // System-Specific Constants - private readonly Dictionary RomanizationTable = new Dictionary(); - private readonly Dictionary DiphthongTable = new Dictionary(); + private readonly Dictionary RomanizationTable = new Dictionary(); + private readonly Dictionary DiphthongTable = new Dictionary(); private readonly Dictionary SpecificCombinationTable = new Dictionary(); - private readonly Dictionary PunctuationTable = new Dictionary(); + private readonly Dictionary PunctuationTable = new Dictionary(); private readonly CaseAwareSub RhoAspiratedSub = new CaseAwareSub("(?:\\bρ|(?<=ρ)ρ(?!\\b|ρ))", "rh"); @@ -81,32 +81,32 @@ public AlaLc(OutputNumeralType outputNumeralType = OutputNumeralType.Roman, bool // Sourced from https://en.wikipedia.org/wiki/Romanization_of_Greek // Main characters (2021) - RomanizationTable["α"] = "a"; - RomanizationTable["β"] = "b"; - RomanizationTable["γ"] = "g"; // has special provisions - RomanizationTable["δ"] = "d"; - RomanizationTable["ε"] = "e"; - RomanizationTable["ζ"] = "z"; - RomanizationTable["η"] = "ē"; - RomanizationTable["θ"] = "th"; - RomanizationTable["ι"] = "i"; - RomanizationTable["κ"] = "k"; - RomanizationTable["λ"] = "l"; - RomanizationTable["μ"] = "m"; - RomanizationTable["ν"] = "n"; - RomanizationTable["ξ"] = "x"; - RomanizationTable["ο"] = "o"; - RomanizationTable["π"] = "p"; + RomanizationTable["α"] = "a"; + RomanizationTable["β"] = "b"; + RomanizationTable["γ"] = "g"; // has special provisions + RomanizationTable["δ"] = "d"; + RomanizationTable["ε"] = "e"; + RomanizationTable["ζ"] = "z"; + RomanizationTable["η"] = "ē"; + RomanizationTable["θ"] = "th"; + RomanizationTable["ι"] = "i"; + RomanizationTable["κ"] = "k"; + RomanizationTable["λ"] = "l"; + RomanizationTable["μ"] = "m"; + RomanizationTable["ν"] = "n"; + RomanizationTable["ξ"] = "x"; + RomanizationTable["ο"] = "o"; + RomanizationTable["π"] = "p"; RomanizationTable["ρ\u0314"] = "rh"; - RomanizationTable["ρ"] = "r"; // has special provisions - RomanizationTable["σ"] = "s"; - RomanizationTable["ς"] = "s"; - RomanizationTable["τ"] = "t"; - RomanizationTable["υ"] = "y"; // has special provisions - RomanizationTable["φ"] = "ph"; - RomanizationTable["χ"] = "ch"; - RomanizationTable["ψ"] = "ps"; - RomanizationTable["ω"] = "ō"; + RomanizationTable["ρ"] = "r"; // has special provisions + RomanizationTable["σ"] = "s"; + RomanizationTable["ς"] = "s"; + RomanizationTable["τ"] = "t"; + RomanizationTable["υ"] = "y"; // has special provisions + RomanizationTable["φ"] = "ph"; + RomanizationTable["χ"] = "ch"; + RomanizationTable["ψ"] = "ps"; + RomanizationTable["ω"] = "ō"; DiphthongTable["αι"] = "ae"; DiphthongTable["ει"] = "ei"; @@ -129,27 +129,27 @@ public AlaLc(OutputNumeralType outputNumeralType = OutputNumeralType.Roman, bool RomanizationTable["ͷ"] = "w"; // Digamma RomanizationTable["ϙ"] = "ḳ"; // Koppa RomanizationTable["ϟ"] = "ḳ"; // Koppa - RomanizationTable["ϡ"] = ""; // Sampi - RomanizationTable["ͳ"] = ""; // Sampi - RomanizationTable["ϻ"] = ""; // San + RomanizationTable["ϡ"] = ""; // Sampi + RomanizationTable["ͳ"] = ""; // Sampi + RomanizationTable["ϻ"] = ""; // San RomanizationTable["Ϲ"] = "s"; // Lunate sigma RomanizationTable["ϲ"] = "s"; // Lunate sigma - RomanizationTable["ϳ"] = ""; // Yot + RomanizationTable["ϳ"] = ""; // Yot // Punctuation if (VeryOld) { - PunctuationTable["."] = ","; // Low dot (in ancient Greek this acted as a short breath, or comma) - PunctuationTable["·"] = ";"; // Mid dot (in ancient Greek this acted as a long breath, or semicolon) + PunctuationTable["."] = ","; // Low dot (in ancient Greek this acted as a short breath, or comma) + PunctuationTable["·"] = ";"; // Mid dot (in ancient Greek this acted as a long breath, or semicolon) PunctuationTable["\u0387"] = ";"; // Distinct from above but visually the same PunctuationTable["\u02D9"] = "."; // High dot (in ancient Greek this acted as a full stop) PunctuationTable["\u205A"] = "."; // In ancient texts the Greek two-dot punctuation mark (looks like a colon) served as the full stop PunctuationTable["\u203F"] = "-"; // Papyrological hyphen PunctuationTable["\u035C"] = "-"; // Papyrological hyphen } - PunctuationTable[";"] = "?"; + PunctuationTable[";"] = "?"; PunctuationTable["\u037E"] = "?"; // Distinct from above but visually the same - PunctuationTable["’"] = "h"; // Sometimes used as an aspiration mark + PunctuationTable["’"] = "h"; // Sometimes used as an aspiration mark #endregion } @@ -181,8 +181,8 @@ public string Process(string text, CultureInfo nativeCulture, CultureInfo romani "\u0301\u0341" + // Acute accent "\u0313\u0343" + // Smooth breathing/koronis "\u0303\u0342" + // Tilde - "\u0311" + // Inverted breve - "\u0345") // Iota subscript + "\u0311" + // Inverted breve + "\u0345") // Iota subscript .ReplaceFromChartWithSameCase(PunctuationTable); // Convert numerals diff --git a/Romanization/Languages/Greek/Ancient/AtticNumerals.cs b/Romanization/Languages/Greek/Ancient/AtticNumerals.cs index e5976c2..acb2e3c 100644 --- a/Romanization/Languages/Greek/Ancient/AtticNumerals.cs +++ b/Romanization/Languages/Greek/Ancient/AtticNumerals.cs @@ -35,10 +35,10 @@ public sealed class AtticNumerals : INumeralParsingSystem private readonly string[] PlethraSymbols = { "𐅘" }; private readonly string[] TalentsSymbols = { "𐅺", "𐅈", "𐅉", "𐅊", "𐅋", "𐅌", "𐅍", "𐅎" }; private readonly string[] StatersSymbols = { "𐅏", "𐅐", "𐅑", "𐅒", "𐅓", "𐅔", "𐅕", "𐅖" }; - private readonly string[] MnasSymbols = { "𐅳", "𐅗", "𐅴" }; - private readonly string[] YearSymbols = { "𐅹", "𐆌" }; + private readonly string[] MnasSymbols = { "𐅳", "𐅗", "𐅴" }; + private readonly string[] YearSymbols = { "𐅹", "𐆌" }; private readonly string[] WeightSymbols = { "𐆎" }; - private readonly string[] TimeSymbols = { "𐆍" }; + private readonly string[] TimeSymbols = { "𐆍" }; private readonly Regex NumeralDetectionRegex = new Regex( @@ -56,75 +56,75 @@ public AtticNumerals() // Comments are if there's a specific unit associated with the symbol, and names in brackets are // the region(?) in which the symbol was used - ValueTable["𐆊"] = 0; - ValueTable["𐅼"] = (decimal) 1/6; // Drachma/Obol - ValueTable["𐅀"] = (decimal) 1/4; - ValueTable["𐆋"] = (decimal) 1/4; - ValueTable["𐅽"] = (decimal) 2/6; // Drachma/Obol - ValueTable["𐅁"] = (decimal) 1/2; - ValueTable["𐅵"] = (decimal) 1/2; - ValueTable["𐅶"] = (decimal) 1/2; - ValueTable["𐅾"] = (decimal) 3/6; // Drachma/Obol + ValueTable["𐆊"] = 0; + ValueTable["𐅼"] = (decimal) 1/6; // Drachma/Obol + ValueTable["𐅀"] = (decimal) 1/4; + ValueTable["𐆋"] = (decimal) 1/4; + ValueTable["𐅽"] = (decimal) 2/6; // Drachma/Obol + ValueTable["𐅁"] = (decimal) 1/2; + ValueTable["𐅵"] = (decimal) 1/2; + ValueTable["𐅶"] = (decimal) 1/2; + ValueTable["𐅾"] = (decimal) 3/6; // Drachma/Obol ValueTable["𐅷"] = (decimal) 2/3; - ValueTable["𐅿"] = (decimal) 4/6; // Drachma/Obol - ValueTable["𐅸"] = (decimal) 3/4; - ValueTable["𐆀"] = (decimal) 5/6; // Drachma/Obol - ValueTable["Ι"] = 1; - ValueTable["𐅂"] = 1; // Drachma - ValueTable["𐅘"] = 1; // Plethron - ValueTable["𐅙"] = 1; // (Thespian) - ValueTable["𐅚"] = 1; // (Hermionian) - ValueTable["𐅛"] = 2; // (Epidaurean) - ValueTable["𐅜"] = 2; // (Thespian) - ValueTable["𐅝"] = 2; // Drachma (Cyrenaic) - ValueTable["𐅞"] = 2; // Drachma (Epidaurean) - ValueTable["Π"] = 5; - ValueTable["𐅈"] = 5; // Talents - ValueTable["𐅏"] = 5; // Staters - ValueTable["𐅟"] = 5; // (Troezenian) - ValueTable["𐅳"] = 5; // Mnas (Delphic) - ValueTable["Δ"] = 10; - ValueTable["𐅉"] = 10; // Talents - ValueTable["𐅐"] = 10; // Staters - ValueTable["𐅗"] = 10; // Mnas - ValueTable["𐅠"] = 10; // (Troezenian) - ValueTable["𐅡"] = 10; // (Troezenian) - ValueTable["𐅢"] = 10; // (Hermionian) - ValueTable["𐅣"] = 10; // (Messenian) - ValueTable["𐅤"] = 10; // (Thespian) - ValueTable["𐅥"] = 30; // (Thespian) - ValueTable["𐅄"] = 50; - ValueTable["𐅊"] = 50; // Talents - ValueTable["𐅑"] = 50; // Staters - ValueTable["𐅦"] = 50; // (Troezenian) - ValueTable["𐅧"] = 50; // (Troezenian) - ValueTable["𐅨"] = 50; // (Hermionian) - ValueTable["𐅩"] = 50; // (Thespian) - ValueTable["𐅴"] = 50; // Mnas (Stratian) - ValueTable["Η"] = 100; - ValueTable["𐅋"] = 100; // Talents - ValueTable["𐅒"] = 100; // Staters - ValueTable["𐅪"] = 100; // (Thespian) - ValueTable["𐅫"] = 300; // (Thespian) - ValueTable["𐅅"] = 500; - ValueTable["𐅌"] = 500; // Talents - ValueTable["𐅓"] = 500; // Staters - ValueTable["𐅬"] = 500; // (Epidaurean) - ValueTable["𐅭"] = 500; // (Troezenian) - ValueTable["𐅮"] = 500; // (Thespian) - ValueTable["𐅯"] = 500; // (Carystian) - ValueTable["𐅰"] = 500; // (Naxian) - ValueTable["Χ"] = 1000; - ValueTable["𐅍"] = 1000; // Talents - ValueTable["𐅔"] = 1000; // Staters - ValueTable["𐅱"] = 1000; // (Thespian) - ValueTable["𐅆"] = 5000; - ValueTable["𐅎"] = 5000; // Talents - ValueTable["𐅲"] = 5000; // (Thespian) - ValueTable["Μ"] = 10000; - ValueTable["𐅕"] = 10000; // Staters - ValueTable["𐅇"] = 50000; - ValueTable["𐅖"] = 50000; // Staters + ValueTable["𐅿"] = (decimal) 4/6; // Drachma/Obol + ValueTable["𐅸"] = (decimal) 3/4; + ValueTable["𐆀"] = (decimal) 5/6; // Drachma/Obol + ValueTable["Ι"] = 1; + ValueTable["𐅂"] = 1; // Drachma + ValueTable["𐅘"] = 1; // Plethron + ValueTable["𐅙"] = 1; // (Thespian) + ValueTable["𐅚"] = 1; // (Hermionian) + ValueTable["𐅛"] = 2; // (Epidaurean) + ValueTable["𐅜"] = 2; // (Thespian) + ValueTable["𐅝"] = 2; // Drachma (Cyrenaic) + ValueTable["𐅞"] = 2; // Drachma (Epidaurean) + ValueTable["Π"] = 5; + ValueTable["𐅈"] = 5; // Talents + ValueTable["𐅏"] = 5; // Staters + ValueTable["𐅟"] = 5; // (Troezenian) + ValueTable["𐅳"] = 5; // Mnas (Delphic) + ValueTable["Δ"] = 10; + ValueTable["𐅉"] = 10; // Talents + ValueTable["𐅐"] = 10; // Staters + ValueTable["𐅗"] = 10; // Mnas + ValueTable["𐅠"] = 10; // (Troezenian) + ValueTable["𐅡"] = 10; // (Troezenian) + ValueTable["𐅢"] = 10; // (Hermionian) + ValueTable["𐅣"] = 10; // (Messenian) + ValueTable["𐅤"] = 10; // (Thespian) + ValueTable["𐅥"] = 30; // (Thespian) + ValueTable["𐅄"] = 50; + ValueTable["𐅊"] = 50; // Talents + ValueTable["𐅑"] = 50; // Staters + ValueTable["𐅦"] = 50; // (Troezenian) + ValueTable["𐅧"] = 50; // (Troezenian) + ValueTable["𐅨"] = 50; // (Hermionian) + ValueTable["𐅩"] = 50; // (Thespian) + ValueTable["𐅴"] = 50; // Mnas (Stratian) + ValueTable["Η"] = 100; + ValueTable["𐅋"] = 100; // Talents + ValueTable["𐅒"] = 100; // Staters + ValueTable["𐅪"] = 100; // (Thespian) + ValueTable["𐅫"] = 300; // (Thespian) + ValueTable["𐅅"] = 500; + ValueTable["𐅌"] = 500; // Talents + ValueTable["𐅓"] = 500; // Staters + ValueTable["𐅬"] = 500; // (Epidaurean) + ValueTable["𐅭"] = 500; // (Troezenian) + ValueTable["𐅮"] = 500; // (Thespian) + ValueTable["𐅯"] = 500; // (Carystian) + ValueTable["𐅰"] = 500; // (Naxian) + ValueTable["Χ"] = 1000; + ValueTable["𐅍"] = 1000; // Talents + ValueTable["𐅔"] = 1000; // Staters + ValueTable["𐅱"] = 1000; // (Thespian) + ValueTable["𐅆"] = 5000; + ValueTable["𐅎"] = 5000; // Talents + ValueTable["𐅲"] = 5000; // (Thespian) + ValueTable["Μ"] = 10000; + ValueTable["𐅕"] = 10000; // Staters + ValueTable["𐅇"] = 50000; + ValueTable["𐅖"] = 50000; // Staters #endregion } @@ -147,10 +147,10 @@ public NumeralValue Process(string text) (Units.Plethra, PlethraSymbols), (Units.Talents, TalentsSymbols), (Units.Staters, StatersSymbols), - (Units.Mnas, MnasSymbols), + (Units.Mnas, MnasSymbols), (Units.Years, YearSymbols), (Units.Weight, WeightSymbols), - (Units.Time, TimeSymbols)); + (Units.Time, TimeSymbols)); string[] surrogatePairs = text.SplitIntoSurrogatePairs(); decimal totalValue = 0; @@ -168,8 +168,8 @@ NumeralValue INumeralParsingSystem.Process(string text) /// Processes all Attic numerals in the text. /// /// The text to search for numerals. - /// The function to use to transform the value from - /// into a string to put in the text. + /// The function to use to transform the value from + /// into a string to put in the text. /// A copy of , but with all detected Attic numerals processed using /// . /// Attic numeral support is somewhat contrived, as there's no real way to distinguish them from diff --git a/Romanization/Languages/Greek/Ancient/GreekNumerals.cs b/Romanization/Languages/Greek/Ancient/GreekNumerals.cs index f2813d0..2562625 100644 --- a/Romanization/Languages/Greek/Ancient/GreekNumerals.cs +++ b/Romanization/Languages/Greek/Ancient/GreekNumerals.cs @@ -27,16 +27,16 @@ public static partial class Ancient public sealed class GreekNumerals : INumeralParsingSystem { // System-Specific Constants - private readonly Dictionary ValueTable = new Dictionary(); - private const char CanonicalDoubleUpperKeraia = '″'; - private const char CanonicalSingleUpperKeraia = 'ʹ'; - private const char CanonicalLowerKeraia = '͵'; - private const char CanonicalOverbar = '\u0305'; + private readonly Dictionary ValueTable = new Dictionary(); + private const char CanonicalDoubleUpperKeraia = '″'; + private const char CanonicalSingleUpperKeraia = 'ʹ'; + private const char CanonicalLowerKeraia = '͵'; + private const char CanonicalOverbar = '\u0305'; private readonly char[] UpperKeraiaDoubleReplacements = { 'ʺ', '"' }; private readonly char[] UpperKeraiaSingleReplacements = { 'ʹ', '\'' }; - private readonly char[] LowerKeraiaReplacements = { ',' }; - private readonly char[] OverbarChars = { '\u0305', '‾' }; - private const string SigmaTauDigraph = "ΣΤ"; + private readonly char[] LowerKeraiaReplacements = { ',' }; + private readonly char[] OverbarChars = { '\u0305', '‾' }; + private const string SigmaTauDigraph = "ΣΤ"; private readonly Regex OverbarBoundaryRegex = new Regex("\u0305(?!.\u0305|\u0305)", RegexOptions.Compiled | RegexOptions.IgnoreCase); diff --git a/Romanization/Languages/Greek/Greek.cs b/Romanization/Languages/Greek/Greek.cs index 4046297..dada7a0 100644 --- a/Romanization/Languages/Greek/Greek.cs +++ b/Romanization/Languages/Greek/Greek.cs @@ -17,12 +17,12 @@ public static partial class Greek { // Largely sourced from http://www.eki.ee/wgrs/rom1_el.htm - some of this information was surprisingly difficult // to find. - private const string GreekAllVowels = "ΑαΕεΗηΙιΟοΩωΥυ"; + private const string GreekAllVowels = "ΑαΕεΗηΙιΟοΩωΥυ"; private const string GreekFrontSingleVowels = "ΕεΗηΙιΥυ"; private const string GreekFrontDoubleVowels = "αι|ει|οι|υι"; - private const string GreekVowelDiphthongs = "αι|ει|οι|υι|αυ|ευ|ηυ|ου|ωυ"; - private const string GreekAllConsonants = "ΒβΓγΔδΖζΘθΚκΛλΜμΝνΞξΠπΡρΣσςΤτΦφΧχΨψ"; - private const string GreekVoicedConsonants = "ΒβΓγΔδΖζΛλΜμΝνΡρ"; + private const string GreekVowelDiphthongs = "αι|ει|οι|υι|αυ|ευ|ηυ|ου|ωυ"; + private const string GreekAllConsonants = "ΒβΓγΔδΖζΘθΚκΛλΜμΝνΞξΠπΡρΣσςΤτΦφΧχΨψ"; + private const string GreekVoicedConsonants = "ΒβΓγΔδΖζΛλΜμΝνΡρ"; private const string GreekVoicelessConsonants = "ΘθΚκΞξΠπΣσςΤτΦφΧχΨψ"; private static string LanguageWidePreparation(this string text) diff --git a/Romanization/Languages/Korean/Korean.cs b/Romanization/Languages/Korean/Korean.cs index c2b687d..3a81c8e 100644 --- a/Romanization/Languages/Korean/Korean.cs +++ b/Romanization/Languages/Korean/Korean.cs @@ -16,8 +16,8 @@ namespace Romanization public static partial class Korean { // Unicode Constants (sourced from https://en.wikipedia.org/wiki/Korean_language_and_computers#Hangul_in_Unicode) - private const int HangeulUnicodeBaseOffset = 44032; - private const int HangeulUnicodeMedialSpace = 28; + private const int HangeulUnicodeBaseOffset = 44032; + private const int HangeulUnicodeMedialSpace = 28; private const int HangeulUnicodeInitialSpace = 588; // 21 * 28 private class SyllableBlock @@ -31,8 +31,8 @@ public SyllableBlock(char character, char initial, char medial, char? final) { Character = character; Initial = new PlacementChar(initial, PlacementChar.Placements.Initial); - Medial = new PlacementChar(medial, PlacementChar.Placements.Medial); - Final = final.HasValue ? new PlacementChar(final.Value, PlacementChar.Placements.Final) : (PlacementChar?) null; + Medial = new PlacementChar(medial, PlacementChar.Placements.Medial); + Final = final.HasValue ? new PlacementChar(final.Value, PlacementChar.Placements.Final) : (PlacementChar?) null; } [Pure] @@ -219,7 +219,7 @@ private static SyllableBlock DecomposeSyllableBlock(char block) int finalIndex = codePoint % HangeulUnicodeMedialSpace; int medialIndex = (codePoint - finalIndex) % HangeulUnicodeInitialSpace / HangeulUnicodeMedialSpace; int initialIndex = (codePoint - finalIndex - medialIndex * HangeulUnicodeMedialSpace) / HangeulUnicodeInitialSpace; - + SyllableBlock newBlock = new SyllableBlock(block, HangeulUnicodeJamoInitialMap[initialIndex], HangeulUnicodeJamoMedialMap[medialIndex], diff --git a/Romanization/Romanization.csproj b/Romanization/Romanization.csproj index d2eb55a..304f804 100644 --- a/Romanization/Romanization.csproj +++ b/Romanization/Romanization.csproj @@ -1,31 +1,31 @@ - - netcoreapp3.1 - Zacchary Dempsey-Plante - Zacchary Dempsey-Plante - A library for romanization of languages written in non-Latin alphabets. - Copyright © Zacchary Dempsey-Plante 2020-2021 - https://github.com/zedseven/Romanization.NET - https://github.com/zedseven/Romanization.NET.git - git - en-CA - 0.9.4 - 0.9.4.0 - Romanization.NET - MIT - Romanization Language Chinese Greek Japanese Korean Russian - + + netcoreapp3.1 + Zacchary Dempsey-Plante + Zacchary Dempsey-Plante + A library for romanization of languages written in non-Latin alphabets. + Copyright © Zacchary Dempsey-Plante 2020-2021 + https://github.com/zedseven/Romanization.NET + https://github.com/zedseven/Romanization.NET.git + git + en-CA + 0.9.5 + 0.9.5.0 + Romanization.NET + MIT + Romanization Language Chinese Greek Japanese Korean Russian + - - Romanization\bin\Release\Romanization.NET.xml - - + + Romanization\bin\Release\Romanization.NET.xml + + - - - <_Parameter1>RomanizationTests - + + + <_Parameter1>RomanizationTests + true true @@ -34,10 +34,10 @@ Always true - + - - - + + + diff --git a/RomanizationTests/GreekTests/AncientTests/AlaLcTests.cs b/RomanizationTests/GreekTests/AncientTests/AlaLcTests.cs index b44d171..70b2e89 100644 --- a/RomanizationTests/GreekTests/AncientTests/AlaLcTests.cs +++ b/RomanizationTests/GreekTests/AncientTests/AlaLcTests.cs @@ -7,72 +7,72 @@ namespace RomanizationTests.GreekTests.AncientTests { - /// - /// For testing the Ancient Greek ALA-LC romanization system, .
- /// The large test strings are modified versions of a passage from the Almagest. - ///
- [TestClass] - public class AlaLcTests - { - private readonly Greek.Ancient.AlaLc _systemOr = new Greek.Ancient.AlaLc(OutputNumeralType.Roman, true); - private readonly Greek.Ancient.AlaLc _systemOa = new Greek.Ancient.AlaLc(OutputNumeralType.Arabic, true); - private readonly Greek.Ancient.AlaLc _systemNr = new Greek.Ancient.AlaLc(OutputNumeralType.Roman, false); - private readonly Greek.Ancient.AlaLc _systemNa = new Greek.Ancient.AlaLc(OutputNumeralType.Arabic, false); + /// + /// For testing the Ancient Greek ALA-LC romanization system, .
+ /// The large test strings are modified versions of a passage from the Almagest. + ///
+ [TestClass] + public class AlaLcTests + { + private readonly Greek.Ancient.AlaLc _systemOr = new Greek.Ancient.AlaLc(OutputNumeralType.Roman, true); + private readonly Greek.Ancient.AlaLc _systemOa = new Greek.Ancient.AlaLc(OutputNumeralType.Arabic, true); + private readonly Greek.Ancient.AlaLc _systemNr = new Greek.Ancient.AlaLc(OutputNumeralType.Roman, false); + private readonly Greek.Ancient.AlaLc _systemNa = new Greek.Ancient.AlaLc(OutputNumeralType.Arabic, false); - /// - /// Aims to test use of the system with and older punctuation & numerals. - /// - [TestMethod] - public void ProcessOlderRomanTest() - { - Assert.AreEqual("Alexandros III o Makedōn", _systemOr.Process("Αλέξανδρος ΙΙΙ ο Μακεδών")); - Assert.AreEqual("XI, ehndekatos esti parallēlos, kathh ohn an genoito ēh megistē ēhmera ōhrōn isēmerinōn XIV", - _systemOr.Process("Δ̅Ι̅. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν Δ̅Ι̅Ι̅Ι̅Ι̅")); - } + /// + /// Aims to test use of the system with and older punctuation & numerals. + /// + [TestMethod] + public void ProcessOlderRomanTest() + { + Assert.AreEqual("Alexandros III o Makedōn", _systemOr.Process("Αλέξανδρος ΙΙΙ ο Μακεδών")); + Assert.AreEqual("XI, ehndekatos esti parallēlos, kathh ohn an genoito ēh megistē ēhmera ōhrōn isēmerinōn XIV", + _systemOr.Process("Δ̅Ι̅. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν Δ̅Ι̅Ι̅Ι̅Ι̅")); + } - /// - /// Aims to test use of the system with and older punctuation & numerals. - /// - [TestMethod] - public void ProcessOlderArabicTest() - { - Assert.AreEqual("Alexandros 3 o Makedōn", _systemOa.Process("Αλέξανδρος Ι̅Ι̅Ι̅ ο Μακεδών")); - Assert.AreEqual("11, ehndekatos esti parallēlos, kathh ohn an genoito ēh megistē ēhmera ōhrōn isēmerinōn 14", - _systemOa.Process("Δ̅Ι̅. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν Δ̅Ι̅Ι̅Ι̅Ι̅")); - } + /// + /// Aims to test use of the system with and older punctuation & numerals. + /// + [TestMethod] + public void ProcessOlderArabicTest() + { + Assert.AreEqual("Alexandros 3 o Makedōn", _systemOa.Process("Αλέξανδρος Ι̅Ι̅Ι̅ ο Μακεδών")); + Assert.AreEqual("11, ehndekatos esti parallēlos, kathh ohn an genoito ēh megistē ēhmera ōhrōn isēmerinōn 14", + _systemOa.Process("Δ̅Ι̅. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν Δ̅Ι̅Ι̅Ι̅Ι̅")); + } - /// - /// Aims to test use of the system with and newer punctuation & numerals. - /// - [TestMethod] - public void ProcessNewerRomanTest() - { - Assert.AreEqual("Alexandros III o Makedōn", _systemNr.Process("Αλέξανδρος Γ' ο Μακεδών")); - Assert.AreEqual("XI. ehndekatos esti parallēlos, kathh ohn an genoito ēh megistē ēhmera ōhrōn isēmerinōn " + - "XIVS. apechei dh ouhtos tou isēmerinou moiras XXXVI kae graphetae dia ῾Rhodou. kae estin " + - "entautha, oihōn oh gnōmōn LX, toioutōn ēh men therinē skia XIIS⁙, ēh de isēmerinē " + - "XLIIIS∷, ēh de cheimerinē CIII∷", - _systemNr.Process("ι̅α̅. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν ι̅δ̅∠ʹ. " + - "ἀπέχει δ’ οὗτος τοῦ ἰσημερινοῦ μοίρας λ̅ϛ̅ καὶ γράφεται διὰ ῾Ρόδου. καί ἐστιν ἐνταῦθα, οἵων " + - "ὁ γνώμων ξ̅, τοιούτων ἡ μὲν θερινὴ σκιὰ ι̅β̅∠ʹγʹιβʹ, ἡ δὲ ἰσημερινὴ μ̅γ̅∠ʹγʹ, ἡ δὲ χειμερινὴ " + - "ρ̅γ̅ γʹ")); - } + /// + /// Aims to test use of the system with and newer punctuation & numerals. + /// + [TestMethod] + public void ProcessNewerRomanTest() + { + Assert.AreEqual("Alexandros III o Makedōn", _systemNr.Process("Αλέξανδρος Γ' ο Μακεδών")); + Assert.AreEqual("XI. ehndekatos esti parallēlos, kathh ohn an genoito ēh megistē ēhmera ōhrōn isēmerinōn " + + "XIVS. apechei dh ouhtos tou isēmerinou moiras XXXVI kae graphetae dia ῾Rhodou. kae estin " + + "entautha, oihōn oh gnōmōn LX, toioutōn ēh men therinē skia XIIS⁙, ēh de isēmerinē " + + "XLIIIS∷, ēh de cheimerinē CIII∷", + _systemNr.Process("ι̅α̅. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν ι̅δ̅∠ʹ. " + + "ἀπέχει δ’ οὗτος τοῦ ἰσημερινοῦ μοίρας λ̅ϛ̅ καὶ γράφεται διὰ ῾Ρόδου. καί ἐστιν ἐνταῦθα, οἵων " + + "ὁ γνώμων ξ̅, τοιούτων ἡ μὲν θερινὴ σκιὰ ι̅β̅∠ʹγʹιβʹ, ἡ δὲ ἰσημερινὴ μ̅γ̅∠ʹγʹ, ἡ δὲ χειμερινὴ " + + "ρ̅γ̅ γʹ")); + } - /// - /// Aims to test use of the system with and newer punctuation & numerals. - /// - [TestMethod] - public void ProcessNewerArabicTest() - { - Assert.AreEqual("Alexandros 3 o Makedōn", _systemNa.Process("Αλέξανδρος Γ' ο Μακεδών")); - Assert.AreEqual("11. ehndekatos esti parallēlos, kathh ohn an genoito ēh megistē ēhmera ōhrōn isēmerinōn " + - "14.5. apechei dh ouhtos tou isēmerinou moiras 36 kae graphetae dia ῾Rhodou. kae estin " + - "entautha, oihōn oh gnōmōn 60, toioutōn ēh men therinē skia 12.92, ēh de isēmerinē " + - "43.83, ēh de cheimerinē 103.33", - _systemNa.Process("ι̅α̅. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν ι̅δ̅∠ʹ. " + - "ἀπέχει δ’ οὗτος τοῦ ἰσημερινοῦ μοίρας λ̅ϛ̅ καὶ γράφεται διὰ ῾Ρόδου. καί ἐστιν ἐνταῦθα, οἵων " + - "ὁ γνώμων ξ̅, τοιούτων ἡ μὲν θερινὴ σκιὰ ι̅β̅∠ʹγʹιβʹ, ἡ δὲ ἰσημερινὴ μ̅γ̅∠ʹγʹ, ἡ δὲ χειμερινὴ " + - "ρ̅γ̅ γʹ")); - } - } + /// + /// Aims to test use of the system with and newer punctuation & numerals. + /// + [TestMethod] + public void ProcessNewerArabicTest() + { + Assert.AreEqual("Alexandros 3 o Makedōn", _systemNa.Process("Αλέξανδρος Γ' ο Μακεδών")); + Assert.AreEqual("11. ehndekatos esti parallēlos, kathh ohn an genoito ēh megistē ēhmera ōhrōn isēmerinōn " + + "14.5. apechei dh ouhtos tou isēmerinou moiras 36 kae graphetae dia ῾Rhodou. kae estin " + + "entautha, oihōn oh gnōmōn 60, toioutōn ēh men therinē skia 12.92, ēh de isēmerinē " + + "43.83, ēh de cheimerinē 103.33", + _systemNa.Process("ι̅α̅. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν ι̅δ̅∠ʹ. " + + "ἀπέχει δ’ οὗτος τοῦ ἰσημερινοῦ μοίρας λ̅ϛ̅ καὶ γράφεται διὰ ῾Ρόδου. καί ἐστιν ἐνταῦθα, οἵων " + + "ὁ γνώμων ξ̅, τοιούτων ἡ μὲν θερινὴ σκιὰ ι̅β̅∠ʹγʹιβʹ, ἡ δὲ ἰσημερινὴ μ̅γ̅∠ʹγʹ, ἡ δὲ χειμερινὴ " + + "ρ̅γ̅ γʹ")); + } + } } diff --git a/RomanizationTests/GreekTests/AncientTests/BetaCodeTests.cs b/RomanizationTests/GreekTests/AncientTests/BetaCodeTests.cs index 31ec9ee..9a8629d 100644 --- a/RomanizationTests/GreekTests/AncientTests/BetaCodeTests.cs +++ b/RomanizationTests/GreekTests/AncientTests/BetaCodeTests.cs @@ -7,30 +7,30 @@ namespace RomanizationTests.GreekTests.AncientTests { - /// - /// For testing the Beta Code Greek romanization system, .
- /// The large test strings are modified versions of a passage from the Almagest. - ///
- [TestClass] - public class BetaCodeTests - { - private readonly Greek.Ancient.BetaCode _system = new Greek.Ancient.BetaCode(); + /// + /// For testing the Beta Code Greek romanization system, .
+ /// The large test strings are modified versions of a passage from the Almagest. + ///
+ [TestClass] + public class BetaCodeTests + { + private readonly Greek.Ancient.BetaCode _system = new Greek.Ancient.BetaCode(); - /// - /// Aims to test use of the system with common replacements. - /// - [TestMethod] - public void ProcessCommonTest() - { - Assert.AreEqual("*ALE/CANDROS2 *G# O *MAKEDW/N", _system.Process("Αλέξανδρος Γʹ ο Μακεδών")); - Assert.AreEqual("IA#. E(NDE/KATO/S2 E)S1TI PARA/LLHLOS2, KAQ' O(\\N A)\\N GE/NOITO H( MEGI/S1TH H(ME/RA " + - "W(RW=N I)S1HMERINW=N I#D#∠##. A)PE/XEI D' OU(=TOS2 TOU= I)S1HMERINOU= MOI/RAS2 L#2# KAI\\ " + - "GRA/FETAI DIA\\ ῾*RO/DOU. KAI/ E)S1TIN E)NTAU=QA, OI(/WN O( GNW/MWN C#, TOIOU/TWN H( ME\\N " + - "QERINH\\ S1KIA\\ IB#∠##G##IB##, H( DE\\ I)S1HMERINH\\ MG∠##G##, H( DE\\ XEIMERINH\\ RG# G##", - _system.Process("ιαʹ. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν " + - "ιʹδʹ∠ʹʹ. ἀπέχει δ’ οὗτος τοῦ ἰσημερινοῦ μοίρας λϛʹ καὶ γράφεται διὰ ῾Ρόδου. καί ἐστιν " + - "ἐνταῦθα, οἵων ὁ γνώμων ξʹ, τοιούτων ἡ μὲν θερινὴ σκιὰ ιβʹ∠ʹʹγʹʹιβʹʹ, ἡ δὲ ἰσημερινὴ " + - "μγ∠ʹʹγʹʹ, ἡ δὲ χειμερινὴ ργʹ γʹʹ")); - } - } + /// + /// Aims to test use of the system with common replacements. + /// + [TestMethod] + public void ProcessCommonTest() + { + Assert.AreEqual("*ALE/CANDROS2 *G# O *MAKEDW/N", _system.Process("Αλέξανδρος Γʹ ο Μακεδών")); + Assert.AreEqual("IA#. E(NDE/KATO/S2 E)S1TI PARA/LLHLOS2, KAQ' O(\\N A)\\N GE/NOITO H( MEGI/S1TH H(ME/RA " + + "W(RW=N I)S1HMERINW=N I#D#∠##. A)PE/XEI D' OU(=TOS2 TOU= I)S1HMERINOU= MOI/RAS2 L#2# KAI\\ " + + "GRA/FETAI DIA\\ ῾*RO/DOU. KAI/ E)S1TIN E)NTAU=QA, OI(/WN O( GNW/MWN C#, TOIOU/TWN H( ME\\N " + + "QERINH\\ S1KIA\\ IB#∠##G##IB##, H( DE\\ I)S1HMERINH\\ MG∠##G##, H( DE\\ XEIMERINH\\ RG# G##", + _system.Process("ιαʹ. ἑνδέκατός ἐστι παράλληλος, καθ’ ὃν ἂν γένοιτο ἡ μεγίστη ἡμέρα ὡρῶν ἰσημερινῶν " + + "ιʹδʹ∠ʹʹ. ἀπέχει δ’ οὗτος τοῦ ἰσημερινοῦ μοίρας λϛʹ καὶ γράφεται διὰ ῾Ρόδου. καί ἐστιν " + + "ἐνταῦθα, οἵων ὁ γνώμων ξʹ, τοιούτων ἡ μὲν θερινὴ σκιὰ ιβʹ∠ʹʹγʹʹιβʹʹ, ἡ δὲ ἰσημερινὴ " + + "μγ∠ʹʹγʹʹ, ἡ δὲ χειμερινὴ ργʹ γʹʹ")); + } + } } diff --git a/RomanizationTests/JapaneseTests/KanjiReadingsTests.cs b/RomanizationTests/JapaneseTests/KanjiReadingsTests.cs index 90c434f..433b2d0 100644 --- a/RomanizationTests/JapaneseTests/KanjiReadingsTests.cs +++ b/RomanizationTests/JapaneseTests/KanjiReadingsTests.cs @@ -60,8 +60,8 @@ public void ProcessWithReadingsTest() Assert.AreEqual("[oshieru oshie yomu kun kin][yomu yomi toku tou doku]", _system.ProcessWithReadings("訓読").ToString()); Assert.AreEqual("[arawareru arawasu utsutsu gen ken][kawaru yo shiro dai tai] [kara kan]" + - "[kataru kotoba tsugeru go gyo] [shikirini hin bin][hikiiru oomune wariai ritsu sotsu] " + - "[kotoba shi ji][nori tsukasadoru sakan ten]", + "[kataru kotoba tsugeru go gyo] [shikirini hin bin][hikiiru oomune wariai ritsu sotsu] " + + "[kotoba shi ji][nori tsukasadoru sakan ten]", _system.ProcessWithReadings("現代 漢語 頻率 詞典").ToString()); } } diff --git a/RomanizationTests/RomanizationTests.csproj b/RomanizationTests/RomanizationTests.csproj index 5b83081..44e4614 100644 --- a/RomanizationTests/RomanizationTests.csproj +++ b/RomanizationTests/RomanizationTests.csproj @@ -1,24 +1,23 @@ - - netcoreapp3.1 + + netcoreapp3.1 + false + - false - + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - + + + diff --git a/RomanizationTests/TestSetup.cs b/RomanizationTests/TestSetup.cs index 05f27be..4c379ec 100644 --- a/RomanizationTests/TestSetup.cs +++ b/RomanizationTests/TestSetup.cs @@ -7,25 +7,25 @@ namespace RomanizationTests { - /// - /// The setup class, which sets the culture before tests begin so that test results are uniform. - /// - [TestClass] - public class TestSetup - { - /// - /// The initialization method. - /// - /// Unused. - [AssemblyInitialize] - public static void TestInit(TestContext context) - { - Console.WriteLine("Test initialization starting..."); - CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("en-CA"); - CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-CA"); - CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-CA"); - CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-CA"); - Console.WriteLine("Test initialization done."); - } - } + /// + /// The setup class, which sets the culture before tests begin so that test results are uniform. + /// + [TestClass] + public class TestSetup + { + /// + /// The initialization method. + /// + /// Unused. + [AssemblyInitialize] + public static void TestInit(TestContext context) + { + Console.WriteLine("Test initialization starting..."); + CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("en-CA"); + CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-CA"); + CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("en-CA"); + CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("en-CA"); + Console.WriteLine("Test initialization done."); + } + } }