[Pkg-mozext-commits] [itsalltext] 138/459: Localization continuing...
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:26:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository itsalltext.
commit 47b8463212e8b7724b20fbfed7db79eae9c12180
Author: docwhat at gerf.org <docwhat at gerf.org>
Date: Wed Feb 14 10:28:14 2007 -0500
Localization continuing...
---
chrome/content/cacheobj.js | 16 ++++++-------
chrome/content/itsalltext.js | 33 ++++++++++++++++++++++++++-
chrome/{content => locale/en-US}/gumdrop.png | Bin
chrome/locale/en-US/itsalltext.properties | 6 +++++
4 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/chrome/content/cacheobj.js b/chrome/content/cacheobj.js
index 54fa2f0..20a344d 100644
--- a/chrome/content/cacheobj.js
+++ b/chrome/content/cacheobj.js
@@ -7,11 +7,11 @@ function CacheObj(node) {
var that = this;
/* Gumdrop Image URL */
- that.gumdrop_url = 'chrome://itsalltext/content/gumdrop.png';
+ that.gumdrop_url = 'chrome://itsalltext/locale/gumdrop.png';
/* Gumdrop Image Width */
- that.gumdrop_width = 28;
+ that.gumdrop_width = ItsAllText.localeString('gumdrop.width');
/* Gumdrop Image Height */
- that.gumdrop_height = 14;
+ that.gumdrop_height = ItsAllText.localeString('gumdrop.height');
that.timestamp = 0;
that.size = 0;
@@ -206,11 +206,11 @@ CacheObj.prototype.edit = function(extension, retried) {
process.run(false, args, args.length, result);
this._is_watching = true;
} catch(e) {
- window.openDialog('chrome://itsalltext/chrome/preferences.xul',
- "Preferences",
- "chrome,titlebar,toolbar,centerscreen,modal",
- "badeditor");
if (!retried) {
+ window.openDialog('chrome://itsalltext/chrome/preferences.xul',
+ ItsAllText.localeString('no_editor_pref'),
+ "chrome,titlebar,toolbar,centerscreen,modal",
+ "badeditor");
this.edit(extension, true); // Try one more time.
}
}
@@ -351,7 +351,7 @@ CacheObj.prototype.addGumDrop = function() {
if (ItsAllText.getDebug()) {
gumdrop.setAttribute('title', cache_object.node_id);
} else {
- gumdrop.setAttribute('title', "It's All Text!");
+ gumdrop.setAttribute('title', ItsAllText.localeString('program_name'));
}
cache_object.button = gumdrop; // Store it for easy finding in the future.
diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index d170a3d..e627ed9 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -51,6 +51,33 @@ var ItsAllText = function() {
/* The XUL Namespace */
that.XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+
+ var string_bundle = Components.classes["@mozilla.org/intl/stringbundle;1"].
+ getService(Components.interfaces.nsIStringBundleService);
+ /**
+ * A localization bundle. Use it like so:
+ * ItsAllText.locale.getStringFromName('blah');
+ */
+ that.locale = string_bundle.createBundle("chrome://itsalltext/locale/itsalltext.properties");
+ /**
+ * Formats a locale string, replacing $N with the arguments in arr.
+ * @param {String} name Locale property name
+ * @param {Array} arr Array of strings to replace in the string.
+ * @returns String
+ */
+ that.localeFormat = function(name, arr) {
+ return this.locale.formatStringFromName(name, arr, arr.length);
+ };
+ /**
+ * Returns the locale string matching name.
+ * @param {String} name Locale property name
+ * @returns String
+ */
+ that.localeString = function(name) {
+ return this.locale.GetStringFromName(name);
+ }
+
+
/**
* This is a handy debug message. I'll remove it or disable it when
* I release this.
@@ -105,7 +132,7 @@ var ItsAllText = function() {
parseInt('0700',8));
}
if (!fobj.isDirectory()) {
- that.error('Having a problem finding or creating directory: '+fobj.path);
+ that.error(that.localeFormat('problem_making_directory', [fobj.path]));
}
return fobj;
};
@@ -239,6 +266,10 @@ var ItsAllText = function() {
*/
that.getRefresh = function() {
var refresh = that.preferences.refresh;
+ if (!refresh || refresh < 1) {
+ that.debug('Invalid refresh gotten:',refresh);
+ refresh = 1;
+ }
var retval = 1000*refresh;
return retval;
diff --git a/chrome/content/gumdrop.png b/chrome/locale/en-US/gumdrop.png
similarity index 100%
rename from chrome/content/gumdrop.png
rename to chrome/locale/en-US/gumdrop.png
diff --git a/chrome/locale/en-US/itsalltext.properties b/chrome/locale/en-US/itsalltext.properties
new file mode 100644
index 0000000..4d0f90d
--- /dev/null
+++ b/chrome/locale/en-US/itsalltext.properties
@@ -0,0 +1,6 @@
+extensions.itsalltext at docwhat.gerf.org.description=Edit text using your favorite editor!
+program_name=It's All Text!
+no_editor_pref=Preferences: Please pick an editor.
+problem_making_directory=I'm having a problem finding or creating the directory: $1
+gumdrop.width=28
+gumdrop.height=14
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git
More information about the Pkg-mozext-commits
mailing list