mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
added localization for manifest.json strings
This commit is contained in:
@@ -1,10 +1,21 @@
|
||||
{
|
||||
"notify-title": {
|
||||
"message": "My hovercraft is full of eels",
|
||||
"description": "Title of the click notification"
|
||||
"extensionName": {
|
||||
"message": "My German-language example extension",
|
||||
"description": "Name of the extension."
|
||||
},
|
||||
"notify-content": {
|
||||
|
||||
"extensionDescription": {
|
||||
"message": "Notifies the user of link clicks, in German",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
|
||||
"notificationTitle": {
|
||||
"message": "My hovercraft is full of eels",
|
||||
"description": "Title of the click notification."
|
||||
},
|
||||
|
||||
"notificationContent": {
|
||||
"message": "$1 was the link you clicked",
|
||||
"description": "Tells the user which link they clicked: the placeholder is the url"
|
||||
"description": "Tells the user which link they clicked: the placeholder is the url."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
{
|
||||
"notify-title": {
|
||||
"extensionName": {
|
||||
"message": "Notify link clicks",
|
||||
"description": "Name of the extension."
|
||||
},
|
||||
|
||||
"extensionDescription": {
|
||||
"message": "Shows a notification when the user clicks on links, on mozilla.org pages.",
|
||||
"description": "Description of the extension."
|
||||
},
|
||||
|
||||
"notificationTitle": {
|
||||
"message": "Click notification",
|
||||
"description": "Title of the click notification"
|
||||
},
|
||||
"notify-content": {
|
||||
|
||||
"notificationContent": {
|
||||
"message": "You clicked $1",
|
||||
"description": "Tells the user which link they clicked: the placeholder is the url"
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ chrome.runtime.onMessage.addListener(notify);
|
||||
|
||||
function notify(message) {
|
||||
console.log("background script received message");
|
||||
var notificationTitle = chrome.i18n.getMessage("notify-title");
|
||||
var notificationContent = chrome.i18n.getMessage("notify-content", message.url);
|
||||
var title = chrome.i18n.getMessage("notificationTitle");
|
||||
var content = chrome.i18n.getMessage("notificationContent", message.url);
|
||||
chrome.notifications.create({
|
||||
"type": "basic",
|
||||
"iconUrl": chrome.extension.getURL("link.png"),
|
||||
"title": notificationTitle,
|
||||
"message": notificationContent
|
||||
"title": title,
|
||||
"message": content
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
{
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "Notify link clicks",
|
||||
"name": "__MSG_extensionName__",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"version": "1.0",
|
||||
"applications": {
|
||||
"gecko": {
|
||||
"id": "notify-link-clicks@mozilla.org"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"permissions": ["notifications"],
|
||||
|
||||
"background": {
|
||||
|
||||
Reference in New Issue
Block a user