mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
[Name-List] - Update names_etc.xml (#2278)
* [Name-List] - Update names_etc.xml * [Dictionary] - Update part 2. * [Namelist] - <ignore_list> => <names> and new <blacklist> added. * [Namelist] - Make name list culture insensitive. * [Namelist] - Update installer. * Fix broken codes.
This commit is contained in:
parent
1b3052dc33
commit
db9b5fd61f
@ -1,88 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This list contains names/words with specific casing - and specific to Danish only -->
|
||||
<ignore_list>
|
||||
<name>Aquarium</name>
|
||||
<name>Armfeldt</name>
|
||||
<name>Asgård</name>
|
||||
<name>Bahnhofstrasse</name>
|
||||
<name>Bartok</name>
|
||||
<name>Beaudine</name>
|
||||
<name>Beyonces</name>
|
||||
<name>Brahms</name>
|
||||
<name>Bäckström</name>
|
||||
<name>Cartier</name>
|
||||
<name>Cavanaughs</name>
|
||||
<name>Chardonnay</name>
|
||||
<name>Chewy</name>
|
||||
<name>Chopin</name>
|
||||
<name>Chopins</name>
|
||||
<name>Chung</name>
|
||||
<name>Cobain</name>
|
||||
<name>Corolla</name>
|
||||
<name>Danmark</name>
|
||||
<name>Diagonalstræde</name>
|
||||
<name>Dickens</name>
|
||||
<name>DiLaurentis</name>
|
||||
<name>Egerman</name>
|
||||
<name>England</name>
|
||||
<name>Erlandson</name>
|
||||
<name>Falcon</name>
|
||||
<name>Falconberg</name>
|
||||
<name>Fields</name>
|
||||
<name>Forrester</name>
|
||||
<name>Frankrig</name>
|
||||
<name>Fulton</name>
|
||||
<name>Fultons</name>
|
||||
<name>Gatsby</name>
|
||||
<name>Geographic</name>
|
||||
<name>Gerimax</name>
|
||||
<name>Guangdong</name>
|
||||
<name>Guarneri</name>
|
||||
<name>Hepburn</name>
|
||||
<name>Inc.</name>
|
||||
<name>Italien</name>
|
||||
<name>Juliard</name>
|
||||
<name>Kahn</name>
|
||||
<name>Kretzinsky</name>
|
||||
<name>København</name>
|
||||
<name>Leningrad</name>
|
||||
<name>Lyman</name>
|
||||
<name>Lymans</name>
|
||||
<name>Magnoliavej</name>
|
||||
<name>Mandelbaum</name>
|
||||
<name>Mandelbaums</name>
|
||||
<name>MBA</name>
|
||||
<name>McClellan</name>
|
||||
<name>Mellisas</name>
|
||||
<name>Mickey Mouse</name>
|
||||
<name>Mondeo</name>
|
||||
<name>Mondeoen</name>
|
||||
<name>Monterey</name>
|
||||
<name>MTV</name>
|
||||
<name>Nadjim</name>
|
||||
<name>Neumann</name>
|
||||
<name>Petterson</name>
|
||||
<name>Pransky</name>
|
||||
<name>Primulavænget</name>
|
||||
<name>Puttanesca</name>
|
||||
<name>Rintoul</name>
|
||||
<name>Rosewood</name>
|
||||
<name>Savitsky</name>
|
||||
<name>Schumanns</name>
|
||||
<name>Sheng</name>
|
||||
<name>Silverton</name>
|
||||
<name>Slytherins</name>
|
||||
<name>Splendini</name>
|
||||
<name>Strombel</name>
|
||||
<name>Tianjins</name>
|
||||
<name>Tinsley</name>
|
||||
<name>Trinity</name>
|
||||
<name>Ullman</name>
|
||||
<name>Uzés</name>
|
||||
<name>Versace</name>
|
||||
<name>Waldstein</name>
|
||||
<name>Waterman</name>
|
||||
<name>Wharton</name>
|
||||
<name>Wylie</name>
|
||||
<name>Yardley</name>
|
||||
</ignore_list>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This list contains names/words with specific casing - and specific to Danish only -->
|
||||
<names>
|
||||
<name>Aquarium</name>
|
||||
<name>Armfeldt</name>
|
||||
<name>Asgård</name>
|
||||
<name>Bahnhofstrasse</name>
|
||||
<name>Bartok</name>
|
||||
<name>Beaudine</name>
|
||||
<name>Beyonces</name>
|
||||
<name>Brahms</name>
|
||||
<name>Bäckström</name>
|
||||
<name>Cartier</name>
|
||||
<name>Cavanaughs</name>
|
||||
<name>Chardonnay</name>
|
||||
<name>Chewy</name>
|
||||
<name>Chopin</name>
|
||||
<name>Chopins</name>
|
||||
<name>Chung</name>
|
||||
<name>Cobain</name>
|
||||
<name>Corolla</name>
|
||||
<name>Danmark</name>
|
||||
<name>Diagonalstræde</name>
|
||||
<name>Dickens</name>
|
||||
<name>DiLaurentis</name>
|
||||
<name>Egerman</name>
|
||||
<name>England</name>
|
||||
<name>Erlandson</name>
|
||||
<name>Falcon</name>
|
||||
<name>Falconberg</name>
|
||||
<name>Fields</name>
|
||||
<name>Forrester</name>
|
||||
<name>Frankrig</name>
|
||||
<name>Fulton</name>
|
||||
<name>Fultons</name>
|
||||
<name>Gatsby</name>
|
||||
<name>Geographic</name>
|
||||
<name>Gerimax</name>
|
||||
<name>Guangdong</name>
|
||||
<name>Guarneri</name>
|
||||
<name>Hepburn</name>
|
||||
<name>Inc.</name>
|
||||
<name>Italien</name>
|
||||
<name>Juliard</name>
|
||||
<name>Kahn</name>
|
||||
<name>Kretzinsky</name>
|
||||
<name>København</name>
|
||||
<name>Leningrad</name>
|
||||
<name>Lyman</name>
|
||||
<name>Lymans</name>
|
||||
<name>Magnoliavej</name>
|
||||
<name>Mandelbaum</name>
|
||||
<name>Mandelbaums</name>
|
||||
<name>MBA</name>
|
||||
<name>McClellan</name>
|
||||
<name>Mellisas</name>
|
||||
<name>Mickey Mouse</name>
|
||||
<name>Mondeo</name>
|
||||
<name>Mondeoen</name>
|
||||
<name>Monterey</name>
|
||||
<name>MTV</name>
|
||||
<name>Nadjim</name>
|
||||
<name>Neumann</name>
|
||||
<name>Petterson</name>
|
||||
<name>Pransky</name>
|
||||
<name>Primulavænget</name>
|
||||
<name>Puttanesca</name>
|
||||
<name>Rintoul</name>
|
||||
<name>Rosewood</name>
|
||||
<name>Savitsky</name>
|
||||
<name>Schumanns</name>
|
||||
<name>Sheng</name>
|
||||
<name>Silverton</name>
|
||||
<name>Slytherins</name>
|
||||
<name>Splendini</name>
|
||||
<name>Strombel</name>
|
||||
<name>Tianjins</name>
|
||||
<name>Tinsley</name>
|
||||
<name>Trinity</name>
|
||||
<name>Ullman</name>
|
||||
<name>Uzés</name>
|
||||
<name>Versace</name>
|
||||
<name>Waldstein</name>
|
||||
<name>Waterman</name>
|
||||
<name>Wharton</name>
|
||||
<name>Wylie</name>
|
||||
<name>Yardley</name>
|
||||
<blacklist>
|
||||
<name>Rabat</name>
|
||||
</blacklist>
|
||||
</names>
|
File diff suppressed because it is too large
Load Diff
@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This list contains names/words with specific casing - and specific to English only -->
|
||||
<ignore_list>
|
||||
<name>Abbie</name>
|
||||
<name>Abi</name>
|
||||
<name>Aimee</name>
|
||||
<name>Ashleigh</name>
|
||||
<name>Bethan</name>
|
||||
<name>Ciara</name>
|
||||
<name>Faye</name>
|
||||
<name>Finn</name>
|
||||
<name>Freya</name>
|
||||
<name>Holly</name>
|
||||
<name>Imogen</name>
|
||||
<name>Ingvarsson</name>
|
||||
<name>Jade</name>
|
||||
<name>Kai</name>
|
||||
<name>Kayleigh</name>
|
||||
<name>Kian</name>
|
||||
<name>Kieran</name>
|
||||
<name>Kirsty</name>
|
||||
<name>Leah</name>
|
||||
<name>Lily</name>
|
||||
<name>Mark</name>
|
||||
<name>Milly</name>
|
||||
<name>Mollie</name>
|
||||
<name>Niamh</name>
|
||||
<name>Poppy</name>
|
||||
<name>Rachael</name>
|
||||
<name>Reece</name>
|
||||
<name>Rhiannon</name>
|
||||
<name>Rhys</name>
|
||||
<name>Rob</name>
|
||||
<name>Robyn</name>
|
||||
<name>Rose</name>
|
||||
<name>Tia</name>
|
||||
<name>Tom</name>
|
||||
</ignore_list>
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This list contains names/words with specific casing - and specific to Spanish only -->
|
||||
<ignore_list>
|
||||
<names>
|
||||
<name>Aang</name>
|
||||
<name>Aarón</name>
|
||||
<name>Abdulabri</name>
|
||||
@ -1009,4 +1009,7 @@
|
||||
<name>Zoroastro</name>
|
||||
<name>Zuko</name>
|
||||
<name>Zulú</name>
|
||||
</ignore_list>
|
||||
<blacklist>
|
||||
<name></name>
|
||||
</blacklist>
|
||||
</names>
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This list contains names/words with specific casing - and specific to French only -->
|
||||
<ignore_list>
|
||||
<names>
|
||||
<name>Abdon</name>
|
||||
<name>Abdonie</name>
|
||||
<name>Abdonise</name>
|
||||
@ -808,4 +808,7 @@
|
||||
<name>Zéphir</name>
|
||||
<name>Zéphirin</name>
|
||||
<name>Zoé</name>
|
||||
</ignore_list>
|
||||
<blacklist>
|
||||
<name></name>
|
||||
</blacklist>
|
||||
</names>
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This list contains names/words with specific casing - and specific to Portuguese only -->
|
||||
<ignore_list>
|
||||
<names>
|
||||
<name>Aarão</name>
|
||||
<name>Abdénago</name>
|
||||
<name>Abedenego</name>
|
||||
@ -16,6 +16,7 @@
|
||||
<name>Abraim</name>
|
||||
<name>Abrão</name>
|
||||
<name>Absalão</name>
|
||||
<name>Cabo Verde</name>
|
||||
<name>Abssilão</name>
|
||||
<name>Ácil</name>
|
||||
<name>Acilino</name>
|
||||
@ -95,6 +96,7 @@
|
||||
<name>Agostinho</name>
|
||||
<name>Águas</name>
|
||||
<name>Águeda</name>
|
||||
<name>Guiné-Bissau</name>
|
||||
<name>Aguiar</name>
|
||||
<name>Aguinaldo</name>
|
||||
<name>Aiala</name>
|
||||
@ -4589,4 +4591,7 @@
|
||||
<name>Zurita</name>
|
||||
<name>Zuzela</name>
|
||||
<name>Zuzidine</name>
|
||||
</ignore_list>
|
||||
<blacklist>
|
||||
<name></name>
|
||||
</blacklist>
|
||||
</names>
|
File diff suppressed because it is too large
Load Diff
@ -181,37 +181,37 @@ Name: associate_srt; Description: {cm:tsk_SetFileTypes}; GroupDescript
|
||||
|
||||
|
||||
[Files]
|
||||
Source: ..\Dictionaries\da_DK_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\da_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\da_DK_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\da_NoBreakAfterList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\dan_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\de_DE_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\de_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\de_DE_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\deu_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\en_GB_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\en_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\en_NoBreakAfterList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\en_US.aff; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\en_US.dic; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\en_US_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\en_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\en_US_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\eng_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\es_MX_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\es_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\es_MX_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\es_NoBreakAfterList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\fi_FI_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\fi_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\fi_FI_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\fin_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\fr_FR_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\fr_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\fra_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\hrv_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\hun_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\nld_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\nor_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\por_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\pt_PT_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\pt_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\pt_PT_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\ru_RU_names_etc.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\ru_names.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\ru_RU_user.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\rus_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
Source: ..\Dictionaries\spa_OCRFixReplaceList.xml; DestDir: {userappdata}\Subtitle Edit\Dictionaries; Flags: ignoreversion onlyifdoesntexist uninsneveruninstall; Components: main
|
||||
@ -298,15 +298,15 @@ Type: files; Name: {userappdata}\Subtitle Edit\Settings.xml; Tasks: reset_s
|
||||
Type: files; Name: {app}\Interop.QuartzTypeLib.dll; Check: IsUpgrade()
|
||||
|
||||
; Remove old files from the {app} dir
|
||||
Type: files; Name: {app}\Dictionaries\da_DK_names_etc.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\da_names.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\da_DK_user.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\dan_OCRFixReplaceList.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\en_US.aff; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\en_US.dic; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\en_US_names_etc.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\en_names.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\en_US_user.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\eng_OCRFixReplaceList.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\names_etc.xml; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\Dictionaries\names.xml; Check: IsUpgrade()
|
||||
Type: dirifempty; Name: {app}\Dictionaries; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\TessData\eng.DangAmbigs; Check: IsUpgrade()
|
||||
Type: files; Name: {app}\TessData\eng.freq-dawg; Check: IsUpgrade()
|
||||
@ -482,35 +482,35 @@ end;
|
||||
|
||||
procedure CleanUpDictionaries();
|
||||
begin
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\da_DK_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\da_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\da_DK_user.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\da_NoBreakAfterList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\dan_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\de_DE_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\de_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\de_DE_user.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\deu_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\en_GB_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\en_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\en_NoBreakAfterList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\en_US_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\en_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\en_US_user.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\eng_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\es_MX_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\es_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\es_MX_user.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\es_NoBreakAfterList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\fi_FI_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\fi_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\fi_FI_user.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\fin_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\fr_FR_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\fr_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\fra_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\hrv_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\hun_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\nld_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\nor_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\por_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\pt_PT_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\pt_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\pt_PT_user.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\ru_RU_names_etc.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\ru_names.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\ru_RU_user.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\rus_OCRFixReplaceList.xml'));
|
||||
DeleteFile(ExpandConstant('{userappdata}\Subtitle Edit\Dictionaries\spa_OCRFixReplaceList.xml'));
|
||||
|
@ -10,6 +10,7 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
private readonly string _dictionaryFolder;
|
||||
private readonly HashSet<string> _namesList;
|
||||
private readonly HashSet<string> _namesMultiList;
|
||||
private readonly HashSet<string> _blackList;
|
||||
private readonly string _languageName;
|
||||
|
||||
public NamesList(string dictionaryFolder, string languageName, bool useOnlineNamesEtc, string namesEtcUrl)
|
||||
@ -19,32 +20,39 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
|
||||
_namesList = new HashSet<string>();
|
||||
_namesMultiList = new HashSet<string>();
|
||||
_blackList = new HashSet<string>();
|
||||
|
||||
// Should be called 1st in order to init blacklist.
|
||||
LoadNamesList(GetLocalNamesFileName()); // e.g: en_names.xml (culture insensitive)
|
||||
|
||||
if (useOnlineNamesEtc && !string.IsNullOrEmpty(namesEtcUrl))
|
||||
{
|
||||
try
|
||||
{
|
||||
var xml = Utilities.DownloadString(Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
var namesDoc = new XmlDocument();
|
||||
namesDoc.LoadXml(xml);
|
||||
LoadNames(_namesList, _namesMultiList, namesDoc);
|
||||
// load name from https://raw.githubusercontent.com/SubtitleEdit/subtitleedit/master/Dictionaries/names.xml
|
||||
var xml = Utilities.DownloadString(Configuration.Settings.WordLists.NamesUrl);
|
||||
var nameListXml = new XmlDocument();
|
||||
nameListXml.LoadXml(xml);
|
||||
// name present in blacklist won't be loaded!
|
||||
LoadNamesList(nameListXml);
|
||||
}
|
||||
#if DEBUG
|
||||
catch (Exception exception)
|
||||
{
|
||||
LoadNamesList(Path.Combine(_dictionaryFolder, "names_etc.xml"), _namesList, _namesMultiList);
|
||||
System.Diagnostics.Debug.WriteLine(exception.Message);
|
||||
}
|
||||
#else
|
||||
catch
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadNamesList(Path.Combine(_dictionaryFolder, "names_etc.xml"), _namesList, _namesMultiList);
|
||||
// names present in blacklist won't be loaded!
|
||||
LoadNamesList(Path.Combine(_dictionaryFolder, "names.xml"));
|
||||
}
|
||||
|
||||
LoadNamesList(GetLocalNamesFileName(), _namesList, _namesMultiList);
|
||||
|
||||
var userFile = GetLocalNamesUserFileName();
|
||||
LoadNamesList(userFile, _namesList, _namesMultiList);
|
||||
UnloadRemovedNames(userFile);
|
||||
}
|
||||
|
||||
public List<string> GetAllNames()
|
||||
@ -65,78 +73,78 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
return _namesMultiList;
|
||||
}
|
||||
|
||||
private void UnloadRemovedNames(string fileName)
|
||||
private void InitBlackList(XmlDocument namesXml)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName))
|
||||
return;
|
||||
|
||||
var namesDoc = new XmlDocument();
|
||||
namesDoc.Load(fileName);
|
||||
if (namesDoc.DocumentElement == null)
|
||||
return;
|
||||
|
||||
foreach (XmlNode node in namesDoc.DocumentElement.SelectNodes("removed_name"))
|
||||
if (namesXml == null || namesXml.DocumentElement == null)
|
||||
{
|
||||
string s = node.InnerText.Trim();
|
||||
if (s.Contains(' '))
|
||||
return;
|
||||
}
|
||||
XmlNode xnode = namesXml.DocumentElement.SelectSingleNode("blacklist");
|
||||
// No blacklist element present.
|
||||
if (xnode == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (XmlNode node in xnode.SelectNodes("name"))
|
||||
{
|
||||
string name = node.InnerText.Trim();
|
||||
if (name.Length > 0)
|
||||
{
|
||||
if (_namesMultiList.Contains(s))
|
||||
_namesMultiList.Remove(s);
|
||||
}
|
||||
else if (_namesList.Contains(s))
|
||||
{
|
||||
_namesList.Remove(s);
|
||||
_blackList.Add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns two letters ISO language name (Neutral culture).
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetLocalNamesFileName()
|
||||
{
|
||||
if (_languageName.Length == 2)
|
||||
// Converts e.g en_US => en (Neutral culture).
|
||||
string twoLetterISOLanguageName = _languageName;
|
||||
if (_languageName.Length > 2)
|
||||
{
|
||||
string[] files = Directory.GetFiles(_dictionaryFolder, _languageName + "_??_names_etc.xml");
|
||||
if (files.Length > 0)
|
||||
return files[0];
|
||||
twoLetterISOLanguageName = _languageName.Substring(0, 2);
|
||||
}
|
||||
return Path.Combine(_dictionaryFolder, _languageName + "_names_etc.xml");
|
||||
return Path.Combine(_dictionaryFolder, twoLetterISOLanguageName + "_names.xml");
|
||||
}
|
||||
|
||||
private string GetLocalNamesUserFileName()
|
||||
private void LoadNamesList(string fileName)
|
||||
{
|
||||
if (_languageName.Length == 2)
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
string[] files = Directory.GetFiles(_dictionaryFolder, _languageName + "_??_names_etc_user.xml");
|
||||
if (files.Length > 0)
|
||||
return files[0];
|
||||
return;
|
||||
}
|
||||
return Path.Combine(_dictionaryFolder, _languageName + "_names_etc_user.xml");
|
||||
}
|
||||
|
||||
private static void LoadNamesList(string fileName, HashSet<string> namesList, HashSet<string> namesMultiList)
|
||||
{
|
||||
if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName))
|
||||
return;
|
||||
|
||||
var namesDoc = new XmlDocument();
|
||||
namesDoc.Load(fileName);
|
||||
if (namesDoc.DocumentElement == null)
|
||||
return;
|
||||
|
||||
LoadNames(namesList, namesMultiList, namesDoc);
|
||||
}
|
||||
|
||||
private static void LoadNames(HashSet<string> namesList, HashSet<string> namesMultiList, XmlDocument namesDoc)
|
||||
{
|
||||
foreach (XmlNode node in namesDoc.DocumentElement.SelectNodes("name"))
|
||||
var nameListXml = new XmlDocument();
|
||||
nameListXml.Load(fileName);
|
||||
if (nameListXml.DocumentElement == null)
|
||||
{
|
||||
string s = node.InnerText.Trim();
|
||||
if (s.Contains(' ') && !namesMultiList.Contains(s))
|
||||
return;
|
||||
}
|
||||
LoadNamesList(nameListXml);
|
||||
}
|
||||
|
||||
private void LoadNamesList(XmlDocument nameListXml)
|
||||
{
|
||||
// Initialize blacklist.
|
||||
InitBlackList(nameListXml);
|
||||
|
||||
foreach (XmlNode node in nameListXml.DocumentElement.SelectNodes("name"))
|
||||
{
|
||||
string name = node.InnerText.Trim();
|
||||
// skip names in blacklist
|
||||
if (_blackList.Contains(name))
|
||||
{
|
||||
namesMultiList.Add(s);
|
||||
continue;
|
||||
}
|
||||
else if (!namesList.Contains(s))
|
||||
if (name.Contains(' ') && !_namesMultiList.Contains(name))
|
||||
{
|
||||
namesList.Add(s);
|
||||
_namesMultiList.Add(name);
|
||||
}
|
||||
else if (!_namesList.Contains(name))
|
||||
{
|
||||
_namesList.Add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,48 +154,48 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
name = name.Trim();
|
||||
if (name.Length > 1 && _namesList.Contains(name) || _namesMultiList.Contains(name))
|
||||
{
|
||||
if (_namesList.Contains(name))
|
||||
_namesList.Remove(name);
|
||||
if (_namesMultiList.Contains(name))
|
||||
_namesMultiList.Remove(name);
|
||||
// Try removing name from both lists
|
||||
_namesList.Remove(name);
|
||||
_namesMultiList.Remove(name);
|
||||
|
||||
var userList = new HashSet<string>();
|
||||
var fileName = GetLocalNamesUserFileName();
|
||||
LoadNamesList(fileName, userList, userList);
|
||||
|
||||
var namesDoc = new XmlDocument();
|
||||
var fileName = GetLocalNamesFileName();
|
||||
var nameListXml = new XmlDocument();
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
namesDoc.Load(fileName);
|
||||
nameListXml.Load(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
namesDoc.LoadXml("<ignore_words />");
|
||||
nameListXml.LoadXml("<names><blacklist></blacklist></names>");
|
||||
}
|
||||
|
||||
if (userList.Contains(name))
|
||||
// Add removed name to blacklist
|
||||
XmlNode xnode = nameListXml.CreateElement("name");
|
||||
xnode.InnerText = name;
|
||||
nameListXml.DocumentElement.SelectSingleNode("blacklist").AppendChild(xnode);
|
||||
XmlNode nodeToRemove = null;
|
||||
|
||||
// Remove remove-name from name-list
|
||||
foreach (XmlNode node in nameListXml.DocumentElement.SelectNodes("name"))
|
||||
{
|
||||
userList.Remove(name);
|
||||
XmlNode nodeToRemove = null;
|
||||
foreach (XmlNode node in namesDoc.DocumentElement.SelectNodes("name"))
|
||||
if (node.InnerText.Equals(name, StringComparison.Ordinal))
|
||||
{
|
||||
if (node.InnerText == name)
|
||||
{
|
||||
nodeToRemove = node;
|
||||
break;
|
||||
}
|
||||
nodeToRemove = node;
|
||||
break;
|
||||
}
|
||||
if (nodeToRemove != null)
|
||||
namesDoc.DocumentElement.RemoveChild(nodeToRemove);
|
||||
}
|
||||
else
|
||||
if (nodeToRemove != null)
|
||||
{
|
||||
nameListXml.DocumentElement.RemoveChild(nodeToRemove);
|
||||
}
|
||||
try
|
||||
{
|
||||
nameListXml.Save(fileName);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
XmlNode node = namesDoc.CreateElement("removed_name");
|
||||
node.InnerText = name;
|
||||
namesDoc.DocumentElement.AppendChild(node);
|
||||
}
|
||||
namesDoc.Save(fileName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -195,7 +203,11 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
public bool Add(string name)
|
||||
{
|
||||
name = name.RemoveControlCharacters().Trim();
|
||||
if (name.Length > 1 && name.ContainsLetter())
|
||||
if (name.Length == 0 || _blackList.Contains(name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (name.ContainsLetter())
|
||||
{
|
||||
if (name.Contains(' '))
|
||||
{
|
||||
@ -207,20 +219,25 @@ namespace Nikse.SubtitleEdit.Core.Dictionaries
|
||||
_namesList.Add(name);
|
||||
}
|
||||
|
||||
var fileName = GetLocalNamesUserFileName();
|
||||
var namesEtcDoc = new XmlDocument();
|
||||
// <neutral>_names.xml e.g: en_names.xml
|
||||
var fileName = GetLocalNamesFileName();
|
||||
var nameListXml = new XmlDocument();
|
||||
if (File.Exists(fileName))
|
||||
namesEtcDoc.Load(fileName);
|
||||
{
|
||||
nameListXml.Load(fileName);
|
||||
}
|
||||
else
|
||||
namesEtcDoc.LoadXml("<ignore_words />");
|
||||
{
|
||||
nameListXml.LoadXml("<names><blacklist></blacklist></names>");
|
||||
}
|
||||
|
||||
XmlNode de = namesEtcDoc.DocumentElement;
|
||||
XmlNode de = nameListXml.DocumentElement;
|
||||
if (de != null)
|
||||
{
|
||||
XmlNode node = namesEtcDoc.CreateElement("name");
|
||||
XmlNode node = nameListXml.CreateElement("name");
|
||||
node.InnerText = name;
|
||||
de.AppendChild(node);
|
||||
namesEtcDoc.Save(fileName);
|
||||
nameListXml.Save(fileName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -266,13 +266,13 @@ namespace Nikse.SubtitleEdit.Core
|
||||
public class WordListSettings
|
||||
{
|
||||
public string LastLanguage { get; set; }
|
||||
public string NamesEtcUrl { get; set; }
|
||||
public bool UseOnlineNamesEtc { get; set; }
|
||||
public string NamesUrl { get; set; }
|
||||
public bool UseOnlineNames { get; set; }
|
||||
|
||||
public WordListSettings()
|
||||
{
|
||||
LastLanguage = "en-US";
|
||||
NamesEtcUrl = "https://raw.githubusercontent.com/SubtitleEdit/subtitleedit/master/Dictionaries/names_etc.xml";
|
||||
NamesUrl = "https://raw.githubusercontent.com/SubtitleEdit/subtitleedit/master/Dictionaries/names.xml";
|
||||
}
|
||||
}
|
||||
|
||||
@ -2159,12 +2159,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
subNode = node.SelectSingleNode("LastLanguage");
|
||||
if (subNode != null)
|
||||
settings.WordLists.LastLanguage = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("NamesEtcUrl");
|
||||
subNode = node.SelectSingleNode("Names");
|
||||
if (subNode != null)
|
||||
settings.WordLists.NamesEtcUrl = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("UseOnlineNamesEtc");
|
||||
settings.WordLists.NamesUrl = subNode.InnerText;
|
||||
subNode = node.SelectSingleNode("UseOnlineNames");
|
||||
if (subNode != null)
|
||||
settings.WordLists.UseOnlineNamesEtc = Convert.ToBoolean(subNode.InnerText);
|
||||
settings.WordLists.UseOnlineNames = Convert.ToBoolean(subNode.InnerText);
|
||||
|
||||
// Fix Common Errors
|
||||
node = doc.DocumentElement.SelectSingleNode("CommonErrors");
|
||||
@ -3367,8 +3367,8 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
textWriter.WriteStartElement("WordLists", string.Empty);
|
||||
textWriter.WriteElementString("LastLanguage", settings.WordLists.LastLanguage);
|
||||
textWriter.WriteElementString("NamesEtcUrl", settings.WordLists.NamesEtcUrl);
|
||||
textWriter.WriteElementString("UseOnlineNamesEtc", settings.WordLists.UseOnlineNamesEtc.ToString());
|
||||
textWriter.WriteElementString("Names", settings.WordLists.NamesUrl);
|
||||
textWriter.WriteElementString("UseOnlineNames", settings.WordLists.UseOnlineNames.ToString());
|
||||
textWriter.WriteEndElement();
|
||||
|
||||
textWriter.WriteStartElement("CommonErrors", string.Empty);
|
||||
|
@ -36,7 +36,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
|
||||
_languageName = languageName;
|
||||
_doSpell = doSpell;
|
||||
_namesList = new NamesList(Configuration.DictionariesDirectory, languageName, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
_namesList = new NamesList(Configuration.DictionariesDirectory, languageName, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
_namesEtcList = _namesList.GetNames();
|
||||
var namesEtcMultiWordList = _namesList.GetMultiNames();
|
||||
|
||||
@ -270,7 +270,7 @@ namespace Nikse.SubtitleEdit.Core.SpellCheck
|
||||
if (!word.EndsWith('\''))
|
||||
_namesEtcListWithApostrophe.Add(word + "'");
|
||||
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, _languageName, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, _languageName, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
namesList.Add(word);
|
||||
return true;
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
return id;
|
||||
}
|
||||
|
||||
private void ReplaceNames1Remove(List<string> namesEtc, List<string> replaceIds, List<string> replaceNames, List<string> originalNames)
|
||||
private void ReplaceNames1Remove(List<string> nameList, List<string> replaceIds, List<string> replaceNames, List<string> originalNames)
|
||||
{
|
||||
if (Post.StartsWith('.'))
|
||||
{
|
||||
@ -121,7 +121,7 @@ namespace Nikse.SubtitleEdit.Core
|
||||
|
||||
string lower = StrippedText.ToLower();
|
||||
int idName = 0;
|
||||
foreach (string name in namesEtc)
|
||||
foreach (string name in nameList)
|
||||
{
|
||||
int start = lower.IndexOf(name, StringComparison.OrdinalIgnoreCase);
|
||||
while (start >= 0 && start < lower.Length)
|
||||
@ -172,12 +172,12 @@ namespace Nikse.SubtitleEdit.Core
|
||||
}
|
||||
|
||||
private static readonly char[] ExpectedCharsArray = { '.', '!', '?', ':', ';', ')', ']', '}', '(', '[', '{' };
|
||||
public void FixCasing(List<string> namesEtc, bool changeNameCases, bool makeUppercaseAfterBreak, bool checkLastLine, string lastLine)
|
||||
public void FixCasing(List<string> nameList, bool changeNameCases, bool makeUppercaseAfterBreak, bool checkLastLine, string lastLine)
|
||||
{
|
||||
var replaceIds = new List<string>();
|
||||
var replaceNames = new List<string>();
|
||||
var originalNames = new List<string>();
|
||||
ReplaceNames1Remove(namesEtc, replaceIds, replaceNames, originalNames);
|
||||
ReplaceNames1Remove(nameList, replaceIds, replaceNames, originalNames);
|
||||
|
||||
if (checkLastLine)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (string.IsNullOrEmpty(languageName))
|
||||
languageName = "en_US";
|
||||
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, languageName, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, languageName, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
if (namesList.Add(textBoxAddName.Text))
|
||||
DialogResult = DialogResult.OK;
|
||||
else
|
||||
|
@ -59,7 +59,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
internal void FixCasing(Subtitle subtitle, string language)
|
||||
{
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
var namesEtc = namesList.GetAllNames();
|
||||
|
||||
// Longer names must be first
|
||||
@ -97,7 +97,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return text;
|
||||
}
|
||||
|
||||
private string FixCasing(string text, string lastLine, List<string> namesEtc)
|
||||
private string FixCasing(string text, string lastLine, List<string> nameList)
|
||||
{
|
||||
string original = text;
|
||||
if (radioButtonNormal.Checked)
|
||||
@ -111,7 +111,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
text = text.ToLower().Trim();
|
||||
text = text.FixExtraSpaces();
|
||||
var st = new StrippableText(text);
|
||||
st.FixCasing(namesEtc, false, true, true, lastLine); // fix all casing but names (that's a seperate option)
|
||||
st.FixCasing(nameList, false, true, true, lastLine); // fix all casing but names (that's a seperate option)
|
||||
text = st.MergedString;
|
||||
}
|
||||
}
|
||||
|
@ -110,22 +110,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void FindAllNames()
|
||||
{
|
||||
string language = LanguageAutoDetect.AutoDetectLanguageName("en_US", _subtitle);
|
||||
string language = LanguageAutoDetect.AutoDetectGoogleLanguage(_subtitle);
|
||||
if (string.IsNullOrEmpty(language))
|
||||
language = "en_US";
|
||||
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
|
||||
// Will contains both one word names and multi names
|
||||
var namesEtcList = namesList.GetAllNames();
|
||||
|
||||
if (language.StartsWith("en", StringComparison.Ordinal))
|
||||
{
|
||||
namesEtcList.Remove("Black");
|
||||
namesEtcList.Remove("Bill");
|
||||
namesEtcList.Remove("Long");
|
||||
namesEtcList.Remove("Don");
|
||||
}
|
||||
string text = HtmlUtil.RemoveHtmlTags(_subtitle.GetAllTexts());
|
||||
string textToLower = text.ToLower();
|
||||
listViewNames.BeginUpdate();
|
||||
|
@ -532,7 +532,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
string languageTwoLetterCode = LanguageAutoDetect.AutoDetectGoogleLanguage(Subtitle);
|
||||
// Will contains both one word names and multi names
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, languageTwoLetterCode, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, languageTwoLetterCode, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
_namesEtcList = namesList.GetNames();
|
||||
// Multi word names.
|
||||
foreach (var name in namesList.GetMultiNames())
|
||||
|
@ -10709,7 +10709,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
bool saveChangeCaseChanges = true;
|
||||
var casingNamesLinesChanged = 0;
|
||||
changeCasing.FixCasing(selectedLines, LanguageAutoDetect.AutoDetectLanguageName(Configuration.Settings.General.SpellCheckLanguage, _subtitle));
|
||||
changeCasing.FixCasing(selectedLines, LanguageAutoDetect.AutoDetectGoogleLanguage(_subtitle));
|
||||
if (changeCasing.ChangeNamesToo)
|
||||
{
|
||||
using (var changeCasingNames = new ChangeCasingNames())
|
||||
|
2
src/Forms/Settings.Designer.cs
generated
2
src/Forms/Settings.Designer.cs
generated
@ -3013,7 +3013,7 @@
|
||||
this.checkBoxNamesEtcOnline.Name = "checkBoxNamesEtcOnline";
|
||||
this.checkBoxNamesEtcOnline.Size = new System.Drawing.Size(163, 17);
|
||||
this.checkBoxNamesEtcOnline.TabIndex = 26;
|
||||
this.checkBoxNamesEtcOnline.Text = "Use online names etc xml file";
|
||||
this.checkBoxNamesEtcOnline.Text = "Use online names xml file";
|
||||
this.checkBoxNamesEtcOnline.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// textBoxNamesEtcOnline
|
||||
|
@ -26,7 +26,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private int _ssaFontColor;
|
||||
private string _listBoxSearchString = string.Empty;
|
||||
private DateTime _listBoxSearchStringLastUsed = DateTime.Now;
|
||||
private List<string> _wordListNamesEtc = new List<string>();
|
||||
private List<string> _wordListNames = new List<string>();
|
||||
private List<string> _userWordList = new List<string>();
|
||||
private OcrFixReplaceList _ocrFixReplaceList;
|
||||
private readonly string _oldVlcLocation;
|
||||
@ -195,8 +195,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
|
||||
var wordListSettings = Configuration.Settings.WordLists;
|
||||
checkBoxNamesEtcOnline.Checked = wordListSettings.UseOnlineNamesEtc;
|
||||
textBoxNamesEtcOnline.Text = wordListSettings.NamesEtcUrl;
|
||||
checkBoxNamesEtcOnline.Checked = wordListSettings.UseOnlineNames;
|
||||
textBoxNamesEtcOnline.Text = wordListSettings.NamesUrl;
|
||||
|
||||
comboBoxFontName.Items.Clear();
|
||||
foreach (var x in FontFamily.Families)
|
||||
@ -649,7 +649,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
buttonOK.Text = Configuration.Settings.Language.General.Ok;
|
||||
buttonCancel.Text = Configuration.Settings.Language.General.Cancel;
|
||||
|
||||
ListWordListLanguages();
|
||||
InitComboxWordListLanguages();
|
||||
|
||||
checkBoxWaveformShowGrid.Checked = Configuration.Settings.VideoControls.WaveformDrawGrid;
|
||||
checkBoxWaveformShowCps.Checked = Configuration.Settings.VideoControls.WaveformDrawCps;
|
||||
@ -1004,58 +1004,52 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
pictureBoxHelp.Image = (Image)help.Clone();
|
||||
}
|
||||
|
||||
private void ListWordListLanguages()
|
||||
private void InitComboxWordListLanguages()
|
||||
{
|
||||
//Examples: da_DK_user.xml, eng_OCRFixReplaceList.xml, en_US_names_etc.xml
|
||||
|
||||
//Examples: da_DK_user.xml, eng_OCRFixReplaceList.xml, en_names.xml
|
||||
string dir = Utilities.DictionaryFolder;
|
||||
|
||||
if (Directory.Exists(dir))
|
||||
{
|
||||
var cultures = new List<CultureInfo>();
|
||||
// Specific culture e.g: en-US, en-GB...
|
||||
foreach (var culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
|
||||
{
|
||||
string name = culture.Name;
|
||||
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
if (File.Exists(Path.Combine(dir, culture.Name.Replace('-', '_') + "_user.xml")))
|
||||
{
|
||||
if (Directory.GetFiles(dir, name.Replace('-', '_') + "_user.xml").Length == 1)
|
||||
{
|
||||
if (!cultures.Contains(culture))
|
||||
cultures.Add(culture);
|
||||
}
|
||||
|
||||
if (Directory.GetFiles(dir, name.Replace('-', '_') + "_names_etc.xml").Length == 1)
|
||||
{
|
||||
if (!cultures.Contains(culture))
|
||||
cultures.Add(culture);
|
||||
}
|
||||
if (!cultures.Contains(culture))
|
||||
cultures.Add(culture);
|
||||
}
|
||||
}
|
||||
|
||||
// Neutral culture e.g: "en" for all (en-US, en-GB, en-JM...)
|
||||
foreach (var culture in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
|
||||
{
|
||||
if (Directory.GetFiles(dir, culture.ThreeLetterISOLanguageName + "_OCRFixReplaceList.xml").Length == 1 ||
|
||||
Directory.GetFiles(dir, culture.ThreeLetterISOLanguageName + "_OCRFixReplaceList_User.xml").Length == 1)
|
||||
string ocrFixGeneralFile = Path.Combine(dir, culture.ThreeLetterISOLanguageName + "_OCRFixReplaceList.xml");
|
||||
string ocrFixUserFile = Path.Combine(dir, culture.ThreeLetterISOLanguageName + "_OCRFixReplaceList_User.xml");
|
||||
string namesFile = Path.Combine(dir, culture.TwoLetterISOLanguageName + "_names.xml");
|
||||
if (File.Exists(ocrFixGeneralFile) || File.Exists(ocrFixUserFile) || File.Exists(namesFile))
|
||||
{
|
||||
bool alreadyInList = false;
|
||||
foreach (var ci in cultures)
|
||||
{
|
||||
if (ci.ThreeLetterISOLanguageName == culture.ThreeLetterISOLanguageName)
|
||||
// If culture is already added to the list, it doesn't matter if it's "culture specific" do not re-add.
|
||||
if (ci.ThreeLetterISOLanguageName.Equals(culture.ThreeLetterISOLanguageName, StringComparison.Ordinal))
|
||||
{
|
||||
cultures.Add(culture);
|
||||
alreadyInList = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!alreadyInList)
|
||||
{
|
||||
cultures.Add(culture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
comboBoxWordListLanguage.Items.Clear();
|
||||
if (Configuration.Settings.WordLists.LastLanguage == null)
|
||||
Configuration.Settings.WordLists.LastLanguage = "en-US";
|
||||
// English is the default selected language.
|
||||
Configuration.Settings.WordLists.LastLanguage = Configuration.Settings.WordLists.LastLanguage ?? "en-US";
|
||||
foreach (var ci in cultures)
|
||||
{
|
||||
comboBoxWordListLanguage.Items.Add(new ComboBoxLanguage { CultureInfo = ci });
|
||||
if (ci.Name == Configuration.Settings.WordLists.LastLanguage)
|
||||
if (ci.Name.Equals(Configuration.Settings.WordLists.LastLanguage, StringComparison.Ordinal))
|
||||
comboBoxWordListLanguage.SelectedIndex = comboBoxWordListLanguage.Items.Count - 1;
|
||||
}
|
||||
if (comboBoxWordListLanguage.Items.Count > 0 && comboBoxWordListLanguage.SelectedIndex == -1)
|
||||
@ -1209,8 +1203,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
toolsSettings.MicrosoftBingClientSecret = textBoxBingClientSecret.Text.Trim();
|
||||
|
||||
var wordListSettings = Configuration.Settings.WordLists;
|
||||
wordListSettings.UseOnlineNamesEtc = checkBoxNamesEtcOnline.Checked;
|
||||
wordListSettings.NamesEtcUrl = textBoxNamesEtcOnline.Text;
|
||||
wordListSettings.UseOnlineNames = checkBoxNamesEtcOnline.Checked;
|
||||
wordListSettings.NamesUrl = textBoxNamesEtcOnline.Text;
|
||||
if (comboBoxWordListLanguage.Items.Count > 0 && comboBoxWordListLanguage.SelectedIndex >= 0)
|
||||
{
|
||||
var ci = comboBoxWordListLanguage.Items[comboBoxWordListLanguage.SelectedIndex] as ComboBoxLanguage;
|
||||
@ -1397,6 +1391,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
buttonRemoveOcrFix.Enabled = false;
|
||||
buttonAddOcrFix.Enabled = false;
|
||||
|
||||
// TODO: Rename listBoxNamesEtc => listBoxNames
|
||||
listBoxNamesEtc.Items.Clear();
|
||||
listBoxUserWordLists.Items.Clear();
|
||||
listBoxOcrFixList.Items.Clear();
|
||||
@ -1415,7 +1410,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// OCR fix words
|
||||
LoadOcrFixList(true);
|
||||
|
||||
LoadNamesEtc(language, true);
|
||||
LoadNames(language, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1458,15 +1453,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadNamesEtc(string language, bool reloadListBox)
|
||||
private void LoadNames(string language, bool reloadListBox)
|
||||
{
|
||||
var task = Task.Factory.StartNew(() =>
|
||||
{
|
||||
// names etc
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
_wordListNamesEtc = namesList.GetAllNames();
|
||||
_wordListNamesEtc.Sort();
|
||||
return _wordListNamesEtc;
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
_wordListNames = namesList.GetAllNames();
|
||||
_wordListNames.Sort();
|
||||
return _wordListNames;
|
||||
});
|
||||
|
||||
if (reloadListBox)
|
||||
@ -1504,11 +1499,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
string language = GetCurrentWordListLanguage();
|
||||
string text = textBoxNameEtc.Text.RemoveControlCharacters().Trim();
|
||||
if (!string.IsNullOrEmpty(language) && text.Length > 1 && !_wordListNamesEtc.Contains(text))
|
||||
if (!string.IsNullOrEmpty(language) && text.Length > 1 && !_wordListNames.Contains(text))
|
||||
{
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
namesList.Add(text);
|
||||
LoadNamesEtc(language, true);
|
||||
LoadNames(language, true);
|
||||
labelStatus.Text = string.Format(Configuration.Settings.Language.Settings.WordAddedX, text);
|
||||
textBoxNameEtc.Text = string.Empty;
|
||||
textBoxNameEtc.Focus();
|
||||
@ -1555,7 +1550,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
int removeCount = 0;
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
var namesList = new NamesList(Configuration.DictionariesDirectory, language, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
for (int idx = listBoxNamesEtc.SelectedIndices.Count - 1; idx >= 0; idx--)
|
||||
{
|
||||
index = listBoxNamesEtc.SelectedIndices[idx];
|
||||
@ -1567,7 +1562,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
if (removeCount > 0)
|
||||
{
|
||||
LoadNamesEtc(language, true); // reload
|
||||
LoadNames(language, true); // reload
|
||||
|
||||
if (index < listBoxNamesEtc.Items.Count)
|
||||
listBoxNamesEtc.SelectedIndex = index;
|
||||
@ -1579,7 +1574,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
if (removeCount < itemsToRemoveCount && Configuration.Settings.WordLists.UseOnlineNamesEtc && !string.IsNullOrEmpty(Configuration.Settings.WordLists.NamesEtcUrl))
|
||||
if (removeCount < itemsToRemoveCount && Configuration.Settings.WordLists.UseOnlineNames && !string.IsNullOrEmpty(Configuration.Settings.WordLists.NamesUrl))
|
||||
{
|
||||
MessageBox.Show(Configuration.Settings.Language.Settings.CannotUpdateNamesEtcOnline);
|
||||
return;
|
||||
|
@ -206,7 +206,7 @@ namespace Nikse.SubtitleEdit.Logic.Ocr
|
||||
}
|
||||
|
||||
// Load names etc list (names/noise words)
|
||||
_namesList = new NamesList(Configuration.DictionariesDirectory, _fiveLetterWordListLanguageName, Configuration.Settings.WordLists.UseOnlineNamesEtc, Configuration.Settings.WordLists.NamesEtcUrl);
|
||||
_namesList = new NamesList(Configuration.DictionariesDirectory, _fiveLetterWordListLanguageName, Configuration.Settings.WordLists.UseOnlineNames, Configuration.Settings.WordLists.NamesUrl);
|
||||
_namesEtcList = _namesList.GetNames();
|
||||
_namesEtcMultiWordList = _namesList.GetMultiNames();
|
||||
_namesEtcListUppercase = new HashSet<string>();
|
||||
|
@ -3,7 +3,7 @@ Contains names that should not be translated.
|
||||
This file is case sensitive.
|
||||
This file is generated/updated by Multi Translator
|
||||
-->
|
||||
<ignore_list>
|
||||
<names>
|
||||
<name>1A</name>
|
||||
<name>2A</name>
|
||||
<name>3D</name>
|
||||
@ -5589,4 +5589,4 @@ This file is generated/updated by Multi Translator
|
||||
<name>www.filmfix.se</name>
|
||||
<name>zozlow</name>
|
||||
<name>Østrig</name>
|
||||
</ignore_list>
|
||||
</names>
|
@ -89,10 +89,10 @@ namespace Test
|
||||
}
|
||||
}
|
||||
|
||||
strm = asm.GetManifestResourceStream("Test.Dictionaries.names_etc.xml");
|
||||
strm = asm.GetManifestResourceStream("Test.Dictionaries.names.xml");
|
||||
if (strm != null)
|
||||
{
|
||||
using (Stream file = File.OpenWrite(Path.Combine("Dictionaries", "names_etc.xml")))
|
||||
using (Stream file = File.OpenWrite(Path.Combine("Dictionaries", "names.xml")))
|
||||
{
|
||||
CopyStream(strm, file);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@
|
||||
<EmbeddedResource Include="Dictionaries\en_US.dic" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Dictionaries\names_etc.xml" />
|
||||
<EmbeddedResource Include="Dictionaries\names.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Files\sample.tar">
|
||||
|
Loading…
Reference in New Issue
Block a user