Update more try-wrapped calls to getString

This commit is contained in:
Dan Stillman 2022-03-27 02:36:05 -04:00
parent 0842b16a51
commit 17d9f06b65
2 changed files with 16 additions and 5 deletions

View file

@ -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

View file

@ -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]);
}