A few fixes for Chinese language (choose language/ocr)

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@179 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2010-12-14 07:15:56 +00:00
parent a135467bf2
commit 1bb78834c5
2 changed files with 9 additions and 3 deletions

View File

@ -66,7 +66,10 @@ namespace Nikse.SubtitleEdit.Forms
{ {
try try
{ {
comboBoxLanguages.Items.Add(new CultureListItem(CultureInfo.CreateSpecificCulture(cultureName))); if (string.Compare(cultureName, "zh-CHS", true) == 0)
comboBoxLanguages.Items.Add(new CultureListItem(new CultureInfo(0x4)));
else
comboBoxLanguages.Items.Add(new CultureListItem(CultureInfo.CreateSpecificCulture(cultureName)));
} }
catch (ArgumentException) catch (ArgumentException)
{ {

View File

@ -1385,11 +1385,14 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxTesseractLanguages.Items.Clear(); comboBoxTesseractLanguages.Items.Clear();
foreach (var culture in System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.NeutralCultures)) foreach (var culture in System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.NeutralCultures))
{ {
string trainDataFileName = dir + "\\" + culture.ThreeLetterISOLanguageName + ".traineddata"; string tesseractName = culture.ThreeLetterISOLanguageName;
if (culture.LCID == 0x4 && !File.Exists(dir + "\\" + tesseractName + ".traineddata"))
tesseractName = "chi_sim";
string trainDataFileName = dir + "\\" + tesseractName + ".traineddata";
if (!list.Contains(culture.ThreeLetterISOLanguageName) && File.Exists(trainDataFileName)) if (!list.Contains(culture.ThreeLetterISOLanguageName) && File.Exists(trainDataFileName))
{ {
list.Add(culture.ThreeLetterISOLanguageName); list.Add(culture.ThreeLetterISOLanguageName);
comboBoxTesseractLanguages.Items.Add(new TesseractLanguage { Id = culture.ThreeLetterISOLanguageName, Text = culture.EnglishName }); comboBoxTesseractLanguages.Items.Add(new TesseractLanguage { Id = tesseractName, Text = culture.EnglishName });
} }
} }
} }