Kaynağa Gözat

i18n integration

Gildas 7 yıl önce
ebeveyn
işleme
8ff56052ea

+ 238 - 0
_locales/en/messages.json

@@ -0,0 +1,238 @@
+{
+    "extensionDescription": {
+        "message": "Save a complete page into a single HTML file",
+        "description": "Description of the extension."
+    },
+    "menuSavePage": {
+        "message": "Save page with SingleFile",
+        "description": "Menu entry: 'Save page with SingleFile'"
+    },
+    "menuSaveSelection": {
+        "message": "Save selection",
+        "description": "Menu entry: 'Save selection'"
+    },
+    "menuSaveFrame": {
+        "message": "Save frame",
+        "description": "Menu entry: 'Save frame'"
+    },
+    "menuSaveSelectedTabs": {
+        "message": "Save selected tabs",
+        "description": "Menu entry: 'Save selected tabs'"
+    },
+    "menuUnpinnedTabs": {
+        "message": "Save unpinned tabs",
+        "description": "Menu entry: 'Save unpinned tabs'"
+    },
+    "menuAllTabs": {
+        "message": "Save all tabs",
+        "description": "Menu entry: 'Save all tabs'"
+    },
+    "menuAutoSave": {
+        "message": "Auto-save",
+        "description": "Menu entry: 'Auto-save'"
+    },
+    "menuAutoSaveDisabled": {
+        "message": "Disabled",
+        "description": "Menu entry: 'Auto-save' > Disabled'"
+    },
+    "menuAutoSaveTab": {
+        "message": "Auto-save this tab",
+        "description": "Menu entry: 'Auto-save' > Auto-save this tab'"
+    },
+    "menuAutoSaveUnpinnedTabs": {
+        "message": "Auto-save unpinned tabs",
+        "description": "Menu entry: 'Auto-save' > Auto-save unpinned tabs'"
+    },
+    "menuAutoSaveAllTabs": {
+        "message": "Auto-save all tabs",
+        "description": "Menu entry: 'Auto-save' > Auto-save all tabs'"
+    },
+    "buttonDefaultTooltip": {
+        "message": "Save page with SingleFile",
+        "description": "Button title: 'Save page with SingleFile'"
+    },
+    "buttonInitializingTooltip": {
+        "message": "Initializing SingleFile",
+        "description": "Button title during initialization: 'Initializing SingleFile (x/2)'"
+    },
+    "buttonInitializingBadge": {
+        "message": "•••",
+        "description": "Badge label during initialization: '•••'"
+    },
+    "buttonSaveProgressTooltip": {
+        "message": "Save progress: ",
+        "description": "Button title during save: 'Save progress: xx%'"
+    },
+    "buttonOKBadge": {
+        "message": "OK",
+        "description": "Badge label: 'OK'"
+    },
+    "buttonErrorBadge": {
+        "message": "ERR",
+        "description": "Badge label for unexpected errors"
+    },
+    "buttonAutoSaveActiveTooltip": {
+        "message": "Auto-save active",
+        "description": "Button title: 'Auto-save active'"
+    },
+    "buttonAutoSaveActiveBadge": {
+        "message": "[A]",
+        "description": "Badge label when auto-save is active"
+    },
+    "optionsTitle": {
+        "message": "Options",
+        "description": "Options page title"
+    },
+    "optionsUserInterfaceSubTitle": {
+        "message": "User interface",
+        "description": "Options sub-title: 'User interface'"
+    },
+    "optionAddMenuEntry": {
+        "message": "add entry in the context menu of the webpage",
+        "description": "Options page label: 'add entry in the context menu of the webpage'"
+    },
+    "optionDisplayInfobar": {
+        "message": "display an infobar when viewing a saved page",
+        "description": "Options page label: 'display an infobar when viewing a saved page'"
+    },
+    "optionDisplayShadow": {
+        "message": "overlay a shadow on the page during processing",
+        "description": "Options page label: 'overlay a shadow on the page during processing'"
+    },
+    "optionsFileNameSubTitle": {
+        "message": "File name",
+        "description": "Options sub-title: 'File name'"
+    },
+    "optionAppendSaveDate": {
+        "message": "append the save date to the file name",
+        "description": "Options page label: 'append the save date to the file name'"
+    },
+    "optionConfirmFilename": {
+        "message": "open the \"Save as\" dialog to confirm the file name",
+        "description": "Options page label: 'open the \"Save as\" dialog to confirm the file name'"
+    },
+    "optionsHTMLContentSubTitle": {
+        "message": "HTML content",
+        "description": "Options sub-title: 'HTML content'"
+    },
+    "optionCompressHTML": {
+        "message": "compress HTML content",
+        "description": "Options page label: 'compress HTML content'"
+    },
+    "optionRemoveImports": {
+        "message": "remove HTML imports",
+        "description": "Options page label: 'remove HTML imports'"
+    },
+    "optionRemoveFrames": {
+        "message": "remove frames",
+        "description": "Options page label: 'remove frames'"
+    },
+    "optionRemoveHiddenElements": {
+        "message": "remove hidden elements",
+        "description": "Options page label: 'remove hidden elements'"
+    },
+    "optionsImagesSubTitle": {
+        "message": "Images",
+        "description": "Options sub-title: 'Images'"
+    },
+    "optionLazyLoadImages": {
+        "message": "save deferred images",
+        "description": "Options page label: 'save deferred images'"
+    },
+    "optionRemoveAlternativeImages": {
+        "message": "remove images for alternative screen resolutions",
+        "description": "Options page label: 'remove images for alternative screen resolutions'"
+    },
+    "optionsStylesheetsSubTitle": {
+        "message": "Stylesheets",
+        "description": "Options sub-title: 'Stylesheets'"
+    },
+    "optionCompressCSS": {
+        "message": "compress CSS content",
+        "description": "Options page label: 'compress CSS content'"
+    },
+    "optionRemoveUnusedStyles": {
+        "message": "remove unused styles",
+        "description": "Options page label: 'remove unused styles'"
+    },
+    "optionRemoveAlternativeFonts": {
+        "message": "remove alternative fonts to woff/otf and unused fonts",
+        "description": "Options page label: 'remove alternative fonts to woff/otf and unused fonts'"
+    },
+    "optionRemoveAlternativeMedias": {
+        "message": "remove stylesheets for alternative devices to screens",
+        "description": "Options page label: 'remove stylesheets for alternative devices to screens'"
+    },
+    "optionsOtherResourcesSubTitle": {
+        "message": "Other resources",
+        "description": "Options sub-title: 'Other resources'"
+    },
+    "optionRemoveScripts": {
+        "message": "remove scripts",
+        "description": "Options page label: 'remove scripts'"
+    },
+    "optionRemoveVideo": {
+        "message": "remove video sources",
+        "description": "Options page label: 'remove video sources'"
+    },
+    "optionRemoveAudio": {
+        "message": "remove audio sources",
+        "description": "Options page label: 'remove audio sources'"
+    },
+    "optionsAutoSaveSubTitle": {
+        "message": "Auto-save",
+        "description": "Options sub-title: 'Auto-save'"
+    },
+    "optionAutoSaveLoadOrUnload": {
+        "message": "auto-save after page load or on page unload",
+        "description": "auto-save after page load or on page unload"
+    },
+    "optionAutoSaveLoad": {
+        "message": "auto-save after page load",
+        "description": "Options page label: 'auto-save after page load'"
+    },
+    "optionAutoSaveUnload": {
+        "message": "auto-save on page unload",
+        "description": "Options page label: 'auto-save on page unload'"
+    },
+    "optionAutoSaveDelay": {
+        "message": "auto-save waiting delay after page load (sec.)",
+        "description": "Options page label: 'auto-save waiting delay after page load (sec.)'"
+    },
+    "optionsMiscSubTitle": {
+        "message": "Misc.",
+        "description": "Options sub-title: 'Misc.'"
+    },
+    "optionBackgroundSave": {
+        "message": "save pages in background",
+        "description": "Options page label: 'save pages in background'"
+    },
+    "optionDisplayStats": {
+        "message": "display stats in the console after processing",
+        "description": "Options page label: 'display stats in the console after processing'"
+    },
+    "optionSetMaxResourceSize": {
+        "message": "set a maximum size for embedded resources",
+        "description": "Options page label: 'set a maximum size for embedded resources'"
+    },
+    "optionMaxResourceSize": {
+        "message": "maximum size (Mb)",
+        "description": "Options page label: 'maximum size (Mb)'"
+    },
+    "optionSaveRawPage": {
+        "message": "save raw page",
+        "description": "Options page label: 'save raw page'"
+    },
+    "optionsHelpLink": {
+        "message": "help",
+        "description": "Options help link"
+    },
+    "optionsResetButton": {
+        "message": "Reset",
+        "description": "Options button: 'Reset'"
+    },
+    "optionsResetTooltip": {
+        "message": "Reset all options to their default values",
+        "description": "Options 'Reset' button tooltip"
+    }
+}

+ 81 - 1
extension/ui/bg/options.js

@@ -23,6 +23,45 @@
 (async () => {
 
 	const bgPage = await browser.runtime.getBackgroundPage();
+	const removeHiddenElementsLabel = document.getElementById("removeHiddenElementsLabel");
+	const removeUnusedStylesLabel = document.getElementById("removeUnusedStylesLabel");
+	const removeFramesLabel = document.getElementById("removeFramesLabel");
+	const removeImportsLabel = document.getElementById("removeImportsLabel");
+	const removeScriptsLabel = document.getElementById("removeScriptsLabel");
+	const saveRawPageLabel = document.getElementById("saveRawPageLabel");
+	const compressHTMLLabel = document.getElementById("compressHTMLLabel");
+	const compressCSSLabel = document.getElementById("compressCSSLabel");
+	const lazyLoadImagesLabel = document.getElementById("lazyLoadImagesLabel");
+	const addMenuEntryLabel = document.getElementById("addMenuEntryLabel");
+	const appendSaveDateLabel = document.getElementById("appendSaveDateLabel");
+	const shadowEnabledLabel = document.getElementById("shadowEnabledLabel");
+	const setMaxResourceSizeLabel = document.getElementById("setMaxResourceSizeLabel");
+	const maxResourceSizeLabel = document.getElementById("maxResourceSizeLabel");
+	const confirmFilenameLabel = document.getElementById("confirmFilenameLabel");
+	const removeAudioLabel = document.getElementById("removeAudioLabel");
+	const removeVideoLabel = document.getElementById("removeVideoLabel");
+	const displayInfobarLabel = document.getElementById("displayInfobarLabel");
+	const displayStatsLabel = document.getElementById("displayStatsLabel");
+	const backgroundSaveLabel = document.getElementById("backgroundSaveLabel");
+	const autoSaveDelayLabel = document.getElementById("autoSaveDelayLabel");
+	const autoSaveLoadLabel = document.getElementById("autoSaveLoadLabel");
+	const autoSaveUnloadLabel = document.getElementById("autoSaveUnloadLabel");
+	const autoSaveLoadOrUnloadLabel = document.getElementById("autoSaveLoadOrUnloadLabel");
+	const removeAlternativeFontsLabel = document.getElementById("removeAlternativeFontsLabel");
+	const removeAlternativeImagesLabel = document.getElementById("removeAlternativeImagesLabel");
+	const removeAlternativeMediasLabel = document.getElementById("removeAlternativeMediasLabel");
+	const titleLabel = document.getElementById("titleLabel");
+	const userInterfaceLabel = document.getElementById("userInterfaceLabel");
+	const filenameLabel = document.getElementById("filenameLabel");
+	const htmlContentLabel = document.getElementById("htmlContentLabel");
+	const imagesLabel = document.getElementById("imagesLabel");
+	const stylesheetsLabel = document.getElementById("stylesheetsLabel");
+	const otherResourcesLabel = document.getElementById("otherResourcesLabel");
+	const autoSaveLabel = document.getElementById("autoSaveLabel");
+	const miscLabel = document.getElementById("miscLabel");
+	const helpLabel = document.getElementById("helpLabel");
+	const resetButton = document.getElementById("resetButton");
+
 	const removeHiddenElementsInput = document.getElementById("removeHiddenElementsInput");
 	const removeUnusedStylesInput = document.getElementById("removeUnusedStylesInput");
 	const removeFramesInput = document.getElementById("removeFramesInput");
@@ -51,7 +90,7 @@
 	const removeSrcSetInput = document.getElementById("removeSrcSetInput");
 	const removeAlternativeMediasInput = document.getElementById("removeAlternativeMediasInput");
 	let pendingSave = Promise.resolve();
-	document.getElementById("resetButton").addEventListener("click", async () => {
+	resetButton.addEventListener("click", async () => {
 		await bgPage.singlefile.config.reset();
 		await refresh();
 		await update();
@@ -72,6 +111,47 @@
 		await bgPage.singlefile.ui.autosave.refresh();
 	}, false);
 	document.body.onchange = update;
+
+	removeHiddenElementsLabel.textContent = browser.i18n.getMessage("optionRemoveHiddenElements");
+	removeUnusedStylesLabel.textContent = browser.i18n.getMessage("optionRemoveUnusedStyles");
+	removeFramesLabel.textContent = browser.i18n.getMessage("optionRemoveFrames");
+	removeImportsLabel.textContent = browser.i18n.getMessage("optionRemoveImports");
+	removeScriptsLabel.textContent = browser.i18n.getMessage("optionRemoveScripts");
+	saveRawPageLabel.textContent = browser.i18n.getMessage("optionSaveRawPage");
+	compressHTMLLabel.textContent = browser.i18n.getMessage("optionCompressHTML");
+	compressCSSLabel.textContent = browser.i18n.getMessage("optionCompressCSS");
+	lazyLoadImagesLabel.textContent = browser.i18n.getMessage("optionLazyLoadImages");
+	addMenuEntryLabel.textContent = browser.i18n.getMessage("optionAddMenuEntry");
+	appendSaveDateLabel.textContent = browser.i18n.getMessage("optionAppendSaveDate");
+	shadowEnabledLabel.textContent = browser.i18n.getMessage("optionDisplayShadow");
+	setMaxResourceSizeLabel.textContent = browser.i18n.getMessage("optionSetMaxResourceSize");
+	maxResourceSizeLabel.textContent = browser.i18n.getMessage("optionMaxResourceSize");
+	confirmFilenameLabel.textContent = browser.i18n.getMessage("optionConfirmFilename");
+	removeAudioLabel.textContent = browser.i18n.getMessage("optionRemoveAudio");
+	removeVideoLabel.textContent = browser.i18n.getMessage("optionRemoveVideo");
+	displayInfobarLabel.textContent = browser.i18n.getMessage("optionDisplayInfobar");
+	displayStatsLabel.textContent = browser.i18n.getMessage("optionDisplayStats");
+	backgroundSaveLabel.textContent = browser.i18n.getMessage("optionBackgroundSave");
+	autoSaveDelayLabel.textContent = browser.i18n.getMessage("optionAutoSaveDelay");
+	autoSaveLoadLabel.textContent = browser.i18n.getMessage("optionAutoSaveLoad");
+	autoSaveUnloadLabel.textContent = browser.i18n.getMessage("optionAutoSaveUnload");
+	autoSaveLoadOrUnloadLabel.textContent = browser.i18n.getMessage("optionAutoSaveLoadOrUnload");
+	removeAlternativeFontsLabel.textContent = browser.i18n.getMessage("optionRemoveAlternativeFonts");
+	removeAlternativeImagesLabel.textContent = browser.i18n.getMessage("optionRemoveAlternativeImages");
+	removeAlternativeMediasLabel.textContent = browser.i18n.getMessage("optionRemoveAlternativeMedias");
+	titleLabel.textContent = browser.i18n.getMessage("optionsTitle");
+	userInterfaceLabel.textContent = browser.i18n.getMessage("optionsUserInterfaceSubTitle");
+	filenameLabel.textContent = browser.i18n.getMessage("optionsFileNameSubTitle");
+	htmlContentLabel.textContent = browser.i18n.getMessage("optionsHTMLContentSubTitle");
+	imagesLabel.textContent = browser.i18n.getMessage("optionsImagesSubTitle");
+	stylesheetsLabel.textContent = browser.i18n.getMessage("optionsStylesheetsSubTitle");
+	otherResourcesLabel.textContent = browser.i18n.getMessage("optionsOtherResourcesSubTitle");
+	autoSaveLabel.textContent = browser.i18n.getMessage("optionsAutoSaveSubTitle");
+	miscLabel.textContent = browser.i18n.getMessage("optionsMiscSubTitle");
+	helpLabel.textContent = browser.i18n.getMessage("optionsHelpLink");
+	resetButton.textContent = browser.i18n.getMessage("optionsResetButton");	
+	resetButton.title = browser.i18n.getMessage("optionsResetTooltip");
+
 	refresh();
 
 	async function refresh() {

+ 7 - 7
extension/ui/bg/ui-button.js

@@ -24,7 +24,7 @@ singlefile.ui.button = (() => {
 
 	const DEFAULT_ICON_PATH = "/extension/ui/resources/icon_16.png";
 	const WAIT_ICON_PATH_PREFIX = "/extension/ui/resources/icon_16_wait";
-	const DEFAULT_TITLE = "Save page with SingleFile";
+	const DEFAULT_TITLE = browser.i18n.getMessage("buttonDefaultTooltip");
 	const DEFAULT_COLOR = [2, 147, 20, 255];
 	const BUTTON_PROPERTIES = [{ name: "color", browserActionMethod: "setBadgeBackgroundColor" }, { name: "path", browserActionMethod: "setIcon" }, { name: "text", browserActionMethod: "setBadgeText" }, { name: "title", browserActionMethod: "setTitle" }];
 
@@ -106,21 +106,21 @@ singlefile.ui.button = (() => {
 	}
 
 	function onInitialize(tabId, options, step) {
-		refresh(tabId, getProperties(tabId, options, "•••", step == 1 ? DEFAULT_COLOR : [4, 229, 36, 255], "Initializing SingleFile (" + step + "/2)"));
+		refresh(tabId, getProperties(tabId, options, browser.i18n.getMessage("buttonInitializingBadge"), step == 1 ? DEFAULT_COLOR : [4, 229, 36, 255], browser.i18n.getMessage("buttonInitializingTooltip") + " (" + step + "/2)"));
 	}
 
 	function onError(tabId, options) {
-		refresh(tabId, getProperties(tabId, options, "ERR", [229, 4, 12, 255]));
+		refresh(tabId, getProperties(tabId, options, browser.i18n.getMessage("buttonErrorBadge"), [229, 4, 12, 255]));
 	}
 
 	async function onEnd(tabId, options) {
-		refresh(tabId, getProperties(tabId, options, "OK", [4, 229, 36, 255]));
+		refresh(tabId, getProperties(tabId, options, browser.i18n.getMessage("buttonOKBadge"), [4, 229, 36, 255]));
 	}
 
 	function onProgress(tabId, index, maxIndex, options) {
 		const progress = Math.max(Math.min(20, Math.floor((index / maxIndex) * 20)), 0);
 		const barProgress = Math.floor((index / maxIndex) * 8);
-		refresh(tabId, getProperties(tabId, options, "", [4, 229, 36, 255], "Save progress: " + (progress * 5) + "%", WAIT_ICON_PATH_PREFIX + barProgress + ".png", progress, barProgress, [128, 128, 128, 255]));
+		refresh(tabId, getProperties(tabId, options, "", [4, 229, 36, 255], browser.i18n.getMessage("buttonSaveProgressTooltip") + (progress * 5) + "%", WAIT_ICON_PATH_PREFIX + barProgress + ".png", progress, barProgress, [128, 128, 128, 255]));
 	}
 
 	async function onTabActivated(tab) {
@@ -145,9 +145,9 @@ singlefile.ui.button = (() => {
 
 	function getProperties(tabId, options, text, color, title = DEFAULT_TITLE, path = DEFAULT_ICON_PATH, progress = -1, barProgress = -1, autoColor = [208, 208, 208, 255]) {
 		return {
-			text: options.autoSave ? "[A]" : (text || ""),
+			text: options.autoSave ? browser.i18n.getMessage("buttonAutoSaveActiveBadge") : (text || ""),
 			color: options.autoSave ? autoColor : color || DEFAULT_COLOR,
-			title: options.autoSave ? "Autosave active" : title,
+			title: options.autoSave ? browser.i18n.getMessage("buttonAutoSaveActiveTooltip") : title,
 			path: options.autoSave ? DEFAULT_ICON_PATH : path,
 			progress: options.autoSave ? - 1 : progress,
 			barProgress: options.autoSave ? - 1 : barProgress

+ 11 - 12
extension/ui/bg/ui-menu.js

@@ -22,7 +22,6 @@
 
 singlefile.ui.menu = (() => {
 
-	const DEFAULT_TITLE = "Save page with SingleFile";
 	const BROWSER_MENUS_API_SUPPORTED = browser.menus && browser.menus.onClicked && browser.menus.create && browser.menus.update && browser.menus.removeAll;
 	const MENU_ID_SAVE_PAGE = "save-page";
 	const MENU_ID_SAVE_SELECTED = "save-selected";
@@ -58,7 +57,7 @@ singlefile.ui.menu = (() => {
 				browser.menus.create({
 					id: MENU_ID_SAVE_PAGE,
 					contexts: pageContextsEnabled,
-					title: DEFAULT_TITLE
+					title: browser.i18n.getMessage("menuSavePage")
 				});
 			}
 			if (config.contextMenuEnabled) {
@@ -71,29 +70,29 @@ singlefile.ui.menu = (() => {
 			browser.menus.create({
 				id: MENU_ID_SAVE_SELECTED,
 				contexts: config.contextMenuEnabled ? defaultContextsDisabled.concat(["selection"]) : defaultContextsDisabled,
-				title: "Save selection"
+				title: browser.i18n.getMessage("menuSaveSelection")
 			});
 			if (config.contextMenuEnabled) {
 				browser.menus.create({
 					id: MENU_ID_SAVE_FRAME,
 					contexts: ["frame"],
-					title: "Save frame"
+					title: browser.i18n.getMessage("menuSaveFrame")
 				});
 				browser.menus.create({
 					id: MENU_ID_SAVE_SELECTED_TABS,
 					contexts: pageContextsEnabled,
-					title: "Save selected tabs"
+					title: browser.i18n.getMessage("menuSaveSelectedTabs")
 				});
 			}
 			browser.menus.create({
 				id: MENU_ID_SAVE_UNPINNED_TABS,
 				contexts: defaultContexts,
-				title: "Save unpinned tabs"
+				title: browser.i18n.getMessage("menuUnpinnedTabs")
 			});
 			browser.menus.create({
 				id: MENU_ID_SAVE_ALL_TABS,
 				contexts: defaultContexts,
-				title: "Save all tabs"
+				title: browser.i18n.getMessage("menuAllTabs")
 			});
 			if (config.contextMenuEnabled) {
 				browser.menus.create({
@@ -105,12 +104,12 @@ singlefile.ui.menu = (() => {
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE,
 				contexts: defaultContexts,
-				title: "Auto-save"
+				title: browser.i18n.getMessage("menuAutoSave")
 			});
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE_DISABLED,
 				type: "radio",
-				title: "Disabled",
+				title: browser.i18n.getMessage("menuAutoSaveDisabled"),
 				contexts: defaultContexts,
 				checked: true,
 				parentId: MENU_ID_AUTO_SAVE
@@ -118,7 +117,7 @@ singlefile.ui.menu = (() => {
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE_TAB,
 				type: "radio",
-				title: "Auto-save this tab",
+				title: browser.i18n.getMessage("menuAutoSaveTab"),
 				contexts: defaultContexts,
 				checked: false,
 				parentId: MENU_ID_AUTO_SAVE
@@ -126,7 +125,7 @@ singlefile.ui.menu = (() => {
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE_UNPINNED,
 				type: "radio",
-				title: "Auto-save unpinned tabs",
+				title: browser.i18n.getMessage("menuAutoSaveUnpinnedTabs"),
 				contexts: defaultContexts,
 				checked: false,
 				parentId: MENU_ID_AUTO_SAVE
@@ -134,7 +133,7 @@ singlefile.ui.menu = (() => {
 			browser.menus.create({
 				id: MENU_ID_AUTO_SAVE_ALL,
 				type: "radio",
-				title: "Auto-save all tabs",
+				title: browser.i18n.getMessage("menuAutoSaveAllTabs"),
 				contexts: defaultContexts,
 				checked: false,
 				parentId: MENU_ID_AUTO_SAVE

+ 19 - 19
extension/ui/pages/help.html

@@ -105,8 +105,8 @@
 					</li>
 
 					<li>
-						<span class="option">display an infobar when viewing archives</span>
-						<p>Check this option to display the  button at the top right of the page when viewing a saved page. By clicking
+						<span class="option">display an infobar when viewing a saved page</span>
+						<p>Check this option to display the  button at the top right of the page when viewing a saved page. By clicking
 							this
 							icon, you can get more information about the saved date and open the original URL.
 						</p>
@@ -138,7 +138,7 @@
 				<p>HTML content</p>
 				<ul>
 					<li>
-						<span class="option">compress HTML</span>
+						<span class="option">compress HTML content</span>
 						<p>Check this option to remove all HTML comments, and unneeded spaces or returns. This helps to reduce the size
 							of
 							the file without altering the document.</p>
@@ -147,7 +147,7 @@
 					</li>
 
 					<li>
-						<span class="option">remove HTML import</span>
+						<span class="option">remove HTML imports</span>
 						<p>Check this option to remove all link elements used to import HTML documents. This can reduce the size of the
 							file
 							without altering the document most of the time.</p>
@@ -176,16 +176,16 @@
 				<p>Images</p>
 				<ul>
 					<li>
-						<span class="option">save lazy loaded images</span>
-						<p>Check this option to save all the lazy loaded images that are not displayed. This may help to save all the
+						<span class="option">save deferred images</span>
+						<p>Check this option to save all the deferred images that are not displayed. This may help to save all the
 							images
-							without scrolling the page. This feature is not guaranteed to work on all sites.</p>
+							without scrolling the page. This feature does its best effort and is not guaranteed to work on all sites.</p>
 						<p class="notice">It is recommended to
 							<u>check</u> this option</p>
 					</li>
 
 					<li>
-						<span class="option">remove images for alternative resolutions</span>
+						<span class="option">remove images for alternative screen resolutions</span>
 						<p>Check this option to remove images that are alternatives in lower and/or higher resolutions to the ones
 							displayed
 							by default. Checking this this option can considerably reduce the size of the file in some cases.</p>
@@ -194,8 +194,8 @@
 				<p>Stylesheets</p>
 				<ul>
 					<li>
-						<span class="option">compress CSS</span>
-						<p>to minify CSS stylesheets. This the size of the file without altering the
+						<span class="option">compress CSS content</span>
+						<p>Check this option to minify CSS stylesheets. This the size of the file without altering the
 							document.
 							It also prevents images from being saved several times by using CSS variables.
 						</p>
@@ -215,18 +215,18 @@
 					</li>
 
 					<li>
-						<span class="option">remove alternative fonts to woff/otf and unused font rules</span>
-						<p>Check this option to remove fonts that are alternatives to the Web Open Font or OpenType formats, and CSS font
-							rules
+						<span class="option">remove alternative fonts to woff/otf and unused fonts</span>
+						<p>Check this option to remove fonts that are alternatives to the Web Open Font or OpenType formats, and CSS
+							fonts
 							that are not used. Checking this this option should not alter the document and can considerably reduce the size
 							of
-							the file in some cases.</p>
+							the file.</p>
 						<p class="notice">It is recommended to
 							<u>check</u> this option</p>
 					</li>
 
 					<li>
-						<span class="option">remove stylesheets for alternative devices</span>
+						<span class="option">remove stylesheets for alternative devices to screens</span>
 						<p>Check this option to remove stylesheets that are not used for the screen display like stylesheets for print
 							preview
 							and speech synthesizers. Checking this this option can reduce the size of the file.</p>
@@ -259,7 +259,7 @@
 				<p>Auto-save</p>
 				<ul>
 					<li>
-						<span class="option">auto-save on page load or unload</span>
+						<span class="option">auto-save after page load or on page unload</span>
 						<p>Check this option to auto-save pages after being loaded. If you browse to another page before the page is
 							fully
 							loaded then the page will be saved just before being unloaded. With this option active, you are guaranteed pages
@@ -273,7 +273,7 @@
 					</li>
 
 					<li>
-						<span class="option">auto-save on page load</span>
+						<span class="option">auto-save after page load</span>
 						<p>Check this option to auto-save pages after being loaded.</p>
 					</li>
 
@@ -288,7 +288,7 @@
 					</li>
 
 					<li>
-						<span class="option">auto-save wait delay after load (sec.)</span>
+						<span class="option">auto-save waiting delay after load (sec.)</span>
 						<p>Specify the amount of time in seconds to wait before saving a page when the "auto-save on page load or on page
 							unload"
 							or "auto-save on page load" is checked.
@@ -337,7 +337,7 @@
 				<ul>
 					<li>
 						<span class="option">Reset</span>
-						<p>Reset all the options to their default value.</p>
+						<p>Reset all options to their default values.</p>
 					</li>
 				</ul>
 			</li>

+ 38 - 38
extension/ui/pages/options.html

@@ -8,142 +8,142 @@
 </head>
 
 <body>
-	<h3>Options</h3>
+	<h3 id="titleLabel"></h3>
 	<details>
-		<summary>User interface</summary>
+		<summary id="userInterfaceLabel"></summary>
 		<div class="option">
-			<label for="contextMenuEnabledInput">add entry in the context menu of the webpage</label>
+			<label for="contextMenuEnabledInput" id="addMenuEntryLabel"></label>
 			<input type="checkbox" id="contextMenuEnabledInput">
 		</div>
 		<div class="option">
-			<label for="shadowEnabledInput">overlay a shadow on the page during processing</label>
+			<label for="shadowEnabledInput" id="shadowEnabledLabel"></label>
 			<input type="checkbox" id="shadowEnabledInput">
 		</div>
 		<div class="option">
-			<label for="displayInfobarInput">display an infobar when viewing archives</label>
+			<label for="displayInfobarInput" id="displayInfobarLabel"></label>
 			<input type="checkbox" id="displayInfobarInput">
 		</div>
 	</details>
 	<details>
-		<summary>File name</summary>
+		<summary id="filenameLabel"></summary>
 		<div class="option">
-			<label for="appendSaveDateInput">append the save date to the file name</label>
+			<label for="appendSaveDateInput" id="appendSaveDateLabel"></label>
 			<input type="checkbox" id="appendSaveDateInput">
 		</div>
 		<div class="option">
-			<label for="confirmFilenameInput">open the "Save as" dialog to confirm the file name</label>
+			<label for="confirmFilenameInput" id="confirmFilenameLabel"></label>
 			<input type="checkbox" id="confirmFilenameInput">
 		</div>
 	</details>
 	<details>
-		<summary>HTML content</summary>
+		<summary id="htmlContentLabel"></summary>
 		<div class="option">
-			<label for="compressHTMLInput">compress HTML</label>
+			<label for="compressHTMLInput" id="compressHTMLLabel"></label>
 			<input type="checkbox" id="compressHTMLInput">
 		</div>
 		<div class="option">
-			<label for="removeImportsInput">remove HTML imports</label>
+			<label for="removeImportsInput" id="removeImportsLabel"></label>
 			<input type="checkbox" id="removeImportsInput">
 		</div>
 		<div class="option">
-			<label for="removeFramesInput">remove frames</label>
+			<label for="removeFramesInput" id="removeFramesLabel"></label>
 			<input type="checkbox" id="removeFramesInput">
 		</div>
 		<div class="option">
-			<label for="removeHiddenElementsInput">remove hidden elements</label>
+			<label for="removeHiddenElementsInput" id="removeHiddenElementsLabel"></label>
 			<input type="checkbox" id="removeHiddenElementsInput">
 		</div>
 	</details>
 	<details>
-		<summary>Images</summary>
+		<summary id="imagesLabel"></summary>
 		<div class="option">
-			<label for="lazyLoadImagesInput">save lazy loaded images</label>
+			<label for="lazyLoadImagesInput" id="lazyLoadImagesLabel"></label>
 			<input type="checkbox" id="lazyLoadImagesInput">
 		</div>
 		<div class="option">
-			<label for="removeSrcSetInput">remove images for alternative resolutions</label>
+			<label for="removeSrcSetInput" id="removeAlternativeImagesLabel"></label>
 			<input type="checkbox" id="removeSrcSetInput">
 		</div>
 	</details>
 	<details>
-		<summary>Stylesheets</summary>
+		<summary id="stylesheetsLabel"></summary>
 		<div class="option">
-			<label for="compressCSSInput">compress CSS</label>
+			<label for="compressCSSInput" id="compressCSSLabel"></label>
 			<input type="checkbox" id="compressCSSInput">
 		</div>
 		<div class="option">
-			<label for="removeUnusedStylesInput">remove unused styles</label>
+			<label for="removeUnusedStylesInput" id="removeUnusedStylesLabel"></label>
 			<input type="checkbox" id="removeUnusedStylesInput">
 		</div>
 		<div class="option">
-			<label for="removeAlternativeFontsInput">remove alternative fonts to woff/otf and unused font rules</label>
+			<label for="removeAlternativeFontsInput" id="removeAlternativeFontsLabel"></label>
 			<input type="checkbox" id="removeAlternativeFontsInput">
 		</div>
 		<div class="option">
-			<label for="removeAlternativeFontsInput">remove stylesheets for alternative devices</label>
+			<label for="removeAlternativeMediasInput" id="removeAlternativeMediasLabel"></label>
 			<input type="checkbox" id="removeAlternativeMediasInput">
 		</div>
 	</details>
 	<details>
-		<summary>Other resources</summary>
+		<summary id="otherResourcesLabel"></summary>
 		<div class="option">
-			<label for="removeScriptsInput">remove scripts</label>
+			<label for="removeScriptsInput" id="removeScriptsLabel"></label>
 			<input type="checkbox" id="removeScriptsInput">
 		</div>
 		<div class="option">
-			<label for="removeVideoSrcInput">remove video sources</label>
+			<label for="removeVideoSrcInput" id="removeVideoLabel"></label>
 			<input type="checkbox" id="removeVideoSrcInput">
 		</div>
 		<div class="option">
-			<label for="removeAudioSrcInput">remove audio sources</label>
+			<label for="removeAudioSrcInput" id="removeAudioLabel"></label>
 			<input type="checkbox" id="removeAudioSrcInput">
 		</div>
 	</details>
 	<details>
-		<summary>Auto-save</summary>
+		<summary id="autoSaveLabel"></summary>
 		<div class="option">
-			<label for="autoSaveLoadInput">auto-save on page load or on page unload</label>
+			<label for="autoSaveLoadOrUnloadInput" id="autoSaveLoadOrUnloadLabel"></label>
 			<input type="checkbox" id="autoSaveLoadOrUnloadInput">
 		</div>
 		<div class="option">
-			<label for="autoSaveLoadInput">auto-save on page load</label>
+			<label for="autoSaveLoadInput" id="autoSaveLoadLabel"></label>
 			<input type="checkbox" id="autoSaveLoadInput">
 		</div>
 		<div class="option">
-			<label for="autoSaveUnloadInput">auto-save on page unload</label>
+			<label for="autoSaveUnloadInput" id="autoSaveUnloadLabel"></label>
 			<input type="checkbox" id="autoSaveUnloadInput">
 		</div>
 		<div class="option">
-			<label for="autoSaveDelayInput">auto-save wait delay after load (sec.)</label>
+			<label for="autoSaveDelayInput" id="autoSaveDelayLabel"></label>
 			<input type="number" id="autoSaveDelayInput" min="0">
 		</div>
 	</details>
 	<details>
-		<summary>Misc.</summary>
+		<summary id="miscLabel"></summary>
 		<div class="option">
-			<label for="backgroundSaveInput">save pages in background</label>
+			<label for="backgroundSaveInput" id="backgroundSaveLabel"></label>
 			<input type="checkbox" id="backgroundSaveInput">
 		</div>
 		<div class="option">
-			<label for="displayStatsInput">display stats in the console after processing</label>
+			<label for="displayStatsInput" id="displayStatsLabel"></label>
 			<input type="checkbox" id="displayStatsInput">
 		</div>
 		<div class="option">
-			<label for="maxResourceSizeEnabledInput">set a maximum size for embedded resources</label>
+			<label for="maxResourceSizeEnabledInput" id="setMaxResourceSizeLabel"></label>
 			<input type="checkbox" id="maxResourceSizeEnabledInput">
 		</div>
 		<div class="option second-level">
-			<label for="maxResourceSizeInput">maximum size (Mb)</label>
+			<label for="maxResourceSizeInput" id="maxResourceSizeLabel"></label>
 			<input type="number" id="maxResourceSizeInput" min="1">
 		</div>
 		<div class="option">
-			<label for="saveRawPageInput">save raw page</label>
+			<label for="saveRawPageInput" id="saveRawPageLabel"></label>
 			<input type="checkbox" id="saveRawPageInput">
 		</div>
 	</details>
 	<div class="option bottom">
-		<a href="help.html" target="SingleFileHelpPage">help</a>
-		<button id="resetButton" title="Reset all the options to default values">Reset</button>
+		<a href="help.html" target="SingleFileHelpPage" id="helpLabel"></a>
+		<button id="resetButton"></button>
 	</div>
 	<script type="text/javascript" src="/lib/browser-polyfill/custom-browser-polyfill.js"></script>
 	<script type="text/javascript" src="../bg/options.js"></script>

+ 3 - 0
lib/browser-polyfill/custom-browser-polyfill.js

@@ -122,6 +122,9 @@
 					removeListener: listener => chrome.downloads.onChanged.removeListener(listener)
 				}
 			},
+			i18n: {
+				getMessage: (messageName, substitutions) => chrome.i18n.getMessage(messageName, substitutions)
+			},
 			menus: {
 				onClicked: {
 					addListener: listener => chrome.contextMenus.onClicked.addListener(listener)

+ 4 - 3
manifest.json

@@ -8,7 +8,7 @@
 		"128": "extension/ui/resources/icon_128.png"
 	},
 	"version": "1.5.31",
-	"description": "Save a complete page into a single HTML file",
+	"description": "__MSG_extensionDescription__",
 	"content_scripts": [
 		{
 			"matches": [
@@ -82,7 +82,7 @@
 	},
 	"browser_action": {
 		"default_icon": "extension/ui/resources/icon_16.png",
-		"default_title": "Save page with SingleFile"
+		"default_title": "__MSG_buttonDefaultTooltip__"
 	},
 	"commands": {
 		"_execute_browser_action": {
@@ -111,5 +111,6 @@
 		"lib/single-file/lazy-loader-before.js",
 		"lib/single-file/lazy-loader-after.js"
 	],
-	"manifest_version": 2
+	"manifest_version": 2,
+	"default_locale": "en"
 }