Fixed possible wrong user/name dictionary load

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@217 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-01-02 20:22:19 +00:00
parent 511f4aff2e
commit 4f0c422706
4 changed files with 9 additions and 6 deletions

View File

@ -61,7 +61,7 @@ namespace Nikse.SubtitleEdit.Forms
{
var namesEtc = new List<string>();
var tmp = new List<string>();
Utilities.LoadNamesEtcWordLists(tmp, tmp, Utilities.AutoDetectGoogleLanguage(subtitle));
Utilities.LoadNamesEtcWordLists(tmp, tmp, language);
foreach (var s in tmp)
{
if (s.Contains("."))
@ -78,7 +78,7 @@ namespace Nikse.SubtitleEdit.Forms
p.Text = FixCasing(p.Text, lastLine, namesEtc);
// fix casing of English alone i to I
if (radioButtonNormal.Checked && language == "en" && p.Text.Contains("i"))
if (radioButtonNormal.Checked && language.StartsWith("en") && p.Text.Contains("i"))
{
Match match = aloneI.Match(p.Text);
while (match.Success)

View File

@ -4448,7 +4448,7 @@ namespace Nikse.SubtitleEdit.Forms
}
bool saveChangeCaseChanges = true;
changeCasing.FixCasing(selectedLines, Utilities.AutoDetectGoogleLanguage(_subtitle));
changeCasing.FixCasing(selectedLines, Utilities.AutoDetectLanguageName(Configuration.Settings.General.SpellCheckLanguage, _subtitle));
var changeCasingNames = new ChangeCasingNames();
if (changeCasing.ChangeNamesToo)
{

View File

@ -597,9 +597,6 @@ namespace Nikse.SubtitleEdit.Forms
_namesEtcList = new List<string>();
_namesEtcMultiWordList = new List<string>();
_namesEtcListUppercase = new List<string>();
Utilities.LoadNamesEtcWordLists(_namesEtcList, _namesEtcMultiWordList, Utilities.AutoDetectGoogleLanguage(subtitle));
foreach (string namesItem in _namesEtcList)
_namesEtcListUppercase.Add(namesItem.ToUpper());
_skipAllList = new List<string>();
@ -635,6 +632,10 @@ namespace Nikse.SubtitleEdit.Forms
_languageName = Utilities.AutoDetectLanguageName(_languageName, subtitle);
string dictionary = Utilities.DictionaryFolder + _languageName;
Utilities.LoadNamesEtcWordLists(_namesEtcList, _namesEtcMultiWordList, _languageName);
foreach (string namesItem in _namesEtcList)
_namesEtcListUppercase.Add(namesItem.ToUpper());
_userWordList = new List<string>();
_userWordDictionary = new XmlDocument();
if (File.Exists(dictionaryFolder + _languageName + "_user.xml"))

View File

@ -817,6 +817,8 @@ namespace Nikse.SubtitleEdit.Logic
public static string AutoDetectLanguageName(string languageName, Subtitle subtitle)
{
if (string.IsNullOrEmpty(languageName))
languageName = "en_US";
int bestCount = subtitle.Paragraphs.Count / 14;
StringBuilder sb = new StringBuilder();