diff --git a/CHANGELOG.md b/CHANGELOG.md index 3259d3b40aa8..3a9600a6bcf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Fixed InvalidBackgroundColor flickering with Ctrl-s and File > Save database - Fixed loop when pulling changes (shared database) when current selected field has changed - Fixed [#1958](https://github.com/JabRef/jabref/issues/1958): Verbatim fields are no longer checked for HTML encoded characters by integrity checks +- Fixed [#1937](https://github.com/JabRef/jabref/issues/1937): If no help page for the current chosen language exists, the english help page will be shown ### Removed - The non-supported feature of being able to define file directories for any extension is removed. Still, it should work for older databases using the legacy `ps` and `pdf` fields, although we strongly encourage using the `file` field. diff --git a/src/main/java/net/sf/jabref/gui/help/HelpAction.java b/src/main/java/net/sf/jabref/gui/help/HelpAction.java index 33dea5b3eb2e..9ea1e917791e 100644 --- a/src/main/java/net/sf/jabref/gui/help/HelpAction.java +++ b/src/main/java/net/sf/jabref/gui/help/HelpAction.java @@ -6,6 +6,10 @@ import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; import javax.swing.Action; import javax.swing.Icon; @@ -27,6 +31,12 @@ */ public class HelpAction extends MnemonicAwareAction { + /** + * New languages of the help have to be added here + */ + private static final Set avaiableLangFiles = Stream.of("en", "de", "fr", "in", "ja") + .collect(Collectors.toCollection(HashSet::new)); + private HelpFile helpPage; @@ -67,6 +77,7 @@ public JLabel getHelpLabel(String labelText) { helpLabel.setForeground(Color.BLUE); helpLabel.setCursor(new Cursor(Cursor.HAND_CURSOR)); helpLabel.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { openHelpPage(); @@ -85,7 +96,16 @@ public void actionPerformed(ActionEvent e) { } private void openHelpPage() { - String url = "https://help.jabref.org/" + Globals.prefs.get(JabRefPreferences.LANGUAGE) + "/" + helpPage.getPageName(); - JabRefDesktop.openBrowserShowPopup(url); + String lang = Globals.prefs.get(JabRefPreferences.LANGUAGE); + StringBuilder sb = new StringBuilder("https://help.jabref.org/"); + + if (avaiableLangFiles.contains(lang)) { + sb.append(lang); + sb.append("/"); + } else { + sb.append("en/"); + } + sb.append(helpPage.getPageName()); + JabRefDesktop.openBrowserShowPopup(sb.toString()); } }