diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 3501b831..c373b7b3 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -31,10 +31,10 @@
"message": "Channel Whitelisted!"
},
"Sponsor": {
- "message": "Sponsor"
+ "message": "sponsor"
},
"Sponsors": {
- "message": "Sponsors"
+ "message": "sponsors"
},
"Segment": {
"message": "sponsor segment"
@@ -136,6 +136,102 @@
"submitCheck": {
"message": "Are you sure you want to submit this?"
},
+ "whitelistChannel": {
+ "message": "Whitelist Channel"
+ },
+ "removeFromWhitelist": {
+ "message": "Remove Channel From Whitelist"
+ },
+ "whitelistDescription": {
+ "message": "Whitelist the channels who do sponsorships ethically to encourage good behavior, or maybe if they are just entertaining and funny. Or don't, that's your call."
+ },
+ "voteOnTime": {
+ "message": "Vote On A Sponsor Time"
+ },
+ "recordTimes": {
+ "message": "Record the times of a sponsorship"
+ },
+ "soFarUHSubmited": {
+ "message": "So far, you've submitted"
+ },
+ "savedPeopleFrom": {
+ "message": "You have saved people from "
+ },
+ "viewLeaderboard": {
+ "message": "View the leaderboard"
+ },
+ "here": {
+ "message": "here"
+ },
+ "recordTimesDescription": {
+ "message": "Click the button below when the sponsorship starts and ends to record and\nsubmit it to the database."
+ },
+ "popupHint": {
+ "message": "Hint: Press the semicolon key while focused on a video report the start/end of a sponsor and quote to submit."
+ },
+ "lastTimes": {
+ "message": "Latest Sponsor Message Times Chosen"
+ },
+ "clearTimesButton": {
+ "message": "Clear Times"
+ },
+ "submitTimesButton": {
+ "message": "Submit Times"
+ },
+ "publicStats": {
+ "message": "This is used on the public stats page to show off how much you've contributed. See it"
+ },
+ "setUsername": {
+ "message": "Set Username"
+ },
+ "discordAdvert": {
+ "message": "Come join the official discord server to give suggestions and feedback!"
+ },
+ "hideThis": {
+ "message": "Hide this"
+ },
+ "Options": {
+ "message": "Options"
+ },
+ "showButtons": {
+ "message": "Hide Buttons On YouTube Player"
+ },
+ "hideButtons": {
+ "message": "Show Buttons On YouTube Player"
+ },
+ "hideButtonsDescription": {
+ "message": "This hides the buttons that appear on the YouTube player to submit sponsors. I can see this being annoying for some\n people. Instead of using the button there, this popup can be used to submit sponsors. To hide the notice that appears, \n use the button that appears on the notice saying \"Don't show this again\". You can always enable these settings again later."
+ },
+ "showInfoButton": {
+ "message": "Show Info Button On YouTube Player"
+ },
+ "hideInfoButton": {
+ "message": "Hide Info Button On YouTube Player"
+ },
+ "whatInfoButton": {
+ "message": "This is the button that opens up a popup in the YouTube page."
+ },
+ "hideDeleteButton": {
+ "message": "Hide Delete Button On YouTube Player"
+ },
+ "showDeleteButton": {
+ "message": "Show Delete Button On YouTube Player"
+ },
+ "whatDeleteButton": {
+ "message": "This is the button that allows you to clear all sponsors on the YouTube player."
+ },
+ "disableViewTracking": {
+ "message": "Disable Sponsor View Tracking"
+ },
+ "enableViewTracking": {
+ "message": "Enable Sponsor View Tracking"
+ },
+ "whatViewTracking": {
+ "message": "This feature tracks which sponsors you have skipped to let users know how much their submission has helped others and\nused as a metric along with upvotes to ensure that spam doesn't get into the database. The extension sends a message\nto the server each time you skip a sponsor. Hopefully most people don't change this setting so that the view numbers are accurate. :)"
+ },
+ "showNotice": {
+ "message": "Show Notice Again"
+ },
"longDescription": {
"message": "SponsorBlock is an extension that will skip over sponsored segments of YouTube videos. SponsorBlock is a crowdsourced browser extension that let's anyone submit the start and end time's of sponsored segments of YouTube videos. Once one person submits this information, everyone else with this extension will skip right over the sponsored segment.",
"description": "Full description of the extension on the store pages."
diff --git a/popup.html b/popup.html
index b9affd64..ac89c9b5 100644
--- a/popup.html
+++ b/popup.html
@@ -1,6 +1,6 @@
- Whitelist the channels who do sponsorships ethically to encourage good behavior, or maybe if they are just entertaining and funny. Or don't, that's your call.
+ __MSG_whitelistDescription__
-
+
-
Vote On A Sponsor Time
+
__MSG_voteOnTime__
@@ -51,47 +51,47 @@
-
Record the times of a sponsorship
+
__MSG_recordTimes__
- So far, you've submitted
+ __MSG_soFarUHSubmited__
0
- sponsors.
+ __MSG_Sponsors__.
- You have saved people from
+ __MSG_savedPeopleFrom__
0
- sponsor segments.
+ __MSG_Segments__.
+ __MSG_savedPeopleFrom__
- View the leaderboard here.
+ __MSG_viewLeaderboard__ __MSG_here__.
- Click the button below when the sponsorship starts and ends to record and
- submit it to the database.
+ __MSG_recordTimesDescription__
-
+
- Hint: Press the semicolon key while focused on a video report the start/end of a sponsor and quote to submit.
+ __MSG_popupHint__
-
Latest Sponsor Message Times Chosen
+
__MSG_lastTimes__
@@ -100,13 +100,13 @@
-
+
-
+
@@ -122,17 +122,17 @@
-
+
- This is used on the public stats page to show off how much you've contributed. See it here.
+ __MSG_publicStats__ __MSG_here__.
-
Set Username
+
__MSG_setUsername__
@@ -154,72 +154,66 @@
- Come join the official discord server to give suggestions and feedback!
+ __MSG_discordAdvert__
- Hide this
+ __MSG_hideThis__
-
+
-
Options
+
__MSG_Options__
-
-
+
+
- This hides the buttons that appear on the YouTube player to submit sponsors. I can see this being annoying for some
- people. Instead of using the button there, this popup can be used to submit sponsors. To hide the notice that appears,
- use the button that appears on the notice saying "Don't show this again". You can always enable these settings again
- later.
+ __MSG_hideButtonsDescription__
-
-
+
+
- This is the button that opens up a popup in the YouTube page.
+ __MSG_whatInfoButton__
-
-
+
+
- This is the button that allows you to clear all sponsors on the YouTube player.
+ __MSG_whatDeleteButton__
-
-
+
+
- This feature tracks which sponsors you have skipped to let users know how much their submission has helped others and
- used as a metric along with upvotes to ensure that spam doesn't get into the database. The extension sends a message
- to the server each time you skip a sponsor. Hopefully most people don't change this setting so that the view numbers
- are accurate. :)
+ __MSG_whatViewTracking__
-
+
diff --git a/popup.js b/popup.js
index 39358977..3476747a 100644
--- a/popup.js
+++ b/popup.js
@@ -1,6 +1,7 @@
//make this a function to allow this to run on the content page
function runThePopup() {
+ localizeHtmlPage();
//is it in the popup or content script
var inPopup = true;
diff --git a/utils.js b/utils.js
index a3d1ac68..d9ce3a22 100644
--- a/utils.js
+++ b/utils.js
@@ -43,6 +43,26 @@ function getYouTubeVideoID(url) {
return false;
}
}
+
+ return false;
+}
+
+function localizeHtmlPage() {
+ //Localize by replacing __MSG_***__ meta tags
+ var objects = document.getElementsByClassName("popupBody")[0].children;
+ for (var j = 0; j < objects.length; j++) {
+ var obj = objects[j];
+
+ var valStrH = obj.innerHTML.toString();
+ var valNewH = valStrH.replace(/__MSG_(\w+)__/g, function(match, v1)
+ {
+ return v1 ? chrome.i18n.getMessage(v1) : "";
+ });
+
+ if(valNewH != valStrH)
+ {
+ obj.innerHTML = valNewH;
+ }
+ }
+}
- return false;
-}
\ No newline at end of file