mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Minor refact (src/Forms/AddToNames.cs)
This commit is contained in:
parent
8d2805a179
commit
118ad840f4
@ -31,16 +31,21 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Utilities.FixLargeFonts(this, buttonOK);
|
||||
}
|
||||
|
||||
private void CapFirstCharIfNotEmpty(string text)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
text = text.Trim().TrimEnd('.', '!', '?');
|
||||
if (text.Length > 1)
|
||||
textBoxAddName.Text = char.ToUpper(textBoxAddName.Text[0]) + textBoxAddName.Text.Substring(1);
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(Subtitle subtitle, string text)
|
||||
{
|
||||
_subtitle = subtitle;
|
||||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
textBoxAddName.Text = text.Trim().TrimEnd('.').TrimEnd('!').TrimEnd('?');
|
||||
if (textBoxAddName.Text.Length > 1)
|
||||
textBoxAddName.Text = char.ToUpper(textBoxAddName.Text[0]) + textBoxAddName.Text.Substring(1);
|
||||
}
|
||||
CapFirstCharIfNotEmpty(text);
|
||||
|
||||
comboBoxDictionaries.Items.Clear();
|
||||
string languageName = Utilities.AutoDetectLanguageName(Configuration.Settings.General.SpellCheckLanguage, _subtitle);
|
||||
@ -56,12 +61,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
_subtitle = subtitle;
|
||||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
textBoxAddName.Text = text.Trim().TrimEnd('.').TrimEnd('!').TrimEnd('?');
|
||||
if (textBoxAddName.Text.Length > 1)
|
||||
textBoxAddName.Text = char.ToUpper(textBoxAddName.Text[0]) + textBoxAddName.Text.Substring(1);
|
||||
}
|
||||
CapFirstCharIfNotEmpty(text);
|
||||
|
||||
comboBoxDictionaries.Items.Clear();
|
||||
foreach (string name in Utilities.GetDictionaryLanguages())
|
||||
|
Loading…
Reference in New Issue
Block a user