massive changes to add i18n support to chatzilla, see bug 27805, "ChatZilla needs i18n"
This commit is contained in:
rginda%netscape.com 2001-07-02 04:36:29 +00:00
Родитель e235febe6d
Коммит 4fbc8db5e0
11 изменённых файлов: 531 добавлений и 681 удалений

Просмотреть файл

@ -35,8 +35,9 @@ chatzilla.jar:
skin/modern/chatzilla/images/isnt-op.gif (xul/skin/images/isnt-op.gif)
skin/modern/chatzilla/images/is-voice.gif (xul/skin/images/is-voice.gif)
skin/modern/chatzilla/images/isnt-voice.gif (xul/skin/images/isnt-voice.gif)
locale/en-US/chatzilla/chatzillaOverlay.dtd (xul/locale/en-US/chatzillaOverlay.dtd)
locale/en-US/chatzilla/chatzilla.dtd (xul/locale/en-US/chatzilla.dtd)
locale/en-US/chatzilla/chatzillaOverlay.dtd (xul/locale/en-US/chatzillaOverlay.dtd)
locale/en-US/chatzilla/chatzilla.dtd (xul/locale/en-US/chatzilla.dtd)
locale/en-US/chatzilla/chatzilla.properties (xul/locale/en-US/chatzilla.properties)
locale/en-US/chatzilla/pref-irc.dtd (xul/locale/en-US/pref-irc.dtd)
# XXX fix me...

Просмотреть файл

@ -33,6 +33,8 @@
* that irc:// links have the content type x-application-irc (BogusChannel)
*/
dump (">>>>>>>>>>>> chatzilla-service loaded");
/* components defined in this file */
const CLINE_SERVICE_CONTRACTID =
"@mozilla.org/commandlinehandler/general-startup;1?type=chat";

Просмотреть файл

@ -190,8 +190,8 @@ function ep_routeevent (e)
}
catch (ex)
{
dd ("Error routing event: " + ex + " in " +
e.destMethod + "\n" + dumpObjectTree(ex));
dd ("Error routing event: " + dumpObjectTree(ex) +
" in " + e.destMethod + "\n" + ex);
}
else
destObject[e.destMethod] (e);

Просмотреть файл

@ -28,8 +28,8 @@ var debugData = {lastEventType: "", lastEventData: ""};
*/
function event_tracer (e)
{
var name="";
var data="";
var name = "";
var data = (e.debug) ? e.debug : "";
switch (e.set)
{
@ -60,7 +60,7 @@ function event_tracer (e)
case "channel":
name = e.destObject.name;
break;
case "user":
name = e.destObject.nick;
break;

Просмотреть файл

@ -59,6 +59,9 @@
*
*/
const JSIRC_ERR_NO_SOCKET = "JSIRCE:NS";
const JSIRC_ERR_EXHAUSTED = "JSIRCE:E";
function userIsMe (user)
{
@ -145,8 +148,10 @@ function net_doconnect(e)
if (this.connectAttempt++ >= this.MAX_CONNECT_ATTEMPTS)
{
ev = new CEvent ("network", "info", this, "onInfo");
ev.msg = "Connection attempts exhausted, giving up.";
ev = new CEvent ("network", "error", this, "onError");
ev.server = this;
ev.debug = "Connection attempts exhausted, giving up.";
ev.errorCode = JSIRC_ERR_EXHAUSTED;
this.eventPump.addEvent (ev);
return false;
}
@ -157,10 +162,11 @@ function net_doconnect(e)
}
catch (ex)
{
dd ("cant make socket.");
ev = new CEvent ("network", "error", this, "onError");
ev.meat = "Unable to create socket: " + ex;
ev.server = this;
ev.debug = "Couldn't create socket :" + ex;
ev.errorCode = JSIRC_ERR_NO_SOCKET;
ev.exception = ex;
this.eventPump.addEvent (ev);
return false;
}
@ -172,10 +178,13 @@ function net_doconnect(e)
host = 0;
}
ev = new CEvent ("network", "info", this, "onInfo");
ev.msg = "Connecting to " + this.serverList[host].name + ":" +
this.serverList[host].port + ", attempt " + this.connectAttempt +
" of " + this.MAX_CONNECT_ATTEMPTS + "...";
ev = new CEvent ("network", "startconnect", this, "onStartConnect");
ev.debug = "Connecting to " + this.serverList[host].name + ":" +
this.serverList[host].port + ", attempt " + this.connectAttempt +
" of " + this.MAX_CONNECT_ATTEMPTS + "...";
ev.host = this.serverList[host].name;
ev.port = this.serverList[host].port;
ev.connectAttempt = this.connectAttempt;
this.eventPump.addEvent (ev);
var connected = false;
@ -201,11 +210,6 @@ function net_doconnect(e)
if (!connected)
{ /* connect failed, try again */
ev = new CEvent ("network", "info", this, "onInfo");
ev.msg = "Couldn't connect to " + this.serverList[host].name + ":" +
this.serverList[host].port + ", trying next server in list...";
this.eventPump.addEvent (ev);
ev = new CEvent ("network", "do-connect", this, "onDoConnect");
this.eventPump.addEvent (ev);
}
@ -300,38 +304,10 @@ function serv_sockdiscon(status)
this.connection.isConnected = false;
var ev = new CEvent ("server", "disconnect", this, "onDisconnect");
ev.server = this;
ev.disconnectStatus = status;
this.parent.eventPump.addEvent (ev);
var msg;
switch (status)
{
case NS_ERROR_CONNECTION_REFUSED:
msg = "Connection to " + this.connection.host + ":" +
this.connection.port + " refused.";
break;
case NS_ERROR_NET_TIMEOUT:
msg = "Connection to " + this.connection.host + ":" +
this.connection.port + " timed out.";
break;
case NS_ERROR_UNKNOWN_HOST:
msg = "Unknown host: " + this.connection.host;
break;
default:
msg = "Connection to " + this.connection.host + ":" +
this.connection.port + " closed with status " + status + ".";
break;
}
var ev = new CEvent ("network", "info", this.parent, "onInfo");
ev.msg = msg;
this.parent.eventPump.addEvent (ev);
}
@ -420,7 +396,7 @@ function serv_senddata (msg)
CIRCServer.prototype.queuedSendData =
function serv_senddata (msg)
{
if (this.sendQueue.length == 0)
this.parent.eventPump.addEvent (new CEvent ("server", "senddata",
this, "onSendData"));
@ -551,6 +527,13 @@ function serv_disconnect(e)
CIRCServer.prototype.onSendData =
function serv_onsenddata (e)
{
if (!this.connection.isConnected)
{
dd ("Can't send to disconnected socket");
this.flushSendQueue();
return false;
}
var d = new Date();
this.sendsThisRound = 0;
@ -601,6 +584,7 @@ function serv_poll(e)
else
{
ev = new CEvent ("server", "disconnect", this, "onDisconnect");
ev.server = this;
ev.reason = "error";
ev.exception = ex;
this.parent.eventPump.addEvent (ev);

Просмотреть файл

@ -389,41 +389,6 @@ function formatDateOffset (seconds, format)
return format;
}
function arraySpeak (ary, single, plural)
{
var rv = "";
switch (ary.length)
{
case 0:
break;
case 1:
rv = ary[0];
if (single)
rv += " " + single;
break;
case 2:
rv = ary[0] + " and " + ary[1];
if (plural)
rv += " " + plural;
break;
default:
for (var i = 0; i < ary.length - 1; ++i)
rv += ary[i] + ", ";
rv += "and " + ary[ary.length - 1];
if (plural)
rv += " " + plural;
break;
}
return rv;
}
function arrayContains (ary, elem)
{
return (arrayIndexOf (ary, elem) != -1);

Просмотреть файл

@ -21,7 +21,8 @@
- Contributor(s):
- Robert Ginda, rginda@ndcico.com, original author
- Josh Soref, timeless@mac.com, international support
-->
- Chiaki Koufugata chiaki@mozilla.gr.jp UI i18n
-->
<!DOCTYPE window SYSTEM "chrome://chatzilla/locale/chatzilla.dtd">
@ -38,6 +39,7 @@
onclose="return onClose();"
persist="width height" windowtype="irc:chatzilla">
<script src="chrome://global/content/strres.js"/>
<script src="chrome://chatzilla/content/lib/js/utils.js"/>
<script src="chrome://chatzilla/content/lib/js/connection-xpcom.js"/>
<script src="chrome://chatzilla/content/lib/js/events.js"/>
@ -85,31 +87,31 @@
<menubar id="main-menubar" persist="collapsed">
<menu id="menu_File">
<menupopup id="menu_FilePopup">
<menu label="Options">
<menu label="&OptionsCmd.label;">
<menupopup>
<menuitem id="menu-view-toolbar" label="Show Toolbar"
<menuitem id="menu-view-toolbar" label="&ShowToolbarCmd.label;"
type="checkbox" oncommand="onToggleVisibility('toolbar');"/>
<menuitem id="menu-view-info" label="Show Userlist"
<menuitem id="menu-view-info" label="&ShowUserlistCmd.label;"
type="checkbox" oncommand="onToggleVisibility('info');"/>
<menuitem id="menu-view-status" label="Show Statusbar"
<menuitem id="menu-view-status" label="&ShowStatusbarCmd.label;"
type="checkbox" oncommand="onToggleVisibility('status');"/>
<menuseparator/>
<menuitem id="menu-munger" label="Enable Smileys"
<menuitem id="menu-munger" label="&EnableSmileysCmd.label;"
oncommand="onToggleMunger()" type="checkbox"/>
<menuseparator/>
<menuitem id="menu-dmessages" label="Debug Messages"
<menuitem id="menu-dmessages" label="&DebugMsgCmd.label;"
oncommand="onToggleTraceHook()" type="checkbox"/>
<menuseparator/>
<menuitem id="menu-settings-save-now" label="Save Settings Now"
<menuitem id="menu-settings-save-now" label="&SaveSetNowCmd.label;"
oncommand="writeIRCPrefs()"/>
<menuitem id="menu-settings-autosave" label="Save Settings On Exit"
<menuitem id="menu-settings-autosave" label="&SaveSetExitCmd.label;"
oncommand="onToggleSaveOnExit()" type="checkbox"/>
</menupopup>
@ -119,14 +121,14 @@
<menuitem id="menu_close"/>
</menupopup>
</menu>
<menu label="View">
<menu label="&ViewCmd.label;">
<menupopup>
<!-- hide vs delete nuances are too vague
<menuitem label="Hide" oncommand="onHideCurrentView();"/>
<menuitem label="&HideCmd.label;" oncommand="onHideCurrentView();"/>
-->
<menuitem label="Clear this view" oncommand="onClearCurrentView();"/>
<menuitem label="Delete this view" oncommand="onDeleteCurrentView();"/>
<menuitem label="&ClearViewCmd.label;" oncommand="onClearCurrentView();"/>
<menuitem label="&DeleteViewCmd.label;" oncommand="onDeleteCurrentView();"/>
</menupopup>
</menu>

Просмотреть файл

@ -22,6 +22,7 @@
*
* Contributor(s):
* Robert Ginda, rginda@ndcico.com, original author
* Chiaki Koufugata, chiaki@mozilla.gr.jp, UI i18n
*/
function addCommands(commandObject)
@ -29,257 +30,58 @@ function addCommands(commandObject)
function add (name, func, usage, help)
{
var usage = getMsg (name + "Usage");
var help = getMsg(name + "Help");
commandObject.add (name, func, usage, help);
}
add ("attach", "onInputAttach",
"[<network-name>] [<password>]",
"Attaches to the network specified by <network-name>, " +
"or the current network, if no network is specified. " +
"Provides the password <password> if specified. If you are already " +
"attached, the view for <network-name> is made current. If that " +
"view has been deleted, it is recreated.");
add ("away", "onInputAway",
"[<reason>]",
"If <reason> is spcecified, sets you away with that message. " +
"Used without <reason>, you are marked back as no longer being away.");
add ("cancel", "onInputCancel", "",
"Cancels a /attach or /server command. Use /cancel when ChatZilla " +
"is repeatdly trying to attach to a network that is not responding, " +
"to tell ChatZilla to give up before the normal number of retries.");
add ("clear", "onInputClear", "",
"Clear the current view, discarding *all* content.");
add ("client", "onInputClient", "",
"Make the ``*client*'' view current. If the ``*client*'' view has " +
"been deleted, it will be recreated.");
add ("commands", "onInputCommands", "[<pattern>]",
"Lists all command names matching <pattern>, or all command names " +
"if pattern is not specified.");
add ("ctcp", "onInputCTCP",
"<target> <code> [<params>]",
"Sends the CTCP code <code> to the target (user or channel) " +
"<target>. If <params> are specified they are sent along as well.");
add ("delete", "onInputDelete", "",
"Clear the current view, discarding *all* content, and drop it's " +
"icon from the toolbar.");
add ("deop", "onInputDeop",
"<nick>",
"Removes operator status from <nick> on current channel. " +
"Requires operator status.");
add ("desc", "onInputDesc",
"<description>",
"Changes the 'ircname' line returned when someone performs a /whois " +
"on you. You must specify this *before* connecting to the network.");
add ("devoice", "onInputDevoice",
"<nick>",
"Removes voice status from <nick> on current channel. " +
"Requires operator status.");
add ("disconnect", "onInputQuit", "[<reason>]",
"Disconnects from the server represented by the active view when " +
"the command is executed providing the reason <reason> " +
"or the default reason if <reason> is not specified.");
add ("echo", "onInputEcho",
"<text>",
"Displays <text> in the current view, but does not send it to " +
"the server.");
add ("eval", "onInputEval",
"<script>",
"Evaluates <script> as JavaScript code. Not for the faint of heart.");
add ("exit", "onInputExit", "[<reason>]",
"Disconnects from all active servers and networks, providing the " +
"reason <reason>, or the default reason if <reason> is not " +
"specified. Exits ChatZilla after disconnecting.");
/* FIXME: JG: not implemented yet */
/*
add ("filter", "onInputFilter",
"<regex>",
"Shows only messages matching <regex> on current channel. When used " $
"with no parameter, the contents are restored.");
*/
add ("help", "onInputHelp",
"[<command-name>]",
"Displays help on all commands matching <command-name>, if " +
"<command-name> is not given, displays help on all commands");
add ("hide", "onInputHide", "",
"Drop the current view's icon from the toolbar, but save it's " +
"contents. The icon will reappear the next time there is activity " +
"on the view.");
add ("infobar", "onInputInfobar", "",
"Toggles the visibility of the username list.");
add ("invite", "onInputInvite",
"<nick> [<channel>]",
"Invites <nick> to <channel> or current channel if not " +
"supplied. Requires operator status if +i is set.");
add ("join", "onInputJoin",
"[#|&|+]<channel-name> [<key>]",
"Joins a the global (name starts with #), local (name starts " +
"with &), or modeless (name starts with a +) channel named " +
"<channel-name>. If no prefix is given, # is " +
"assumed. Provides the key <key> if specified.");
add ("kick", "onInputKick",
"[<channel>] <nick>",
"Kicks <nick> from <channel> or current channel if not " +
"supplied. Requires operator status.");
add ("leave", "onInputLeave",
"",
"Leaves the current channel, use /delete or /hide to force the " +
"view to go away.");
add ("list", "onInputSimpleCommand",
"[channel]",
"Lists channel name, user count, and topic information for the " +
"network/server you are attached to. If you omit the optional " +
"channel argument, all channels will be listed. On large networks, " +
"the server may disconnect you for asking for a complete list.");
add ("me", "onInputMe",
"<action>",
"Performs an 'action' on the current channel.");
add ("msg", "onInputMsg",
"<user> <msg>",
"Sends a private message <msg> to the user <user>.");
add ("name", "onInputName",
"<username>",
"Changes the username displayed before your hostmask if the server " +
"you're connecting to allows it. Some servers will only trust the " +
"username reply from the ident service. You must specify this " +
"*before* connecting to the network.");
add ("names", "onInputNames", "[<channel>]",
"Lists the users in a channel.");
add ("network", "onInputNetwork",
"<network-name>",
"Sets the current network to <network-name>");
add ("networks", "onInputNetworks",
"",
"Lists all available networks as clickable links.");
add ("nick", "onInputNick",
"<nickname>",
"Changes your current nickname.");
add ("notify", "onInputNotify",
"[<nickname> [...]]",
"With no parameters, /notify shows you the online/offline status " +
"of all the users on your notify list. If one or more <nickname> " +
"parameters are supplied, the nickname(s) will be added to your " +
"notify list if they are not yet on it, or removed from it if they "+
"are.");
add ("op", "onInputOp",
"<nick>",
"Gives operator status to <nick> on current channel. Requires " +
"operator status.");
add ("part", "onInputLeave",
"",
"See /leave");
add ("query", "onInputQuery", ",<user> [<msg>]",
"Opens a one-on-one chat with <usr>. If <msg> is supplied, it is " +
"sent as the initial private message to <user>.");
add ("quit", null, "[<reason>]",
"This command has been replaced by /disconnect.");
add ("quote", "onInputQuote",
"<irc-command>",
"Sends a raw command to the IRC server, not a good idea if you " +
"don't know what you're doing. see IRC 1459 " +
"( http://www.irchelp.org/irchelp/rfc1459.html ) for complete " +
"details.");
add ("server", "onInputServer",
"<server-hostname> [<port>] [<password>]",
"Connects to server <server-hostname> on <port>, or 6667 if " +
"<port> is not specified. Provides the password <password> if " +
"specified. If you are already connected, " +
"the view for <server-hostname> is made current. If that view " +
"has been deleted, it is recreated.");
add ("stalk", "onInputStalk",
"<text>",
"Add text to list of words for which you would like to see alerts." +
"Whenever a person with a nickname macthing <text> speaks, or " +
"someone says a phrase containing <text>, your " +
"ChatZilla window will become active (on some operating systems) " +
"and it's taskbar icon will flash (on some operating systems.)");
add ("status", "onInputStatus", "",
"Shows status information for the current view.");
add ("statusbar", "onInputStatusbar", "",
"Toggles the visibility of the status bar.");
add ("testdisplay", "onInputTestDisplay",
"",
"Displays a sample text. Used to preview styles");
add ("topic", "onInputTopic",
"[<new-topic>]",
"If <new-topic> is specified and you are a chanop, or the channel " +
"is not in 'private topic' mode (+t), the topic will be changed to " +
"<new-topic>. If <new-topic> is *not* specified, the current topic " +
"will be displayed");
add ("toolbar", "onInputToolbar", "",
"Toggles the visibility of the channel toolbar.");
add ("unstalk", "onInputUnstalk",
"<text>",
"Remove word from list of terms for which you would like to see " +
"alerts.");
add ("voice", "onInputVoice",
"<nick>",
"Gives voice status to <nick> on current channel. " +
"Requires operator status.");
add ("who", "onInputSimpleCommand",
"<pattern>",
"List users who have name, host, or description information matching" +
" <pattern>.");
add ("whois", "onInputWhoIs",
"<nick>",
"Displays information about the user <nick>, including 'real name', " +
"server connected to, idle time, and signon time. Note that some " +
"servers will lie about the idle time.");
/*
add ("zoom", "onInputZoom",
"<nick>",
"Shows only messages <nick> has sent to the channel, filtering out " +
"all others, (including yours.)");
*/
add ("attach", "onInputAttach");
add ("away", "onInputAway");
add ("cancel", "onInputCancel");
add ("clear", "onInputClear");
add ("client", "onInputClient");
add ("commands", "onInputCommands");
add ("ctcp", "onInputCTCP");
add ("delete", "onInputDelete");
add ("deop", "onInputDeop");
add ("desc", "onInputDesc");
add ("devoice", "onInputDevoice");
add ("disconnect", "onInputQuit");
add ("echo", "onInputEcho");
add ("eval", "onInputEval");
add ("exit", "onInputExit");
add ("help", "onInputHelp");
add ("hide", "onInputHide");
add ("infobar", "onInputInfobar");
add ("invite", "onInputInvite");
add ("join", "onInputJoin");
add ("kick", "onInputKick");
add ("leave", "onInputLeave");
add ("list", "onInputSimpleCommand");
add ("me", "onInputMe");
add ("msg", "onInputMsg");
add ("name", "onInputName");
add ("names", "onInputNames");
add ("network", "onInputNetwork");
add ("networks", "onInputNetworks");
add ("nick", "onInputNick");
add ("notify", "onInputNotify");
add ("op", "onInputOp");
add ("part", "onInputLeave");
add ("query", "onInputQuery");
add ("quit", "onInputExit");
add ("quote", "onInputQuote");
add ("server", "onInputServer");
add ("stalk", "onInputStalk");
add ("status", "onInputStatus");
add ("statusbar", "onInputStatusbar");
add ("testdisplay", "onInputTestDisplay");
add ("topic", "onInputTopic");
add ("toolbar", "onInputToolbar");
add ("unstalk", "onInputUnstalk");
add ("voice", "onInputVoice");
add ("who", "onInputSimpleCommand");
add ("whois", "onInputWhoIs");
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -19,6 +19,7 @@
*
* Contributor(s):
* Robert Ginda, rginda@ndcico.com, original author
* Chiaki Koufugata chiaki@mozilla.gr.jp UI i18n
*/
if (DEBUG)
@ -28,9 +29,9 @@ else
var client = new Object();
client.defaultNick = "IRCMonkey";
client.defaultNick = getMsg( "defaultNick" );
client.version = "0.8.2";
client.version = "0.8.3";
client.TYPE = "IRCClient";
client.COMMAND_CHAR = "/";
@ -62,13 +63,13 @@ client.DEFAULT_RESPONSE_CODE = "===";
/* XXX maybe move this into css */
client.responseCodeMap = new Object();
client.responseCodeMap["HELLO"] = "[HELLO]";
client.responseCodeMap["HELP"] = "[HELP]";
client.responseCodeMap["USAGE"] = "[USAGE]";
client.responseCodeMap["ERROR"] = "[ERROR]";
client.responseCodeMap["INFO"] = "[INFO]";
client.responseCodeMap["EVAL-IN"] = "[EVAL-IN]";
client.responseCodeMap["EVAL-OUT"] = "[EVAL-OUT]";
client.responseCodeMap["HELLO"] = getMsg("responseCodeMapHello");
client.responseCodeMap["HELP"] = getMsg("responseCodeMapHelp");
client.responseCodeMap["USAGE"] = getMsg("responseCodeMapUsage");
client.responseCodeMap["ERROR"] = getMsg("responseCodeMapError");
client.responseCodeMap["INFO"] = getMsg("responseCodeMapInfo");
client.responseCodeMap["EVAL-IN"] = getMsg("responseCodeMapEvalIn");
client.responseCodeMap["EVAL-OUT"] = getMsg("responseCodeMapEvalOut");
client.responseCodeMap["JOIN"] = "-->|";
client.responseCodeMap["PART"] = "<--|";
client.responseCodeMap["QUIT"] = "|<--";
@ -81,7 +82,7 @@ client.responseCodeMap["376"] = "---"; /* end of MOTD */
client.responseCodeMap["318"] = "---"; /* end of WHOIS */
client.responseCodeMap["366"] = "---"; /* end of NAMES */
client.name = "*client*";
client.name = getMsg("clientname");
client.viewsArray = new Array();
client.activityList = new Object();
client.uiState = new Object(); /* state of ui elements (visible/collapsed) */
@ -93,15 +94,15 @@ client.stalkingVictims = new Array();
CIRCNetwork.prototype.INITIAL_NICK = client.defaultNick;
CIRCNetwork.prototype.INITIAL_NAME = "chatzilla";
CIRCNetwork.prototype.INITIAL_DESC = "New Now Know How";
CIRCNetwork.prototype.INITIAL_DESC = getMsg("circnetworkInitialDesc");
CIRCNetwork.prototype.INITIAL_CHANNEL = "";
CIRCNetwork.prototype.MAX_MESSAGES = 100;
CIRCNetwork.prototype.IGNORE_MOTD = false;
CIRCServer.prototype.READ_TIMEOUT = 0;
CIRCServer.prototype.VERSION_RPLY = "ChatZilla 0.8 [" + navigator.userAgent +
"]";
CIRCServer.prototype.VERSION_RPLY = getMsg("circserverVersionRply",
[client.version,
navigator.userAgent]);
CIRCUser.prototype.MAX_MESSAGES = 200;
CIRCChannel.prototype.MAX_MESSAGES = 300;
@ -177,11 +178,7 @@ function initStatic()
onSortCol ("usercol-nick");
client.display ("Welcome to ChatZilla...\n" +
"Use /attach <network-name> connect to a network, or " +
"click on one of the network names below.\n" +
"For general IRC help and FAQs, please go to " +
"<http://www.irchelp.org>.", "HELLO");
client.display (getMsg("welcome"), "HELLO");
setCurrentObject (client);
client.onInputNetworks();
@ -458,6 +455,77 @@ function mainStep()
}
function getMsg (msgName)
{
var restCount = arguments.length - 1;
if (!client.bundle)
{
client.bundle =
srGetStrBundle("chrome://chatzilla/locale/chatzilla.properties");
}
try
{
if (restCount == 1 && arguments[1] instanceof Array)
{
return client.bundle.formatStringFromName (msgName, arguments[1],
arguments[1].length);
}
else if (restCount > 0)
{
var subPhrases = new Array();
for (var i = 1; i < arguments.length; ++i)
subPhrases.push(arguments[i]);
return client.bundle.formatStringFromName (msgName, subPhrases,
subPhrases.length);
}
return client.bundle.GetStringFromName (msgName);
}
catch (ex)
{
dd ("caught exception getting value for ``" + msgName + "''\n" + ex +
"\n" + getStackTrace());
return msgName;
}
}
function arraySpeak (ary, single, plural)
{
var rv = "";
var and = getMsg ("arraySpeakAnd");
switch (ary.length)
{
case 0:
break;
case 1:
rv = ary[0];
if (single)
rv += " " + single;
break;
case 2:
rv = ary[0] + " " + and + " " + ary[1];
if (plural)
rv += " " + plural;
break;
default:
for (var i = 0; i < ary.length - 1; ++i)
rv += ary[i] + ", ";
rv += and + " " + ary[ary.length - 1];
if (plural)
rv += " " + plural;
break;
}
return rv;
}
function quicklistCallback (element, ndx, ary)
{
/* Check whether the selected attribute == true */
@ -481,6 +549,7 @@ function getObjectDetails (obj, rv)
}
rv.orig = obj;
rv.parent = obj.parent;
switch (obj.TYPE)
{
@ -684,7 +753,7 @@ function gotoIRCURL (url)
if (!url)
{
window.alert ("Invalid IRC URL ``" + url + "''");
window.alert (getMsg("gotoIRCURLMsg",url));
return;
}
@ -692,7 +761,7 @@ function gotoIRCURL (url)
var pass = "";
if (url.needpass)
pass = window.prompt ("Enter a password for the url " + url.spec);
pass = window.prompt (getMsg("gotoIRCURLMsg2",url.spec));
if (url.isserver)
{
@ -746,7 +815,7 @@ function gotoIRCURL (url)
{
var key = "";
if (url.needkey)
key = window.prompt ("Enter key for url " + url.spec);
key = window.prompt (getMsg("gotoIRCURLMsg3",url.spec));
if (url.isnick)
{
@ -780,7 +849,7 @@ function gotoIRCURL (url)
else
{
if (!net.messages)
net.displayHere ("Network view for ``" + net.name + "'' opened.",
net.displayHere (getMsg("gotoIRCURLMsg4",net.name),
"INFO");
setCurrentObject (net);
}
@ -863,64 +932,49 @@ function updateTitle (obj)
if ((obj && obj != client.currentObject) || !client.currentObject)
return;
var tstring = "";
var o = new Object();
getObjectDetails (client.currentObject, o);
var tstring;
var o = getObjectDetails (client.currentObject);
var net = o.network ? o.network.name : "";
switch (client.currentObject.TYPE)
{
case "IRCServer":
case "IRCNetwork":
var serv = "", nick = "";
var serv = "", port = "", nick = "";
if (o.server)
{
serv = o.server.connection.host;
serv = o.server.connection.host;
port = o.server.connection.port;
if (o.server.me)
nick = o.server.me.properNick;
tstring = getMsg("updateTitleNetwork", [nick, net, serv, port]);
}
if (nick) /* user might be disconnected, nick would be undefined */
tstring += "user '" + nick + "' ";
if (net)
if (serv)
tstring += "attached to '" + net + "' via " + serv;
else
if (o.network.connecting)
tstring += "attaching to '" + net + "'";
else
tstring += "no longer attached to '" + net + "'";
if (tstring)
tstring = "ChatZilla: " + tstring;
else
tstring = "ChatZilla!!";
{
nick = client.currentObject.INITIAL_NICK;
tstring = getMsg("updateTitleNetwork2", [nick, net]);
}
break;
case "IRCChannel":
var chan = "(none)", mode = "", topic = "";
var chan = "", mode = "", topic = "";
var nick = o.parent.me ? o.parent.me.properNick :
getMsg ("updateTitleNoNick");
chan = o.channel.name;
mode = o.channel.mode.getModeStr();
if (client.uiState["toolbar"])
topic = o.channel.topic ? " " + o.channel.topic :
" --no topic--";
if (!mode)
mode = "no mode";
tstring = "ChatZilla: " + chan + " (" + mode + ") " + topic;
mode = getMsg("updateTitleNoMode");
topic = o.channel.topic ? o.channel.topic :
getMsg("updateTitleNoTopic");
tstring = getMsg("updateTitleChannel", [nick, chan, mode, topic]);
break;
case "IRCUser":
tstring = "ChatZilla: Conversation with " +
client.currentObject.properNick;
tstring = getMsg("updateTitleUser", client.currentObject.properNick);
break;
default:
tstring = "ChatZilla!";
tstring = getMsg("updateTitleUnknown");
break;
}
@ -931,7 +985,8 @@ function updateTitle (obj)
actl.push ((client.activityList[i] == "!") ?
(Number(i) + 1) + "!" : (Number(i) + 1));
if (actl.length > 0)
tstring += " -- Activity [" + actl.join (", ") + "]";
tstring = getMsg("updateTitleWithActivity",
[tstring, actl.join (", ")]);
}
document.title = tstring;
@ -1303,7 +1358,7 @@ function deleteToolbutton (tb)
}
else
{
window.alert ("Current view cannot be deleted.");
window.alert (getMsg("deleteToolbuttonMsg"));
return -1;
}
@ -1346,11 +1401,11 @@ function cli_load(url, obj)
}
catch (ex)
{
var msg = "Error loading subscript: " + ex;
var msg = getMsg("cli_loadMsg",ex);
if (ex.fileName)
msg += " file:" + ex.fileName;
msg += getMsg("cli_loadMsg2",ex.fileName);
if (ex.lineNumber)
msg += " line:" + ex.lineNumber;
msg += getMsg("cli_loadMsg3",ex.lineNumber);
client.currentObject.display (msg, "ERROR");
}
@ -1379,8 +1434,7 @@ function cli_say(msg)
default:
if (msg != "")
client.currentObject.display
("No default action for objects of type ``" +
client.currentObject.TYPE + "''", "ERROR");
(getMsg("cli_sayMsg", client.currentObject.TYPE), "ERROR");
break;
}
@ -1684,7 +1738,7 @@ function usr_graphres()
this.parent.parent.parent.name + ":" +
this.parent.name + ":" +
CIRCUser.nextResID++);
//dd ("created cuser resource " + this.rdfRes.Value);
rdf.Assert (this.rdfRes, rdf.resNick, rdf.GetLiteral(this.properNick));

Просмотреть файл

@ -26,3 +26,18 @@
<!ENTITY lastPing.label "Last Ping">
<!ENTITY key.label "Key">
<!ENTITY network.label "Network">
<!-- ADD ENTITIES -->
<!ENTITY OptionsCmd.label "Options">
<!ENTITY ShowToolbarCmd.label "Show Toolbar">
<!ENTITY ShowUserlistCmd.label "Show Userlist">
<!ENTITY ShowStatusbarCmd.label "Show Statusbar">
<!ENTITY EnableSmileysCmd.label "Enable Smileys">
<!ENTITY DebugMsgCmd.label "Debug Messages">
<!ENTITY SaveSetNowCmd.label "Save Settings Now">
<!ENTITY SaveSetExitCmd.label "Save Settings On Exit">
<!ENTITY ViewCmd.label "View">
<!ENTITY HideCmd.label "Hide">
<!ENTITY ClearViewCmd.label "Clear this view">
<!ENTITY DeleteViewCmd.label "Delete this view">