From 17d9f06b658ccd428f1f7ff93e7717faf8b68ac4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 27 Mar 2022 02:36:05 -0400 Subject: [PATCH] Update more try-wrapped calls to getString --- chrome/content/zotero/exportOptions.js | 13 +++++++++---- .../content/zotero/tools/build_typeSchemaData.html | 8 +++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/exportOptions.js b/chrome/content/zotero/exportOptions.js index 2474815713..986420558c 100644 --- a/chrome/content/zotero/exportOptions.js +++ b/chrome/content/zotero/exportOptions.js @@ -72,15 +72,20 @@ var Zotero_File_Interface_Export = new function() { if(!addedOptions[option]) { // if this option is not already // presented to the user // get readable name for option + let optionLabel; try { if (option == 'includeAppLinks') { - var optionLabel = Zotero.getString("exportOptions." + option, Zotero.appName); + optionLabel = Zotero.getString("exportOptions." + option, Zotero.appName); } else { - var optionLabel = Zotero.getString("exportOptions." + option); + optionLabel = Zotero.getString("exportOptions." + option); } - } catch(e) { - var optionLabel = option; + if (optionLabel == "exportOptions." + option) { + optionLabel = option; + } + } + catch (e) { + optionLabel = option; } // right now, option interface supports only boolean values, which diff --git a/chrome/content/zotero/tools/build_typeSchemaData.html b/chrome/content/zotero/tools/build_typeSchemaData.html index 8821b1c24f..91361b5889 100644 --- a/chrome/content/zotero/tools/build_typeSchemaData.html +++ b/chrome/content/zotero/tools/build_typeSchemaData.html @@ -20,7 +20,13 @@ for (let fieldID of fieldIDs) { var fieldObj = [/* name */Zotero.ItemFields.getName(fieldID)]; try { - fieldObj.push(/* localizedString */Zotero.getString("itemFields." + fieldObj.name)); + // localizedString + let str = Zotero.getString("itemFields." + fieldObj.name); + if (str == "itemFields." + fieldObj.name) { + // Use name for localizedString + str = fieldObj[0]; + } + fieldObj.push(str); } catch(e) { fieldObj.push(/* name -> localizedString */fieldObj[0]); }