Skip to content

Commit 5a36a2a

Browse files
authored
Improve person names checker (#2876)
* Improve person name checker: also test that names are in BibTeX format * Update localization * Fix el language file * Fix tests * Fix tr language file
1 parent b0b5add commit 5a36a2a

22 files changed

+61
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
2424
- All authors and editors are separated using semicolons when exporting to csv. [#2762](https://github.com/JabRef/jabref/issues/2762)
2525
- Improved wording of "Show recommendations: into "Show 'Related Articles' tab" in the preferences
2626
- We added integration of the Library of Congress catalog as a fetcher based on the [LCCN identifier](https://en.wikipedia.org/wiki/Library_of_Congress_Control_Number). [Feature request 636 in the forum](http://discourse.jabref.org/t/loc-marc-mods-connection/636)
27+
- The integrity check for person names now also tests that the names are specified in one of the standard BibTeX formats.
2728

2829
### Fixed
2930
- We fixed the adding of a new entry from DOI which led to a connection error. The DOI resolution now uses HTTPS to protect the user's privacy.[#2879](https://github.com/JabRef/jabref/issues/2897)

src/main/java/org/jabref/logic/integrity/PersonNamesChecker.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.Optional;
55

66
import org.jabref.logic.l10n.Localization;
7+
import org.jabref.model.entry.AuthorList;
78

89
public class PersonNamesChecker implements ValueChecker {
910

@@ -15,6 +16,16 @@ public Optional<String> checkValue(String value) {
1516
} else if (valueTrimmedAndLowerCase.endsWith(" and") || valueTrimmedAndLowerCase.endsWith(",")) {
1617
return Optional.of(Localization.lang("should end with a name"));
1718
}
19+
20+
// Check that the value is in one of the two standard BibTeX formats:
21+
// Last, First and ...
22+
// First Last and ...
23+
AuthorList authorList = AuthorList.parse(value);
24+
if (!authorList.getAsLastFirstNamesWithAnd(false).equals(value)
25+
&& !authorList.getAsFirstLastNamesWithAnd().equals(value)) {
26+
return Optional.of(Localization.lang("Names are not in the standard BibTeX format."));
27+
}
28+
1829
return Optional.empty();
1930
}
2031
}

src/main/resources/l10n/JabRef_da.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,4 @@ Share_anonymous_statistics=
23312331
Telemetry\:_Help_make_JabRef_better=
23322332
To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.=
23332333
This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?=
2334+
Names_are_not_in_the_standard_BibTeX_format.=

src/main/resources/l10n/JabRef_de.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,4 @@ Share_anonymous_statistics=Teile_anonyme_Statistiken
23312331
Telemetry\:_Help_make_JabRef_better=Telemetrie\:_Helfen_Sie,_JabRef_zu_verbessern
23322332
To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.=Zur_Verbesserung_der_Benutzererfahrung_würden_wir_gerne_anonyme_Statistiken_über_die_Features_sammeln,_die_Sie_benutzen._Wir_zeichnen_nur_auf,_welche_Features_Sie_nutzen_und_wie_oft_Sie_diese_benutzen._Es_werden_keinerlei_persönliche_Informationen_über_Sie_oder_den_Inhalt_Ihrer_Bibliografieeinträge_gesammelt._Die_einmal_erlaubte_Datenaufzeichnnung_kann_jederzeit_unter_Optionen->Einstellungen->Allgemein_deaktiviert werden.
23332333
This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?=
2334+
Names_are_not_in_the_standard_BibTeX_format.=

src/main/resources/l10n/JabRef_en.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,4 @@ Share_anonymous_statistics=Share_anonymous_statistics
23312331
Telemetry\:_Help_make_JabRef_better=Telemetry\:_Help_make_JabRef_better
23322332
To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.=To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.
23332333
This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?=This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?
2334+
Names_are_not_in_the_standard_BibTeX_format.=Names_are_not_in_the_standard_BibTeX_format.

src/main/resources/l10n/JabRef_es.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,4 @@ Share_anonymous_statistics=Compartir_estadísticas_anónimas
23312331
Telemetry\:_Help_make_JabRef_better=Telemetría:\_Ayude_a_mejorar_JabRef
23322332
To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.=Para_mejorar_la_experiencia_de_usuario,_nos_gustaría_recopilar_estadísitcas_anónimas_sobre_las_funcionalidades_de_JabRef_que_usa._Sólo_se_registrará_qué_funcionalidades_emplea_y_con_qué_frecuencia._No_se_recopilará_ningún_dato_personal_ni_el_contenido_de_los_elementos_bibliográficos._Si_decide_permitir_la_recopilación_de_datos,_podrá_deshabilitarlo_posteriormente_en_Opciones_->_Preferencias_->General
23332333
This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?=
2334+
Names_are_not_in_the_standard_BibTeX_format.=

src/main/resources/l10n/JabRef_fa.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,4 @@ Share_anonymous_statistics=
23312331
Telemetry\:_Help_make_JabRef_better=
23322332
To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.=
23332333
This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?=
2334+
Names_are_not_in_the_standard_BibTeX_format.=

src/main/resources/l10n/JabRef_fr.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,4 @@ Share_anonymous_statistics=Partager_anonymement_les_statistiques
23312331
Telemetry\:_Help_make_JabRef_better=Télémétrie_:_contribue_à_l'amélioration_de_JabRef
23322332
To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.=Pour_améliorer_l'ergonomie_pour_l'utilisateur,_nous_souhaiterions_collecter_des_statistiques_anonymisées_sur_les_fonctionnalité_que_vous_utilisez._Nous_n'enregistrerons_que_les_fonctionnalités_que_vous_utilisés_et_leur_fréquence_d'utiliations._Nous_n'enregistrerons_jamais_des_données_personneles_ni_le_contenu_de_vos_entrées_bibliographiques._Si_vous_choisissez_d'autoriser_la_collecte_des_données,_vous_pourrez_plus_tard_l'interdire_via_Options_->_Préférences_->_Géneral.
23332333
This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?=Ce_fichier_a_été_trouvé_automatiquement._Voulez-vous_le_lier_à_cette_entrée_?
2334+
Names_are_not_in_the_standard_BibTeX_format.=

src/main/resources/l10n/JabRef_in.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,4 @@ Share_anonymous_statistics=
23312331
Telemetry\:_Help_make_JabRef_better=
23322332
To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.=
23332333
This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?=
2334+
Names_are_not_in_the_standard_BibTeX_format.=

src/main/resources/l10n/JabRef_it.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,3 +2331,4 @@ Share_anonymous_statistics=Condividi_statistiche_anonime
23312331
Telemetry\:_Help_make_JabRef_better=Telemetria\:_Aiuta_a_migliorare_JabRef
23322332
To_improve_the_user_experience,_we_would_like_to_collect_anonymous_statistics_on_the_features_you_use._We_will_only_record_what_features_you_access_and_how_often_you_do_it._We_will_neither_collect_any_personal_data_nor_the_content_of_bibliographic_items._If_you_choose_to_allow_data_collection,_you_can_later_disable_it_via_Options_->_Preferences_->_General.=Per_migliorare_l'esperienza_utente,_vorremmo_raccogliere_delle_statistiche_anonime_sulle_funzioni_che_usi._Registreremo_solo_quali_funzioni_accedi_e_quanto_spesso._Non_registreremo_dati_personali_né_il_contenuto_delle_voci_bibliografiche._Se_scegli_di_permettere_la_raccolta_dei_dati,_potrai_disabilitarla_successivamente_da_Opzioni_->_Preferenze_->_Generale.
23332333
This_file_was_found_automatically._Do_you_want_to_link_it_to_this_entry?=
2334+
Names_are_not_in_the_standard_BibTeX_format.=

0 commit comments

Comments
 (0)