Switch to separate localized strings for "Show File"/"Show Files"

https://github.com/zotero/zotero/pull/4124#issuecomment-2114036702
This commit is contained in:
Dan Stillman 2024-05-16 01:41:17 -04:00
parent 1bf0fd7d57
commit 834ee0ff6c
4 changed files with 23 additions and 18 deletions

View file

@ -601,17 +601,20 @@ var Zotero_LocateMenu = new function() {
ViewOptions.showFile = new function() {
this.className = "zotero-menuitem-show-file";
this.hideInToolbar = true;
this.l10nId = "menu-show-file";
this.l10nArgs = { count: 1 };
this.canHandleItem = function (item) {
return ZoteroPane.canShowItemInFilesystem(item);
};
this.updateMenuItem = function (items) {
// We only care about showing 1 or many
let count = Zotero.Items.numDistinctFileAttachmentsForLabel(items) > 1 ? 2 : 1;
this.l10nArgs = { count };
if (Zotero.isMac) {
this.l10nId = 'menu-file-show-in-finder';
}
else {
// We only care about showing 1 or many
let count = Zotero.Items.numDistinctFileAttachmentsForLabel(items) > 1 ? 2 : 1;
this.l10nId = count > 1 ? 'menu-file-show-files' : 'menu-file-show-file';
}
};
this.handleItems = async function (items) {

View file

@ -179,12 +179,16 @@ const ZoteroStandalone = new function() {
let selectedItems = ZoteroPane.getSelectedItems();
let showFileMenuitem = document.getElementById('menu_showFile');
let showFileLabel = "";
let numFiles = Zotero.Items.numDistinctFileAttachmentsForLabel(selectedItems);
if (Zotero.isMac) {
showFileLabel = "menu-file-show-in-finder";
}
else {
showFileLabel = numFiles > 1 ? 'menu-file-show-files' : 'menu-file-show-file';
}
document.l10n.setAttributes(showFileMenuitem, showFileLabel);
showFileMenuitem.disabled = !numFiles;
document.l10n.setArgs(showFileMenuitem, {
// We only care about showing 1 or many
count: numFiles > 1 ? 2 : 1
});
// TEMP: Quick implementation
try {

View file

@ -319,7 +319,7 @@
<menuitem id="menu_close_tab" class="menu-type-reader" label="&closeCmd.label;" key="key_close"
accesskey="&closeCmd.accesskey;" oncommand="Zotero_Tabs.close()"/>
<menuseparator class="menu-type-library"/>
<menuitem data-l10n-id="menu-show-file" id="menu_showFile"
<menuitem id="menu_showFile"
class="menu-type-library"
oncommand="ZoteroPane.showItemsInFilesystem()"/>
<menuitem id="menu_export_files" class="menu-type-library"

View file

@ -8,16 +8,14 @@ return-or-enter =
general-remove = Remove
general-add = Add
menu-file-show-in-finder =
.label = Show in Finder
menu-file-show-file =
.label = Show File
menu-file-show-files =
.label = Show Files
menu-print =
.label = { general-print }
menu-show-file =
.label = { PLATFORM() ->
[macos] Show in Finder
*[other] { $count ->
[one] Show File
*[other] Show Files
}
}
menu-density =
.label = Density