[Pkg-mozext-commits] [stylish] 01/01: Imported Upstream version 2.0.2

Dmitry Smirnov onlyjob at moszumanska.debian.org
Wed Apr 29 07:20:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

onlyjob pushed a commit to annotated tag upstream/2.0.2
in repository stylish.

commit 58d7554 (tag: upstream/2.0.2)
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date:   Wed Apr 29 02:51:15 2015

    Imported Upstream version 2.0.2
---
 components/stylishStyle.js      |  3 ++-
 content/common.js               | 18 ++++++++-----
 content/edit.js                 | 13 +++++----
 content/install-frame-script.js | 17 ++++++++++++
 content/overlay.js              | 60 ++++++++++++++++++++++++++++-------------
 content/overlay.xul             |  3 ++-
 install.rdf                     | 14 +++++-----
 locale/fr/common.dtd            |  6 ++---
 locale/fr/edit.dtd              |  6 ++---
 locale/fr/overlay.properties    |  8 +++---
 locale/nl/common.dtd            |  4 +--
 locale/nl/edit.dtd              |  2 +-
 locale/nl/overlay.properties    |  8 +++---
 pull_locales.rb                 | 16 +++++++++--
 14 files changed, 118 insertions(+), 60 deletions(-)

diff --git a/components/stylishStyle.js b/components/stylishStyle.js
index 45fcd3d..b20679e 100644
--- a/components/stylishStyle.js
+++ b/components/stylishStyle.js
@@ -86,7 +86,8 @@ Style.prototype = {
 	findForUrl: function(url, includeGlobal, mode, count) {
 		var styles = this.list(mode, {});
 		styles = styles.filter(function(style) {
-			return style.appliesToUrl(url) || (includeGlobal && style.getTypes({}).indexOf("global") > -1);
+			var isGlobal = style.getTypes({}).indexOf("global") > -1
+			return includeGlobal ? (isGlobal || style.appliesToUrl(url)) : (!isGlobal && style.appliesToUrl(url));
 		});
 		styles.sort(this.nameSort);
 		count.value = styles.length;
diff --git a/content/common.js b/content/common.js
index 3f05102..6e8991d 100644
--- a/content/common.js
+++ b/content/common.js
@@ -67,10 +67,14 @@ var stylishCommon = {
 			var tbWin = tbEnumerator.getNext();
 			var browsers = tbWin.gBrowser.browsers;
 			for (var i = 0; i < browsers.length; i++) {
-				if (browsers[i].contentDocument.documentElement.getAttribute("windowtype") == name) {
-					tbWin.gBrowser.selectTabAtIndex(i);
-					tbWin.focus();
-					return true;
+				// We can't read into remote documents easily. We only work with about:, anyway.
+				if (browsers[i].currentURI.schemeIs("about")) {
+					var de = browsers[i].contentDocument.documentElement;
+					if (de && de.getAttribute("windowtype") == name) {
+						tbWin.gBrowser.selectTabAtIndex(i);
+						tbWin.focus();
+						return true;
+					}
 				}
 			}
 		}
@@ -277,11 +281,11 @@ var stylishCommon = {
 			if (style.name) {
 				var installPrompt = installStrings.formatStringFromName("installintro", [style.name], 1);
 				// title is read from entity in overlay-mobile.xul, but not available in manage.html (which is not localized anyway!)
-				result = promptService.confirm(window, promptTitle, installPrompt);
+				result = promptService.confirm(win, promptTitle, installPrompt);
 			} else {
 				var installPrompt = "Give the style from '" + style.idUrl + "' a name.";
 				var name = {value: ""};
-				result = promptService.prompt(window, promptTitle, installPrompt, name, null, {});
+				result = promptService.prompt(win, promptTitle, installPrompt, name, null, {});
 				if (result) {
 					style.name = name.value;
 				}
@@ -290,7 +294,7 @@ var stylishCommon = {
 				style.enabled = true;
 				style.save();
 				if (params.installPingURL) {
-					var req = new XMLHttpRequest();
+					var req = new win.XMLHttpRequest();
 					req.open("GET", params.installPingURL, true);
 					req.send(null);
 				}
diff --git a/content/edit.js b/content/edit.js
index 547bbc9..308c9bd 100644
--- a/content/edit.js
+++ b/content/edit.js
@@ -7,7 +7,7 @@ try {
 	// file not available...
 }
 
-var saved = false;
+var skipConfirmClosePrompt = false;
 var style = null;
 var strings = null;
 var codeE, nameE, updateUrlE;
@@ -87,7 +87,7 @@ function init() {
 			var extraKeys = {};
 			// This needs to be uppercase to work, some locales use lowercase to match a character in the label
 			extraKeys[Editor.accel(document.getElementById("save-button").getAttribute("accesskey").toUpperCase())] = save;
-			extraKeys["F3"] = "find";
+			extraKeys["F3"] = "findNext";
 			extraKeys["Shift-F3"] = "findPrev";
 			sourceEditor = new Editor({
 				mode: Editor.modes.css,
@@ -244,6 +244,7 @@ function save() {
 
 	if (code != initialCode) {
 		style.code = code;
+		initialCode = style.code
 	} else {
 		// we don't want to change the code, but we want to undo any preview
 		style.revert();
@@ -254,7 +255,6 @@ function save() {
 	var newStyle = !style.id;
 
 	style.save();
-	saved = true;
 
 	if (newStyle) {
 		location.href = location.href.split("?")[0] + "?id=" + style.id;
@@ -645,8 +645,7 @@ var deleteObserver = {
 		if (subject.id == style.id) {
 			style.enabled = false;
 			style.setPreview(false);
-			// just so the user is not prompted to save
-			saved = true;
+			skipConfirmClosePrompt = true;
 			window.close();
 		}
 	}
@@ -657,7 +656,7 @@ Components.classes["@mozilla.org/observer-service;1"].getService(Components.inte
 // This is firing twice in some cases like on Seamonkey, so don't do it if we've shown it in the past 5 seconds.
 var lastBeforeUnload = null;
 window.addEventListener("beforeunload", function(event) {
-	if (!saved && initialCode != codeElementWrapper.value && (lastBeforeUnload == null || Date.now() - lastBeforeUnload > 5000)) {
+	if (!skipConfirmClosePrompt && initialCode != codeElementWrapper.value && (lastBeforeUnload == null || Date.now() - lastBeforeUnload > 5000)) {
 		lastBeforeUnload = Date.now();
 		// Firefox will show its own stuff, so the text doesn't matter as long as it's text
 		event.returnValue = "You're going to lose your changes - close anyway?";
@@ -673,7 +672,7 @@ window.addEventListener("close", function(event) {
 window.addEventListener("unload", function(event) {
 	//turn off preview!
 	style.setPreview(false);
-	if (!saved) {
+	if (initialCode != codeElementWrapper.value) {
 		style.revert();
 	}
 });
diff --git a/content/install-frame-script.js b/content/install-frame-script.js
index 3af3b62..1cbad72 100644
--- a/content/install-frame-script.js
+++ b/content/install-frame-script.js
@@ -93,3 +93,20 @@ function dispatchEvent(type, data) {
 	var stylishEvent = new content.CustomEvent(type, {detail: data});
 	content.document.dispatchEvent(stylishEvent);
 }
+
+addMessageListener("stylish:page-info", function(message) {
+	sendAsyncMessage(message.data.reply, {
+		namespace: content.document.documentElement.namespaceURI,
+		contentType: content.document.contentType,
+		url: content.document.location.href
+	});
+});
+
+addMessageListener("stylish:page-content", function(message) {
+	sendAsyncMessage(message.data.reply, {
+		namespace: content.document.documentElement.namespaceURI,
+		contentType: content.document.contentType,
+		url: content.document.location.href,
+		content: content.document.body.textContent
+	});
+});
diff --git a/content/overlay.js b/content/overlay.js
index 3a24245..655d62f 100644
--- a/content/overlay.js
+++ b/content/overlay.js
@@ -113,7 +113,7 @@ var stylishOverlay = {
 		},
 		onLocationChange: function(progress, request, uri) {
 			// only if it's the current tab
-			if (uri && uri.spec == content.document.location.href) {
+			if (uri && uri.spec == stylishOverlay.currentURI.spec) {
 				stylishOverlay.urlUpdated();
 			}
 		},
@@ -128,13 +128,14 @@ var stylishOverlay = {
 	lastUrl: null,
 
 	urlUpdated: function() {
-		if (stylishOverlay.lastUrl == content.document.location.href)
+		var uri = stylishOverlay.currentURI;
+		if (stylishOverlay.lastUrl == uri.spec)
 			return;
-		stylishOverlay.lastUrl = content.document.location.href;
-		document.documentElement.setAttribute("stylish-url", content.document.location.href);
+		stylishOverlay.lastUrl = uri.spec;
+		document.documentElement.setAttribute("stylish-url", uri.spec);
 		try {
-			if (content.document.domain)
-				document.documentElement.setAttribute("stylish-domain", content.document.domain);
+			if (uri.host)
+				document.documentElement.setAttribute("stylish-domain", uri.host);
 			else
 				document.documentElement.setAttribute("stylish-domain", "");
 		} catch (ex) {
@@ -171,7 +172,7 @@ var stylishOverlay = {
 			return style.enabled;
 		}
 
-		var siteStyles = stylishOverlay.service.findForUrl(content.location.href, false, 0, {}).filter(isEnabled).length;
+		var siteStyles = stylishOverlay.service.findForUrl(stylishOverlay.currentURI.spec, false, 0, {}).filter(isEnabled).length;
 
 		if (stylishOverlay.globalCount == null)
 			stylishOverlay.globalCount = stylishOverlay.service.findByMeta("type", "global", 0, {}).filter(isEnabled).length;
@@ -201,11 +202,11 @@ var stylishOverlay = {
 
 		var domain = null;
 		try {
-			domain = content.document.domain;
+			domain = stylishOverlay.currentURI.host;
 		} catch (ex) {}
 		if (domain) {
 			var domains = [];
-			stylishOverlay.getDomainList(content.document.domain, domains);
+			stylishOverlay.getDomainList(domain, domains);
 			for (var i = 0; i < domains.length; i++) {
 				popup.appendChild(stylishOverlay.getDomainMenuItem(domains[i]));
 			}
@@ -230,6 +231,14 @@ var stylishOverlay = {
 			popup.triggerNode.setAttribute("open", "true");
 		}
 
+		// You can only add CSS files. Assume it's not CSS to avoid the item showing then disappearing.
+		document.getElementById("stylish-add-file").style.display = "none";
+		stylishOverlay.getFromContent("stylish:page-info", function(message) {
+			if (message.data.contentType == "text/css") {
+				document.getElementById("stylish-add-file").style.display = "-moz-box";
+			}
+		});
+
 		// Add the passed styles as menuitems under the passed parent, with startIndex indicating the number of menuitems already added (for creating an accesskey)
 		function addStyleMenuItems(styles, parent, startIndex) {
 			if (!startIndex) {
@@ -280,7 +289,7 @@ var stylishOverlay = {
 		var _stylesForCurrentSite = null;
 		function stylesForCurrentSite() {
 			if (_stylesForCurrentSite == null) {
-				_stylesForCurrentSite = stylishOverlay.service.findForUrl(content.location.href, false, stylishOverlay.service.REGISTER_STYLE_ON_CHANGE, {});
+				_stylesForCurrentSite = stylishOverlay.service.findForUrl(stylishOverlay.currentURI.spec, false, stylishOverlay.service.REGISTER_STYLE_ON_CHANGE, {});
 			}
 			return _stylesForCurrentSite;
 		}
@@ -360,8 +369,6 @@ var stylishOverlay = {
 			addStylesToMainMenu(appStyles())
 		}
 
-		//you can only add CSS files
-		document.getElementById("stylish-add-file").style.display = (content.document.contentType == "text/css") ? "-moz-box" : "none";
 		var stylesOn = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch).getBoolPref("extensions.stylish.styleRegistrationEnabled");
 		document.getElementById("stylish-turn-on").style.display = stylesOn ? "none" : "-moz-box";
 		document.getElementById("stylish-turn-off").style.display = stylesOn ? "-moz-box" : "none";
@@ -420,7 +427,7 @@ var stylishOverlay = {
 	},
 
 	findStyle: function(e) {
-		openUILinkIn(stylishOverlay.URL_STRINGS.getFormattedString("findstylesforthissiteurl", [encodeURIComponent(content.location.href)]), "tab");
+		openUILinkIn(stylishOverlay.URL_STRINGS.getFormattedString("findstylesforthissiteurl", [encodeURIComponent(stylishOverlay.currentURI.spec)]), "tab");
 	},
 
 	menuItemClassesToClear: ["stylish-menuseparator", "style-menu-item", "no-style-menu-item"],
@@ -437,10 +444,10 @@ var stylishOverlay = {
 	},
 
 	addSite: function() {
-		var url = content.location.href;
-		var namespaceURI = content.document.documentElement.namespaceURI;
-		var code = "@namespace url(" + namespaceURI + ");\n\n at -moz-document url(\"" + url + "\") {\n\n}";
-		stylishOverlay.addCode(code);
+		stylishOverlay.getFromContent("stylish:page-info", function(message) {
+			var code = "@namespace url(" + message.data.namespace + ");\n\n at -moz-document url(\"" + message.data.url + "\") {\n\n}";
+			stylishOverlay.addCode(code);
+		});
 	},
 
 	addDomain: function(domain) {
@@ -505,8 +512,23 @@ var stylishOverlay = {
 	},
 
 	installFromFile: function(event) {
-		var doc = content.document;
-		stylishCommon.installFromString(doc.body.textContent, doc.location.href);
+		stylishOverlay.getFromContent("stylish:page-content", function(message) {
+			stylishCommon.installFromString(message.data.content, message.data.url);
+		});
+	},
+
+	get currentURI() {
+		return gBrowser.currentURI;
+	},
+
+	getFromContent: function(contentMessage, callback) {
+		var replyName = "stylish:" + Date.now();
+		var mm = gBrowser.selectedBrowser.messageManager;
+		mm.addMessageListener(replyName, function(message) {
+			mm.removeMessageListener(replyName, callback);
+			callback(message);
+		});
+		mm.sendAsyncMessage(contentMessage, {reply: replyName});
 	}
 };
 
diff --git a/content/overlay.xul b/content/overlay.xul
index e275e15..16e7389 100644
--- a/content/overlay.xul
+++ b/content/overlay.xul
@@ -12,6 +12,7 @@
 <overlay id="stylish-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 	<script type="application/javascript" src="common.js"/>
+	<script type="application/javascript" src="frame-utils.js"/>
 	<script type="application/javascript" src="overlay.js"/>
 
 	<stringbundleset id="stringbundleset">
@@ -25,7 +26,7 @@
 			<menuitem id="stylish-manage" label="&managestyles;" accesskey="&managestyles.ak;" oncommand="stylishOverlay.openManage()"/>
 			<menuitem id="stylish-turn-on" label="&turnon;" accesskey="&turnon.ak;" oncommand="stylishOverlay.turnOnOff(true)"/>
 			<menuitem id="stylish-turn-off" label="&turnoff;" accesskey="&turnoff.ak;" oncommand="stylishOverlay.turnOnOff(false)"/>
-			<menuitem id="stylish-add-file" label="&addfile;" accesskey="&addfile.ak;" oncommand="stylishOverlay.installFromFile(event)"/>
+			<menuitem id="stylish-add-file" label="&addfile;" accesskey="&addfile.ak;" oncommand="stylishOverlay.installFromFile(event)" style="display: none"/>
 			<menuitem id="stylish-find-styles" label="&findstylebrowser;" accesskey="&findstylebrowser.ak;" oncommand="stylishOverlay.findStyle(event)" onclick="checkForMiddleClick(this, event)"/>
 			<menu id="stylish-write-style-menu" label="&writestyle;" accesskey="&writestyle.ak;">
 				<menupopup onpopupshowing="stylishOverlay.writeStylePopupShowing(event)" onpopuphiding="stylishCommon.clearAllMenuItems(event)"/>
diff --git a/install.rdf b/install.rdf
index ece6b5c..8fcbdc9 100644
--- a/install.rdf
+++ b/install.rdf
@@ -5,7 +5,7 @@
 	<Description rdf:about="urn:mozilla:install-manifest">
 		<em:id>{46551EC9-40F0-4e47-8E18-8E5CF550CFB8}</em:id>
 		<em:name>Stylish</em:name>
-		<em:version>2.0.0</em:version>
+		<em:version>2.0.2</em:version>
 		<em:creator>Jason Barnabe</em:creator>
 		<em:homepageURL>https://userstyles.org/</em:homepageURL>
 		<em:iconURL>chrome://stylish/skin/32.png</em:iconURL>
@@ -56,6 +56,8 @@
 		<em:translator>shyangs - zh-TW</em:translator>
 		<em:translator>CoolCmd - ru</em:translator>
 		<em:translator>Michal Čaplygin - cs</em:translator>
+		<em:translator>Tim Nguyen - fr</em:translator>
+		<em:translator>Heimen Stoffels - nl</em:translator>
 		<em:contributor>t1470258 - icons</em:contributor>
 		<em:contributor>LouCypher - icons</em:contributor>
 		<em:contributor>s4nji - icons</em:contributor>
@@ -65,7 +67,7 @@
 			<Description>
 				<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
 				<em:minVersion>19.0</em:minVersion>
-				<em:maxVersion>37.0</em:maxVersion>
+				<em:maxVersion>39.0</em:maxVersion>
 			</Description>
 		</em:targetApplication>
 		<!--Thunderbird-->
@@ -73,7 +75,7 @@
 			<Description>
 				<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
 				<em:minVersion>24.0</em:minVersion>
-				<em:maxVersion>37.0</em:maxVersion>
+				<em:maxVersion>39.0</em:maxVersion>
 			</Description>
 		</em:targetApplication>
 		<!--SeaMonkey-->
@@ -81,7 +83,7 @@
 			<Description>
 				<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
 				<em:minVersion>2.16</em:minVersion>
-				<em:maxVersion>2.34</em:maxVersion>
+				<em:maxVersion>2.36</em:maxVersion>
 			</Description>
 		</em:targetApplication>
 		<!--Toolkit-->
@@ -89,7 +91,7 @@
 			<Description>
 				<em:id>toolkit at mozilla.org</em:id>
 				<em:minVersion>19.0</em:minVersion>
-				<em:maxVersion>37.0</em:maxVersion>
+				<em:maxVersion>39.0</em:maxVersion>
 			</Description>
 		</em:targetApplication>
 		<!-- Postbox -->
@@ -113,7 +115,7 @@
 			<Description>
 				<em:id>{aa3c5121-dab2-40e2-81ca-7ea25febc110}</em:id>
 				<em:minVersion>19.0</em:minVersion>
-				<em:maxVersion>37.0</em:maxVersion>
+				<em:maxVersion>39.0</em:maxVersion>
 			</Description>
 		</em:targetApplication>
 		<!-- Komodo IDE -->
diff --git a/locale/fr/common.dtd b/locale/fr/common.dtd
index c5989f5..1217d62 100644
--- a/locale/fr/common.dtd
+++ b/locale/fr/common.dtd
@@ -1,5 +1,5 @@
-<!ENTITY editstyle "Éditer">
+<!ENTITY editstyle "Modifier">
 <!ENTITY editstyle.ak "d">
-<!ENTITY reportstyle "Report style as broken">
-<!ENTITY reportedstyle "Style reported.">
+<!ENTITY reportstyle "Signaler le style comme non fonctionnel">
+<!ENTITY reportedstyle "Style signalé">
 <!ENTITY stylish "Stylish">
diff --git a/locale/fr/edit.dtd b/locale/fr/edit.dtd
index 123cae9..9d82086 100644
--- a/locale/fr/edit.dtd
+++ b/locale/fr/edit.dtd
@@ -1,5 +1,5 @@
-<!ENTITY checkforerrors "Check for Errors">
-<!ENTITY checkforerrors.ak "C">
+<!ENTITY checkforerrors "Vérifier les erreurs">
+<!ENTITY checkforerrors.ak "V">
 <!ENTITY chromefolder "Chemin vers le répertoire Chrome">
 <!ENTITY chromefolder.ak "C">
 <!ENTITY dataURI "URI des données…">
@@ -13,7 +13,7 @@
 <!ENTITY openintexternaleditor "Ouvrir dans un éditeur dédié">
 <!ENTITY openintexternaleditor.ak "O">
 <!ENTITY preview "Aperçu">
-<!ENTITY preview.ak "p">
+<!ENTITY preview.ak "A">
 <!ENTITY save "Enregistrer">
 <!ENTITY save.ak "E">
 <!ENTITY wraplines "Aller à la ligne">
diff --git a/locale/fr/overlay.properties b/locale/fr/overlay.properties
index 81e217a..d67fb88 100644
--- a/locale/fr/overlay.properties
+++ b/locale/fr/overlay.properties
@@ -1,7 +1,7 @@
-submenuformatchingsite=Styles for this page
-submenufornonmatchingsite=Site styles
-submenuforglobal=Global styles
-submenuforapp=App styles
+submenuformatchingsite=Styles pour cette page
+submenufornonmatchingsite=Styles pour le site
+submenuforglobal=Styles globaux
+submenuforapp=Styles pour l'application
 tooltip=Stylish - %S style(s) pour le site, %S style(s) pour l\'interface
 tooltipStylesOff=Stylish - les styles sont désactivés
 updatestyle=Voulez-vous vraiment mettre à jour « %S » ?
diff --git a/locale/nl/common.dtd b/locale/nl/common.dtd
index 5f62236..0857843 100644
--- a/locale/nl/common.dtd
+++ b/locale/nl/common.dtd
@@ -1,5 +1,5 @@
 <!ENTITY editstyle "Wijzigen">
 <!ENTITY editstyle.ak "W">
-<!ENTITY reportstyle "Report style as broken">
-<!ENTITY reportedstyle "Style reported.">
+<!ENTITY reportstyle "Stijl rapporteren als zijnde 'kapot'">
+<!ENTITY reportedstyle "Stijl gerapporteerd.">
 <!ENTITY stylish "Stylish">
diff --git a/locale/nl/edit.dtd b/locale/nl/edit.dtd
index 8d9ab1d..566f994 100644
--- a/locale/nl/edit.dtd
+++ b/locale/nl/edit.dtd
@@ -1,4 +1,4 @@
-<!ENTITY checkforerrors "Check for Errors">
+<!ENTITY checkforerrors "Controleren op fouten">
 <!ENTITY checkforerrors.ak "C">
 <!ENTITY chromefolder "Chrome map pad">
 <!ENTITY chromefolder.ak "C">
diff --git a/locale/nl/overlay.properties b/locale/nl/overlay.properties
index 7dbf237..0f260ab 100644
--- a/locale/nl/overlay.properties
+++ b/locale/nl/overlay.properties
@@ -1,7 +1,7 @@
-submenuformatchingsite=Styles for this page
-submenufornonmatchingsite=Site styles
-submenuforglobal=Global styles
-submenuforapp=App styles
+submenuformatchingsite=Stijlen voor deze pagina
+submenufornonmatchingsite=Site-stijlen
+submenuforglobal=Globale stijlen
+submenuforapp=App-stijlen
 tooltip=Stylish - %S website stijl(en), %S algemene stijl(en)
 tooltipStylesOff=Stylish - Stijlen zijn uitgeschakeld
 updatestyle=\'%S\' werkelijk bijwerken?
diff --git a/pull_locales.rb b/pull_locales.rb
index eb61477..56864d9 100644
--- a/pull_locales.rb
+++ b/pull_locales.rb
@@ -1,3 +1,5 @@
+# Install transifex-ruby - https://rubygems.org/gems/transifex-ruby
+#
 # Create a file in the same directory called pull_locales_login.rb.
 # Contents should be:
 #
@@ -7,6 +9,7 @@
 # end
 
 require 'transifex'
+require 'fileutils'
 require_relative 'pull_locales_login'
 
 project_slug = 'stylish'
@@ -18,12 +21,21 @@ project.languages.each do |language|
 	code = language.language_code
 	code_with_hyphens = code.sub('_', '-')
 	puts "Getting locale #{code_with_hyphens}"
+	dir_name = "locale/#{code_with_hyphens}"
+	Dir.mkdir(dir_name) if !Dir.exist?(dir_name)
+	has_content = false
 	project.resources.each do |resource|
 		c = resource.translation(code).content.gsub('\\\\', '\\').gsub('&', '&')
 		# transifex likes underscores in locale names, we like hyphens
 		c.sub!(code, code_with_hyphens) if code != code_with_hyphens
-		file_name = "locale/#{code_with_hyphens}/#{resource.name}"
-		puts "Writing resource #{file_name}"
+		file_name = "#{dir_name}/#{resource.name}"
+		completed = resource.stats(code).completed
+		has_content ||= completed != "0%"
+		puts "Writing resource #{file_name}, #{completed} complete."
 		File.open(file_name, 'w') { |file| file.write(c) }
 	end
+	if !has_content
+		puts "Locale #{code_with_hyphens} has no content, deleting."
+		FileUtils.rm_rf(dir_name)
+	end
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/stylish.git



More information about the Pkg-mozext-commits mailing list