Work around Fluent issue leaving "{$version}" in post-upgrade banner

Some users see the literal "{$version}" placeholder in the banner,
likely due to some Fluent quirk triggered by plugin localizations.
(Missing localizations? Missing strings?) After translation, check the
version span and substitute manually if needed.

https://forums.zotero.org/discussion/129171/version-variable-is-displayed-in-zotero-8-upgrade-banner/p1
https://forums.zotero.org/discussion/130864/just-upgraded-to-zotero-9-on-debian-through-check-for-updates-and/p1
This commit is contained in:
Dan Stillman 2026-04-17 11:26:15 -04:00
parent 11c75ae6e5
commit 45596e70e9

View file

@ -6705,6 +6705,18 @@ var ZoteroPane = new function () {
let link = document.getElementById('post-upgrade-new-features-link');
link.href = ZOTERO_CONFIG.NEW_FEATURES_URL.replace('{version}', majorVersion);
document.getElementById('post-upgrade-container').removeAttribute('collapsed');
// Workaround for a Fluent issue (possibly triggered by plugin localizations) where
// $version isn't substituted, leaving "{$version}" visible in the banner. The same issue
// can cause other problems, and it would be good to figure out what's triggering it, but
// this one is visible enough that it's worth fixing manually.
document.l10n.translateElements([div]).then(() => {
let span = document.getElementById('post-upgrade-appver');
if (span.textContent.includes('$version')) {
span.textContent = span.textContent
.replace(/\{\s*\$version\s*\}/g, majorVersion);
}
});
};