From cf8819cc06a7349969f453aa14d1f87bd809b61c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 9 Jul 2022 18:07:07 -0400 Subject: [PATCH] Add localized string for `timestamp` CSL locator Not included in the CSL locales: https://forums.zotero.org/discussion/comment/412060/#Comment_412060 --- chrome/content/zotero/xpcom/cite.js | 5 +++++ chrome/locale/en-US/zotero/zotero.properties | 1 + test/tests/citeTest.js | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/chrome/content/zotero/xpcom/cite.js b/chrome/content/zotero/xpcom/cite.js index 634c8a2e83..acd9dd0bbf 100644 --- a/chrome/content/zotero/xpcom/cite.js +++ b/chrome/content/zotero/xpcom/cite.js @@ -47,6 +47,11 @@ Zotero.Cite = { * @return {String} - Localized string (e.g., 'Livre') */ getLocatorString: function (locator) { + // 'timestamp' not included in CSL locales + if (locator == 'timestamp') { + return Zotero.getString('citation.locator.timestamp'); + } + // Get the best CSL locale for the current Zotero locale var cslLocale = Zotero.Utilities.Internal.resolveLocale( Zotero.locale, diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 14aa45e6e2..1164a1a158 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -868,6 +868,7 @@ citation.showEditor = Show Editor… citation.hideEditor = Hide Editor… citation.citations = Citations citation.notes = Notes +citation.locator.timestamp = Timestamp report.title.default = Zotero Report report.parentItem = Parent Item: diff --git a/test/tests/citeTest.js b/test/tests/citeTest.js index 626e887be6..6137597712 100644 --- a/test/tests/citeTest.js +++ b/test/tests/citeTest.js @@ -10,6 +10,11 @@ describe("Zotero.Cite", function () { assert.equal(Zotero.Cite.getLocatorString('sub-verbo'), 'Sub verbo'); }); + it("should get 'timestamp' in en-US", function () { + Zotero.locale = 'en-US'; + assert.equal(Zotero.Cite.getLocatorString('timestamp'), 'Timestamp'); + }); + it("should get 'book' in fr-FR", function () { Zotero.locale = 'fr-FR'; assert.equal(Zotero.Cite.getLocatorString('book'), 'Livre');