Skip to content

Commit

Permalink
Localize getDescription() and remove meaningless test methods
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Aug 6, 2024
1 parent 439aff9 commit efd80e0
Show file tree
Hide file tree
Showing 38 changed files with 74 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public String getName() {

@Override
public String getDescription() {
return "Reads the references from the 'References' section of a PDF file.";
return Localization.lang("Reads the references from the 'References' section of a PDF file.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.field.Field;
Expand Down Expand Up @@ -38,7 +39,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "Imports a Biblioscape Tag File.\nSeveral Biblioscape field types are ignored. Others are only included in the BibTeX field \"comment\".";
return Localization.lang("Imports a Biblioscape Tag File.\nSeveral Biblioscape field types are ignored. Others are only included in the BibTeX field \"comment\".");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabaseModeDetection;
import org.jabref.model.util.FileUpdateMonitor;
Expand Down Expand Up @@ -139,7 +140,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "This importer enables `--importToOpen someEntry.bib`";
return Localization.lang("This importer enables \"--importToOpen someEntry.bib\"");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.jabref.logic.exporter.CffExporter;
import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.Author;
import org.jabref.model.entry.AuthorList;
Expand Down Expand Up @@ -57,7 +58,7 @@ public String getId() {

@Override
public String getDescription() {
return "Importer for the CFF format, which is intended to make software and datasets citable.";
return Localization.lang("Importer for the CFF format, which is intended to make software and datasets citable.");
}

// POJO classes for yaml data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.jabref.logic.importer.fileformat.citavi.CitaviExchangeData.KnowledgeItems;
import org.jabref.logic.importer.fileformat.citavi.CitaviExchangeData.KnowledgeItems.KnowledgeItem;
import org.jabref.logic.importer.fileformat.citavi.CitaviExchangeData.Persons.Person;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.Author;
import org.jabref.model.entry.AuthorList;
Expand Down Expand Up @@ -108,7 +109,7 @@ public String getId() {

@Override
public String getDescription() {
return "Importer for the Citavi XML format.";
return Localization.lang("Importer for the Citavi XML format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.field.Field;
Expand Down Expand Up @@ -43,7 +44,7 @@ public String getId() {

@Override
public String getDescription() {
return "Importer for COPAC format.";
return Localization.lang("Importer for COPAC format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.jabref.logic.citationkeypattern.CitationKeyGenerator;
import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.AuthorList;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -52,7 +53,7 @@ public String getId() {

@Override
public String getDescription() {
return "Importer for the Refer/Endnote format. Modified to use article number for pages if pages are missing.";
return Localization.lang("Importer for the Refer/Endnote format. Modified to use article number for pages if pages are missing.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.jabref.logic.importer.ParseException;
import org.jabref.logic.importer.Parser;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.KeywordList;
Expand Down Expand Up @@ -121,7 +122,7 @@ public String getId() {

@Override
public String getDescription() {
return "Importer for the EndNote XML format.";
return Localization.lang("Importer for the EndNote XML format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.AuthorList;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -38,7 +39,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "INSPEC format importer.";
return Localization.lang("Importer for the INSPEC format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.jabref.logic.formatter.casechanger.TitleCaseFormatter;
import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.Month;
Expand Down Expand Up @@ -72,7 +73,7 @@ public String getId() {

@Override
public String getDescription() {
return "Importer for the ISI Web of Science, INSPEC and Medline format.";
return Localization.lang("Importer for the ISI Web of Science, INSPEC and Medline format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.jabref.logic.importer.fileformat.medline.OtherId;
import org.jabref.logic.importer.fileformat.medline.PersonalNameSubject;
import org.jabref.logic.importer.util.MathMLParser;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.Date;
Expand Down Expand Up @@ -85,7 +86,7 @@ public String getId() {

@Override
public String getDescription() {
return "Importer for the Medline format.";
return Localization.lang("Importer for the Medline format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.AuthorList;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -51,7 +52,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "Importer for the MedlinePlain format.";
return Localization.lang("Importer for the MedlinePlain format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.jabref.logic.importer.fileformat.mods.Identifier;
import org.jabref.logic.importer.fileformat.mods.Name;
import org.jabref.logic.importer.fileformat.mods.RecordInfo;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.Date;
Expand Down Expand Up @@ -624,7 +625,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "Importer for the MODS format";
return Localization.lang("Importer for the MODS format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "Takes valid JSON documents from the Mr. DLib API and parses them into a BibEntry";
return "Takes valid JSON documents from the Mr. DLib API and parses them into a BibEntry.";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.msbib.MSBibDatabase;
import org.jabref.logic.util.StandardFileType;

Expand Down Expand Up @@ -87,7 +88,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "Importer for the MS Office 2007 XML bibliography format.";
return Localization.lang("Importer for the MS Office 2007 XML bibliography format.");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.AuthorList;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -59,7 +60,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "Imports an Ovid file.";
return Localization.lang("Importer for the Ovid format.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,6 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "PdfContentImporter parses data of the first page of the PDF and creates a BibTeX entry. Currently, Springer and IEEE formats are supported.";
return Localization.lang("This importer parses data of the first page of the PDF and creates a BibTeX entry. Currently, Springer and IEEE formats are supported.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public boolean isRecognizedFormat(BufferedReader input) throws IOException {
@Override
public ParserResult importDatabase(BufferedReader reader) throws IOException {
Objects.requireNonNull(reader);
throw new UnsupportedOperationException("PdfEmbeddedBibFileImporter does not support importDatabase(BufferedReader reader)."
throw new UnsupportedOperationException("PdfEmbeddedBibFileImporter does not support importDatabase(BufferedReader reader). "
+ "Instead use importDatabase(Path filePath, Charset defaultEncoding).");
}

@Override
public ParserResult importDatabase(String data) throws IOException {
Objects.requireNonNull(data);
throw new UnsupportedOperationException("PdfEmbeddedBibFileImporter does not support importDatabase(String data)."
throw new UnsupportedOperationException("PdfEmbeddedBibFileImporter does not support importDatabase(String data). "
+ "Instead use importDatabase(Path filePath, Charset defaultEncoding).");
}

Expand Down Expand Up @@ -157,6 +157,6 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "PdfEmbeddedBibFileImporter imports an embedded Bib-File from the PDF.";
return Localization.lang("Imports a BibTeX file found inside a PDF.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.importer.util.GrobidService;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.logic.util.io.FileUtil;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -91,6 +92,6 @@ public String getId() {

@Override
public String getDescription() {
return "Wraps the GrobidService function to be used as an Importer.";
return Localization.lang("Imports BibTeX data of a PDF using Grobid.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "PdfVerbatimBibTextImporter imports a verbatim BibTeX entry from the first page of the PDF.";
return Localization.lang("Scrapes the first page of a PDF for BibTeX information.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ public String getId() {

@Override
public String getDescription() {
return "Wraps the XMPUtility function to be used as an Importer.";
return Localization.lang("Imports BibTeX data using XMP data of a PDF.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.jabref.logic.importer.ImportFormatPreferences;
import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.Date;
Expand Down Expand Up @@ -170,7 +171,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "Imports a New Economics Papers-Message from the REPEC-NEP Service.";
return Localization.lang("Imports a New Economics Papers-Message from the REPEC-NEP Service.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.jabref.logic.importer.Importer;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.AuthorList;
import org.jabref.model.entry.BibEntry;
Expand Down Expand Up @@ -45,7 +46,7 @@ public StandardFileType getFileType() {

@Override
public String getDescription() {
return "Imports a Biblioscape Tag File.";
return Localization.lang("Imports a Biblioscape tag file.");
}

@Override
Expand Down
23 changes: 23 additions & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,30 @@ Could\ not\ extract\ Metadata\ from\:\ %0=Could not extract Metadata from: %0
Parse\ Metadata\ from\ PDF.=Parse Metadata from PDF.
Merge\ PDF\ metadata=Merge PDF metadata

Importer\ for\ COPAC\ format.=Importer for COPAC format.
Importer\ for\ the\ CFF\ format,\ which\ is\ intended\ to\ make\ software\ and\ datasets\ citable.=Importer for the CFF format, which is intended to make software and datasets citable.
Importer\ for\ the\ Citavi\ XML\ format.=Importer for the Citavi XML format.
Importer\ for\ the\ EndNote\ XML\ format.=Importer for the EndNote XML format.
Importer\ for\ the\ INSPEC\ format.=Importer for the INSPEC format.
Importer\ for\ the\ ISI\ Web\ of\ Science,\ INSPEC\ and\ Medline\ format.=Importer for the ISI Web of Science, INSPEC and Medline format.
Importer\ for\ the\ MODS\ format.=Importer for the MODS format.
Importer\ for\ the\ MS\ Office\ 2007\ XML\ bibliography\ format.=Importer for the MS Office 2007 XML bibliography format.
Importer\ for\ the\ Medline\ format.=Importer for the Medline format.
Importer\ for\ the\ MedlinePlain\ format.=Importer for the MedlinePlain format.
Importer\ for\ the\ Ovid\ format.=Importer for the Ovid format.
Importer\ for\ the\ Refer/Endnote\ format.\ Modified\ to\ use\ article\ number\ for\ pages\ if\ pages\ are\ missing.=Importer for the Refer/Endnote format. Modified to use article number for pages if pages are missing.
Imports\ BibTeX\ data\ from\ a\ PDF\ using\ multiple\ strategies\ (e.g.,\ XMP,\ embedded\ BibTeX,\ text\ parsing,\ Grobid,\ and\ DOI\ lookup)\ and\ merges\ the\ result.=Imports BibTeX data from a PDF using multiple strategies (e.g., XMP, embedded BibTeX, text parsing, Grobid, and DOI lookup) and merges the result.
Imports\ BibTeX\ data\ of\ a\ PDF\ using\ Grobid.=Imports BibTeX data of a PDF using Grobid.
Imports\ BibTeX\ data\ using\ XMP\ data\ of\ a\ PDF.=Imports BibTeX data using XMP data of a PDF.
Imports\ a\ BibTeX\ file\ found\ inside\ a\ PDF.=Imports a BibTeX file found inside a PDF.
Imports\ a\ Biblioscape\ Tag\ File.\nSeveral\ Biblioscape\ field\ types\ are\ ignored.\ Others\ are\ only\ included\ in\ the\ BibTeX\ field\ "comment".=Imports a Biblioscape Tag File.\nSeveral Biblioscape field types are ignored. Others are only included in the BibTeX field "comment".
Imports\ a\ Biblioscape\ tag\ file.=Imports a Biblioscape tag file.
Imports\ a\ New\ Economics\ Papers-Message\ from\ the\ REPEC-NEP\ Service.=Imports a New Economics Papers-Message from the REPEC-NEP Service.
No\ BibTeX\ was\ found.\ An\ empty\ entry\ was\ created\ with\ file\ link.=No BibTeX was found. An empty entry was created with file link.
Reads\ the\ references\ from\ the\ 'References'\ section\ of\ a\ PDF\ file.=Reads the references from the 'References' section of a PDF file.
Scrapes\ the\ first\ page\ of\ a\ PDF\ for\ BibTeX\ information.=Scrapes the first page of a PDF for BibTeX information.
This\ importer\ enables\ "--importToOpen\ someEntry.bib"=This importer enables "--importToOpen someEntry.bib"
This\ importer\ parses\ data\ of\ the\ first\ page\ of\ the\ PDF\ and\ creates\ a\ BibTeX\ entry.\ Currently,\ Springer\ and\ IEEE\ formats\ are\ supported.=This importer parses data of the first page of the PDF and creates a BibTeX entry. Currently, Springer and IEEE formats are supported.

Exporting\ %0=Exporting %0
Could\ not\ export\ file\ '%0'\ (reason\:\ %1)=Could not export file '%0' (reason: %1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,4 @@ public void getCLIId() {
public void sGetExtensions() {
assertEquals(StandardFileType.TXT, importer.getFileType());
}

@Test
public void getDescription() {
assertEquals("INSPEC format importer.", importer.getDescription());
}
}
Loading

0 comments on commit efd80e0

Please sign in to comment.