Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion src/_locales/de/messages.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
{
// manifest.json
"installNotificationTitle": {
"message": "$ADDON_NAME installiert",
"placeholders": {
"addon_name": { "content": "$1", "example": "Unicodify" }
}
},
"installNotificationMessage": {
"message": "Danke, dass Sie die Erweiterung „$ADDON_NAME“ installiert haben!\nVersion: $VERSION\n\nÖffnen Sie die Optionen, um die Erweiterung zu konfigurieren.",
"placeholders": {
"addon_name": { "content": "$1", "example": "Unicodify" },
"version": { "content": "$2", "example": "1.2.3" }
}
},
"updateNotificationTitle": {
"message": "$ADDON_NAME aktualisiert",
"placeholders": {
"addon_name": { "content": "$1", "example": "Unicodify" }
}
},
"updateNotificationMessage": {
"message": "Die Erweiterung „$ADDON_NAME“ wurde auf Version $VERSION aktualisiert.\nKlicken Sie, um die Versionshinweise zu sehen.\n\n$AUTOCORRECTION_MESSAGE",
"placeholders": {
"addon_name": { "content": "$1", "example": "Unicodify" },
"version": { "content": "$2", "example": "1.2.3" },
"autocorrection_message": {
"content": "$3",
"example": "Die experimentelle Unicode-Autokorrekturfunktion ist standardmäßig deaktiviert."
}
}
},
// manifest.json

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// manifest.json

Keep that here (in al files), as these are the localisations for all files.

"extensionName": {
"message": "Unicodify – Text transformer",
"description": "Name of the extension.",
Expand Down
18 changes: 18 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
{
"installNotificationTitle": {
"message": " $ADDON_NAME installed"
},
"installNotificationMessage": {
"message": "Thank you for installing the “$ADDON_NAME” add-on!\nVersion: $VERSION\n\nOpen the options/preferences page to configure this extension."
},
"updateNotificationTitle": {
"message": " $ADDON_NAME updated"
},
"updateNotificationMessage": {
"message": "The “$ADDON_NAME” add-on has been updated to version $VERSION.\nClick to see the release notes.\n\n$AUTOCORRECTION_MESSAGE"
},
"autocorrectionDisabledNow": {
"message": "The experimental Unicode autocorrection feature has been disabled by default."
},
"autocorrectionDisabledEarlier": {
"message": "The experimental Unicode autocorrection feature was disabled by default in version 0.5.1."
},
// manifest.json
"extensionName": {
"message": "Unicodify – Text transformer",
Expand Down
18 changes: 18 additions & 0 deletions src/_locales/fr/messages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
{
"installNotificationTitle": {
"message": "🎉 $ADDON_NAME installé"
},
"installNotificationMessage": {
"message": "Merci d'avoir installé l'extension “$ADDON_NAME” !\nVersion : $VERSION\n\nOuvrez les options pour configurer cette extension."
},
"updateNotificationTitle": {
"message": "✨ $ADDON_NAME mis à jour"
},
"updateNotificationMessage": {
"message": "L'extension “$ADDON_NAME” a été mise à jour vers la version $VERSION.\nCliquez pour voir les notes de version.\n\n$AUTOCORRECTION_MESSAGE"
},
"autocorrectionDisabledNow": {
"message": "La fonction expérimentale de correction Unicode a été désactivée par défaut."
},
"autocorrectionDisabledEarlier": {
"message": "La fonction expérimentale de correction Unicode était désactivée par défaut dans la version 0.5.1."
},
// manifest.json
"extensionName": {
"message": "Unicodify – Text transformer",
Expand Down
18 changes: 18 additions & 0 deletions src/_locales/tr/messages.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
{
"installNotificationTitle": {
"message": "🎉 $ADDON_NAME yüklendi"
},
"installNotificationMessage": {
"message": "“$ADDON_NAME” eklentisini yüklediğiniz için teşekkürler!\nSürüm: $VERSION\n\nEklentiyi yapılandırmak için seçenekler sayfasını açın."
},
"updateNotificationTitle": {
"message": "✨ $ADDON_NAME güncellendi"
},
"updateNotificationMessage": {
"message": "“$ADDON_NAME” eklentisi $VERSION sürümüne güncellendi.\nSürüm notlarını görmek için tıklayın.\n\n$AUTOCORRECTION_MESSAGE"
},
"autocorrectionDisabledNow": {
"message": "Deneysel Unicode otomatik düzeltme özelliği varsayılan olarak devre dışı bırakıldı."
},
"autocorrectionDisabledEarlier": {
"message": "Deneysel Unicode otomatik düzeltme özelliği 0.5.1 sürümünde varsayılan olarak devre dışı bırakılmıştı."
},
// manifest.json
"extensionName": {
"message": "Unicodify – Text transformer",
Expand Down
71 changes: 42 additions & 29 deletions src/background/modules/InstallUpgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
import * as Notifications from "/common/modules/Notifications.js";
import { getBrowserValue } from "/common/modules/BrowserCompat.js";


const notifications = new Map();


browser.notifications.onClicked.addListener((notificationId) => {
const url = notifications.get(notificationId);

if (url) {
browser.tabs.create({ url });
}
Expand All @@ -35,36 +32,52 @@ function handleInstalled(details) {
console.log(details);

const manifest = browser.runtime.getManifest();

switch (details.reason) {
case "install":
// TODO(to: 'rugk'): This will need to be localized
Notifications.showNotification(`🎉 ${manifest.name} installed`, `Thank you for installing the “${manifest.name}” add-on!\nVersion: ${manifest.version}\n\nOpen the options/preferences page to configure this extension.`);
break;
case "update":
if (Notifications.SEND) {
const [major, minor, patch = 0] = details.previousVersion.split(".").map((x) => Number.parseInt(x, 10));
// The autocorrection feature was disabled by default in version 0.5.1
const disabled = major === 0 && (minor < 5 || minor === 5 && patch === 0);
// TODO(to: 'rugk'): This will need to be localized
browser.notifications.create({
type: "basic",
iconUrl: browser.runtime.getURL("icons/icon.svg"),
title: `✨ ${manifest.name} updated`,
message: `The “${manifest.name}” add-on has been updated to version ${manifest.version}. Click to see the release notes.\n\nThe experimental Unicode autocorrection feature ${disabled ? "has been disabled by default" : "was disabled by default in version 0.5.1"}. Open the options/preferences page to reenable.`
}).then(async (notificationId) => {
const url = await getBrowserValue({
firefox: `https://addons.mozilla.org/firefox/addon/unicodify-text-transformer/versions/${manifest.version}`,
thunderbird: `https://addons.thunderbird.net/thunderbird/addon/unicodify-text-transformer/versions/${manifest.version}`,
chrome: "" // The Chrome Web Store does not show release notes
}) || `https://github.com/rugk/unicodify/releases/v${manifest.version}`;
notifications.set(notificationId, url);
});
}
break;
case "install":
Notifications.showNotification(
browser.i18n.getMessage("installNotificationTitle", manifest.name),
browser.i18n.getMessage("installNotificationMessage", [manifest.name, manifest.version])
);
break;

case "update":
if (Notifications.SEND) {
const [major, minor, patch = 0] = details.previousVersion
.split(".")
.map((x) => Number.parseInt(x, 10));

// The autocorrection feature was disabled by default in version 0.5.1
const disabled = major === 0 && (minor < 5 || (minor === 5 && patch === 0));

const autocorrectionMessage = browser.i18n.getMessage(
disabled ? "autocorrectionDisabledNow" : "autocorrectionDisabledEarlier"
);

browser.notifications.create({
type: "basic",
iconUrl: browser.runtime.getURL("icons/icon.svg"),
title: browser.i18n.getMessage("updateNotificationTitle", manifest.name),
message: browser.i18n.getMessage("updateNotificationMessage", [
manifest.name,
manifest.version,
autocorrectionMessage
])
}).then(async (notificationId) => {
const url = await getBrowserValue({
firefox: `https://addons.mozilla.org/firefox/addon/unicodify-text-transformer/versions/${manifest.version}`,
thunderbird: `https://addons.thunderbird.net/thunderbird/addon/unicodify-text-transformer/versions/${manifest.version}`,
chrome: "" // The Chrome Web Store does not show release notes
}) || `https://github.com/rugk/unicodify/releases/v${manifest.version}`;

notifications.set(notificationId, url);
});
}
break;
}
}

browser.runtime.onInstalled.addListener(handleInstalled);

// Previous exit survey: https://forms.gle/P8ThPXAvbGEkshYDA
// Previous exit survey
browser.runtime.setUninstallURL("https://cryptpad.fr/form/#/2/form/view/TyXGnnNjCOo+iC2qrvPzfO8NMK4jMg3pRKxL0mrYNs8/");