added localization for manifest.json strings

This commit is contained in:
Will Bamberg
2015-11-03 15:41:26 -08:00
parent 908c6be6d3
commit 4de58493ff
4 changed files with 36 additions and 13 deletions

View File

@@ -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."
}
}

View File

@@ -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"
}

View File

@@ -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
});
}

View File

@@ -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": {