[Pkg-mozext-commits] [itsalltext] 139/459: Working locale!
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 e6154e4c6992c260b3e6a2d61e1abe63aee9a95c
Author: docwhat at gerf.org <docwhat at gerf.org>
Date: Wed Feb 14 11:11:21 2007 -0500
Working locale!
---
chrome.manifest | 1 +
chrome/content/itsalltext.js | 11 +++++++----
chrome/content/itsalltext.xul | 15 ++++++++-------
chrome/content/newextension.xul | 8 +++++---
chrome/content/preferences.js | 14 +++++++++-----
chrome/content/preferences.xul | 29 +++++++++++++++++------------
chrome/locale/en-US/itsalltext.dtd | 9 +++++++++
chrome/locale/en-US/itsalltext.properties | 2 +-
chrome/locale/en-US/newextension.dtd | 3 +++
chrome/locale/en-US/preferences.dtd | 8 ++++++++
chrome/locale/en-US/preferences.properties | 3 +++
11 files changed, 71 insertions(+), 32 deletions(-)
diff --git a/chrome.manifest b/chrome.manifest
index d5b81d9..6953b9f 100644
--- a/chrome.manifest
+++ b/chrome.manifest
@@ -1,3 +1,4 @@
content itsalltext chrome/content/
+locale itsalltext en-US chrome/locale/en-US/
overlay chrome://browser/content/browser.xul chrome://itsalltext/content/itsalltext.xul
diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index e627ed9..9616d4a 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -468,6 +468,7 @@ var ItsAllText = function() {
watcher: function(offset) {
var monitor = that.monitor;
var rate = that.getRefresh();
+
var now = Date.now();
if (now - monitor.last_now < Math.round(rate * 0.9)) {
that.debuglog('monitor.watcher(',offset,') -- skipping catchup refresh');
@@ -553,11 +554,15 @@ var ItsAllText = function() {
* Initialize the module. Should be called once, when a window is loaded.
* @private
*/
- var startup = function(event) {
+ var windowload = function(event) {
that.debug("startup(): It's All Text! is watching this window...");
+
// Start watching the preferences.
that.preference_observer.register();
+ // Start the monitor
+ that.monitor.restart();
+
var appcontent = document.getElementById("appcontent"); // The Browser
if (appcontent) {
// Normal web-page.
@@ -575,12 +580,10 @@ var ItsAllText = function() {
};
// Do the startup when things are loaded.
- window.addEventListener("load", startup, true);
+ window.addEventListener("load", windowload, true);
// Do the startup when things are unloaded.
window.addEventListener("unload", function(event){that.monitor.unwatch(event.originalTarget||document); that.preference_observer.unregister();}, true);
- // Start the monitor
- that.monitor.restart();
};
/**
diff --git a/chrome/content/itsalltext.xul b/chrome/content/itsalltext.xul
index 5ffe33b..10ed131 100644
--- a/chrome/content/itsalltext.xul
+++ b/chrome/content/itsalltext.xul
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE overlay SYSTEM "chrome://itsalltext/locale/itsalltext.dtd" >
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/x-javascript" src="itsalltext.js"/>
+ <script type="application/x-javascript" src="itsalltext.js" />
<!-- The merge point is contentAreaContextMenu -->
<popup id="contentAreaContextMenu">
- <menuitem id="itsalltext-menuitem" label="It's All Text!"
+ <menuitem id="itsalltext-menuitem" label="&top.label;"
oncommand="ItsAllText.onEditNode(document.popupNode)"
- accesskey="i" />
+ accesskey="&top.key;" />
</popup>
@@ -15,14 +16,14 @@
<window id="main-window">
<popupset id="itsalltext-optionmenu-set">
<popup id="itsalltext-optionmenu">
- <menuitem label="New edit extension..."
- accesskey="n"
+ <menuitem label="&newext.label;"
+ accesskey="&newext.key;"
oncommand="ItsAllText.menuNewExtEdit(event);" />
<menuseparator/>
<menuitem label=".txt" oncommand="ItsAllText.menuExtEdit(event);"/>
<menuseparator/>
- <menuitem label="Preferences"
- accesskey="p"
+ <menuitem label="&pref.label;"
+ accesskey="&pref.key;"
oncommand="window.openDialog('chrome://itsalltext/chrome/preferences.xul', 'Preferences', 'chrome,titlebar,toolbar,centerscreen,modal');"/>
</popup>
</popupset>
diff --git a/chrome/content/newextension.xul b/chrome/content/newextension.xul
index 3246065..0c52308 100644
--- a/chrome/content/newextension.xul
+++ b/chrome/content/newextension.xul
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+
+<!DOCTYPE prefwindow SYSTEM "chrome://itsalltext/locale/newextension.dtd" >
<dialog
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="ItsAllTextNewExtension"
- title="It's All Text! New Extension"
+ title="&title;"
ondialogaccept="return onOK();"
persist="screenX screenY width height"
windowtype="ItsAllTextWindowType">
@@ -16,12 +18,12 @@
</columns>
<rows>
<row align="center">
- <label value="Extension (with leading dot):"/>
+ <label value="&extension.label;"/>
<textbox id="new_ext" value=".txt"/>
</row>
<row align="center">
<spacer/>
- <checkbox id="do_save" label="Save for future use"/>
+ <checkbox id="do_save" label="&save.label;"/>
</row>
</rows>
</grid>
diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js
index 5153c94..2201b33 100644
--- a/chrome/content/preferences.js
+++ b/chrome/content/preferences.js
@@ -1,14 +1,19 @@
// @todo [6] [pref] Better strategy for getting the default editor: EDITOR env variable or view_source.editor.path
+
/**
* Open a filepicker to select the value of the editor.
*/
function pref_editor_select() {
+ var locale = document.getElementById("strings");
+
var pref_editor = document.getElementById('pref_editor');
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].
createInstance(nsIFilePicker);
- fp.init(window, "Choose your editor", nsIFilePicker.modeOpen);
+ fp.init(window,
+ locale.getString('picker.window.title'),
+ nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterApps);
var initdir = Components.classes["@mozilla.org/file/local;1"].
@@ -43,6 +48,7 @@ function setHelp(text) {
}
function pref_onload() {
+ var locale = document.getElementById("strings");
document.getElementById('browse').focus();
if (window['arguments'] && window['arguments'][0] && window['arguments'][0] == 'badeditor') {
var editor = document.getElementById('editor');
@@ -54,15 +60,13 @@ function pref_onload() {
box.removeChild(box.firstChild);
}
var desc = document.createElement('description');
- var textnode = document.createTextNode(["I was unable to run your editor, '",
- editor.value,
- "'. Use the browse button to choose another editor and try again. "].join(''));
+ var textnode = document.createTextNode(locale.getFormattedString('problem.editor', [editor.value]));
desc.appendChild(textnode);
desc.style.maxWidth = '18em';
box.appendChild(desc);
desc = document.createElement('description');
- textnode = document.createTextNode("If you use Mac OS X, then you'll need to use the binary installed by your editor in /usr/bin OR you can try to find the binary in the NAME.app/Contents/MacOS/ directory.");
+ textnode = document.createTextNode(locale.getString('mac.hint'));
desc.appendChild(textnode);
desc.style.maxWidth = '18em';
box.appendChild(desc);
diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul
index 5d7fd03..ad82668 100644
--- a/chrome/content/preferences.xul
+++ b/chrome/content/preferences.xul
@@ -1,14 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<!DOCTYPE prefwindow SYSTEM "chrome://itsalltext/locale/preferences.dtd" >
<prefwindow id="itsalltext-prefs"
- title="It's All Text Preferences"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- onload="pref_onload();">
+ title="&title;"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="pref_onload();">
<script type="application/x-javascript" src="preferences.js"/>
+
+<stringbundleset id="strbundles">
+<stringbundle id="strings" src="chrome://itsalltext/locale/preferences.properties"/>
+</stringbundleset>
-<prefpane id="itsalltext-pane" label="It's All Text Preferences" flex="1">
+<prefpane id="itsalltext-pane" label="&title;" flex="1">
<preferences>
<preference id="pref_charset"
name="extensions.itsalltext.charset" type="string"/>
@@ -30,20 +35,20 @@
</columns>
<rows>
<row align="center">
- <label control="editor" value="Editor:"/>
+ <label control="editor" value="&editor.label;"/>
<vbox>
<textbox preference="pref_editor" id="editor" size="20" readonly="false"
style="-moz-appearance: none !important; background:
inherit;" />
<hbox align="right">
<spacer/>
- <button oncommand="pref_editor_select();" label="Browse"
+ <button oncommand="pref_editor_select();" label="&picker.label;"
id="browse" accesskey="b" tabindex="1"/>
</hbox>
</vbox>
</row>
<row align="center">
- <label control="seconds" value="Seconds between refreshing:"/>
+ <label control="seconds" value="&seconds.label;"/>
<hbox>
<textbox preference="pref_seconds" id="seconds" size="2"
maxlength="2" tabindex="2"/>
@@ -52,22 +57,22 @@
</row>
<row align="center">
<label control="charset"
- value="Character Set (default: UTF-8):"/>
+ value="&charset.label;"/>
<hbox>
<textbox preference="pref_charset" id="charset" size="8" tabindex="3"/>
<spacer/>
</hbox>
</row>
<row align="center">
- <label control="charset"
- value="File Extensions:"/>
+ <label control="extensions"
+ value="&extensions.label;"/>
<textbox preference="pref_extensions" id="extensions" size="30" tabindex="4"/>
</row>
<row align="center">
<label control="debug"
- value="Debugging:"/>
+ value="&debug.label;"/>
<checkbox preference="pref_debug" id="debug" tabindex="5"
- label="Remove all bugs"/>
+ label="&debug.humor;"/>
</row>
</rows>
</grid>
diff --git a/chrome/locale/en-US/itsalltext.dtd b/chrome/locale/en-US/itsalltext.dtd
new file mode 100644
index 0000000..74fe272
--- /dev/null
+++ b/chrome/locale/en-US/itsalltext.dtd
@@ -0,0 +1,9 @@
+<!ENTITY top.label "It's All Text!">
+<!ENTITY top.key "i">
+
+<!ENTITY newext.label "New edit extension...">
+<!ENTITY newext.key "n">
+
+<!ENTITY pref.label "Preferences">
+<!ENTITY pref.key "p">
+
diff --git a/chrome/locale/en-US/itsalltext.properties b/chrome/locale/en-US/itsalltext.properties
index 4d0f90d..8eb3e49 100644
--- a/chrome/locale/en-US/itsalltext.properties
+++ b/chrome/locale/en-US/itsalltext.properties
@@ -1,6 +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
+problem_making_directory=I'm having a problem finding or creating the directory: %1$S
gumdrop.width=28
gumdrop.height=14
diff --git a/chrome/locale/en-US/newextension.dtd b/chrome/locale/en-US/newextension.dtd
new file mode 100644
index 0000000..0974d4d
--- /dev/null
+++ b/chrome/locale/en-US/newextension.dtd
@@ -0,0 +1,3 @@
+<!ENTITY title "It's All Text! New Extension">
+<!ENTITY extension.label "Extension (with leading dot):">
+<!ENTITY save.label "Save for future use">
diff --git a/chrome/locale/en-US/preferences.dtd b/chrome/locale/en-US/preferences.dtd
new file mode 100644
index 0000000..3118652
--- /dev/null
+++ b/chrome/locale/en-US/preferences.dtd
@@ -0,0 +1,8 @@
+<!ENTITY title "It's All Text! Preferences">
+<!ENTITY editor.label "Editor:">
+<!ENTITY picker.label "Browse">
+<!ENTITY seconds.label "Seconds between refreshing:">
+<!ENTITY charset.label "Character Set (default: UTF-8):">
+<!ENTITY extensions.label "File Extensions:">
+<!ENTITY debug.label "Debugging:">
+<!ENTITY debug.humor "Remove all bugs">
diff --git a/chrome/locale/en-US/preferences.properties b/chrome/locale/en-US/preferences.properties
new file mode 100644
index 0000000..1bd75b3
--- /dev/null
+++ b/chrome/locale/en-US/preferences.properties
@@ -0,0 +1,3 @@
+picker.window.title=Choose your editor
+problem.editor=I was unable to run your editor, '%1$S'. Use the browse button to choose another editor and try again.
+mac.hint=If you use Mac OS X, then you'll need to use the binary installed by your editor in /usr/bin OR you can try to find the binary in the NAME.app/Contents/MacOS/ directory.
--
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