From c6448bd9c1bec5e9b669b2d5ef0e590f434070a5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 24 Oct 2022 19:49:10 -0400 Subject: [PATCH] Add Zotero.Utilities.Internal.stringWithColon() for localized colons Generally just a colon, but, e.g., French adds a space before it. We'll want to replace uses of `punctuation.colon` with this. --- chrome/content/zotero/xpcom/utilities_internal.js | 12 ++++++++++++ chrome/locale/en-US/zotero/zotero.properties | 1 + 2 files changed, 13 insertions(+) diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index a31bf89a05..f08fac9b68 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -1587,6 +1587,18 @@ Zotero.Utilities.Internal = { }, + /** + * Adds a localized colon to a string (which is usually just a colon, but, e.g., in French + * there's a space before it) + * + * @param {String} + * @return {String} + */ + stringWithColon: function (str) { + return Zotero.getString('punctuation.colon.withString', str); + }, + + resolveLocale: function (locale, locales) { // If the locale exists as-is, use it if (locales.includes(locale)) { diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index da9375e50a..ccaf1c2713 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -114,6 +114,7 @@ about.getInvolved = Want to help? [Get involved] today! punctuation.openingQMark = “ punctuation.closingQMark = ” punctuation.colon = : +punctuation.colon.withString = %S: punctuation.ellipsis = … install.quickStartGuide = Zotero Quick Start Guide