mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
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:
parent
511f4aff2e
commit
4f0c422706
@ -61,7 +61,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
{
|
{
|
||||||
var namesEtc = new List<string>();
|
var namesEtc = new List<string>();
|
||||||
var tmp = 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)
|
foreach (var s in tmp)
|
||||||
{
|
{
|
||||||
if (s.Contains("."))
|
if (s.Contains("."))
|
||||||
@ -78,7 +78,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
p.Text = FixCasing(p.Text, lastLine, namesEtc);
|
p.Text = FixCasing(p.Text, lastLine, namesEtc);
|
||||||
|
|
||||||
// fix casing of English alone i to I
|
// 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);
|
Match match = aloneI.Match(p.Text);
|
||||||
while (match.Success)
|
while (match.Success)
|
||||||
|
@ -4448,7 +4448,7 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool saveChangeCaseChanges = true;
|
bool saveChangeCaseChanges = true;
|
||||||
changeCasing.FixCasing(selectedLines, Utilities.AutoDetectGoogleLanguage(_subtitle));
|
changeCasing.FixCasing(selectedLines, Utilities.AutoDetectLanguageName(Configuration.Settings.General.SpellCheckLanguage, _subtitle));
|
||||||
var changeCasingNames = new ChangeCasingNames();
|
var changeCasingNames = new ChangeCasingNames();
|
||||||
if (changeCasing.ChangeNamesToo)
|
if (changeCasing.ChangeNamesToo)
|
||||||
{
|
{
|
||||||
|
@ -597,9 +597,6 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
_namesEtcList = new List<string>();
|
_namesEtcList = new List<string>();
|
||||||
_namesEtcMultiWordList = new List<string>();
|
_namesEtcMultiWordList = new List<string>();
|
||||||
_namesEtcListUppercase = 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>();
|
_skipAllList = new List<string>();
|
||||||
|
|
||||||
@ -635,6 +632,10 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
_languageName = Utilities.AutoDetectLanguageName(_languageName, subtitle);
|
_languageName = Utilities.AutoDetectLanguageName(_languageName, subtitle);
|
||||||
string dictionary = Utilities.DictionaryFolder + _languageName;
|
string dictionary = Utilities.DictionaryFolder + _languageName;
|
||||||
|
|
||||||
|
Utilities.LoadNamesEtcWordLists(_namesEtcList, _namesEtcMultiWordList, _languageName);
|
||||||
|
foreach (string namesItem in _namesEtcList)
|
||||||
|
_namesEtcListUppercase.Add(namesItem.ToUpper());
|
||||||
|
|
||||||
_userWordList = new List<string>();
|
_userWordList = new List<string>();
|
||||||
_userWordDictionary = new XmlDocument();
|
_userWordDictionary = new XmlDocument();
|
||||||
if (File.Exists(dictionaryFolder + _languageName + "_user.xml"))
|
if (File.Exists(dictionaryFolder + _languageName + "_user.xml"))
|
||||||
|
@ -817,6 +817,8 @@ namespace Nikse.SubtitleEdit.Logic
|
|||||||
|
|
||||||
public static string AutoDetectLanguageName(string languageName, Subtitle subtitle)
|
public static string AutoDetectLanguageName(string languageName, Subtitle subtitle)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(languageName))
|
||||||
|
languageName = "en_US";
|
||||||
int bestCount = subtitle.Paragraphs.Count / 14;
|
int bestCount = subtitle.Paragraphs.Count / 14;
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
Loading…
Reference in New Issue
Block a user