Add some Greek letters to "Normalize strings" - thx FeMaster1 :)

Related to #4436
This commit is contained in:
Nikolaj Olsson 2020-10-16 09:44:48 +02:00
parent 56744181e7
commit e63a037161

View File

@ -8,6 +8,7 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
{
var language = Configuration.Settings.Language.FixCommonErrors;
string fixAction = language.NormalizeStrings;
var twoLetterLanguageCode = callbacks.Language;
int noOfFixes = 0;
for (int i = 0; i < subtitle.Paragraphs.Count; i++)
{
@ -32,6 +33,32 @@ namespace Nikse.SubtitleEdit.Core.Forms.FixCommonErrors
.Replace('\u2015', '-') // ― Horizontal bar (\u2015)
;
if (twoLetterLanguageCode != "el")
{
text = text
.Replace("\u03a4", "T") // Greek Capital Letter Tau
.Replace("\u03a5", "Y") // Greek Capital Letter Upsilon
.Replace("\u03b3", "Y") // Greek Small Letter Gamma
.Replace("\u03a7", "X") // Greek Capital Letter Chi
.Replace("\u03ba", "k") // Greek Small Letter Kappa
.Replace("\u03bd", "v") // Greek Small Letter Nu
.Replace("\u03c1", "p") // Greek Small Letter Rho
.Replace("\u03c5", "u") // Greek Small Letter Upsilon
.Replace("\u039c", "M") // Greek Capital Letter Mu
.Replace("\u039a", "K") // Greek Capital Letter Kappa
.Replace("\u039d", "N") // Greek Capital Letter Nu
.Replace("\u039f", "O") // Greek Capital Letter Omicron
.Replace("\u03a1", "P") // Greek Capital Letter Rho
.Replace("\u0395", "E") // Greek Capital Letter Epsilon
.Replace("\u0396", "Z") // Greek Capital Letter Zeta
.Replace("\u0397", "H") // Greek Capital Letter Eta
.Replace("\u0384", "'") // Greek Tonos
.Replace("\u0392", "B") // Greek Capital Letter Beta
.Replace("\u0391", "A") // Greek Capital Letter Alpha
.Replace("\u03bf", "o") // Greek small letter Omicron
;
}
if (oldText != text && callbacks.AllowFix(p, fixAction))
{
p.Text = text;