{
- "client_models_channel_join": "%C3== %I%T",
- "client_models_channel_part": "%C5== %I%T",
- "client_models_channel_quit": "%C5== %I%T",
- "client_models_channel_kicked": "%C5== %I%T",
- "client_models_channel_selfkick": "%C5== %I%T",
- "client_models_network_badpassword": "%C3== %I%T",
- "client_models_network_mode": "%C3== %I%T",
- "client_models_network_selfmode": "%C3== %I%T",
- "client_models_network_banned": "%C3== %I%T",
- "client_models_network_channel_badkey": "%C3== %I%T",
- "client_models_network_channel_inviteonly": "%C3== %I%T",
- "client_models_network_channel_limitreached": "%C3== %I%T",
- "client_models_network_nickname_alreadyinuse": "%C3== %I%T"
+ "client_models_channel_join": "== %N %T",
+ "client_models_channel_part": "== %N %T",
+ "client_models_channel_quit": "== %N %T",
+ "client_models_channel_kicked": "== %N %T",
+ "client_models_channel_selfkick": "== %T",
+ "client_models_network_badpassword": "== %T",
+ "client_views_channel_topic": "== %T",
+ "client_models_network_mode": "== %N %T",
+ "client_models_network_selfmode": "== %N %T",
+ "client_models_network_banned": "== %T",
+ "client_models_network_channel_badkey": "== %T",
+ "client_models_network_channel_inviteonly": "== %C %T",
+ "client_models_network_channel_limitreached": "== %C %T",
+ "client_models_network_nickname_alreadyinuse": "== %T",
+ "client_models_network_channel_invalid_name": "== %C %T",
+ "client_models_network_disconnected": "%T",
+ "client_models_network_topic": "%T",
+ "client_models_network_channels": "%T",
+ "client_models_network_idle_and_signon": "%T",
+ "client_models_network_away": "%T",
+ "client_models_network_server": "%T",
+ "client_models_network_idle": "%T",
+ "client_models_network_nickname_notfound": "%T",
+ "client_models_network_nickname_changed": "%N %T"
}
\ No newline at end of file
return _date;
}
+}
+
+// Simplyfy the translation syntax
+function translateText(string_id, params) {
+ return _kiwi.global.i18n.translate(string_id).fetch(params);
+}
+// Simplyfy the text styling syntax
+function styleText(string_id, params) {
+ return _kiwi.global.text_theme.styleText(string_id, params);
}
\ No newline at end of file
return;\r
}\r
\r
- this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_join', [member.displayNick(true)]), 'action join', {time: options.kiwi.time});\r
+ this.addMsg(' ', styleText('client_models_channel_join', {'%M': member.getMemberMask(), '%T': translateText('client_models_channel_join'), '%C': name}), 'action join', {time: options.kiwi.time});\r
}, this);\r
\r
members.bind("remove", function (member, members, options) {\r
var msg = (options.kiwi.message) ? '(' + options.kiwi.message + ')' : '';\r
\r
if (options.kiwi.type === 'quit' && show_message) {\r
- this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_quit', [member.displayNick(true)], msg), 'action quit', {time: options.kiwi.time});\r
+ this.addMsg(' ', styleText('client_models_channel_quit', {'%M': member.getMemberMask(), '%T': translateText('client_models_channel_quit', [msg]), '%C': name}), 'action quit', {time: options.kiwi.time});\r
\r
} else if (options.kiwi.type === 'kick') {\r
\r
if (!options.kiwi.current_user_kicked) {\r
//If user kicked someone, show the message regardless of settings.\r
if (show_message || options.kiwi.current_user_initiated) {\r
- this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_kicked', [member.displayNick(true), options.kiwi.by, msg]), 'action kick', {time: options.kiwi.time});\r
+ this.addMsg(' ', styleText('client_models_channel_kicked', {'%M': member.getMemberMask(), '%T': translateText('client_models_channel_kicked', [options.kiwi.by, msg]), '%C': name}), 'action kick', {time: options.kiwi.time});\r
}\r
} else {\r
- this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_selfkick', [options.kiwi.by], msg), 'action kick', {time: options.kiwi.time});\r
+ this.addMsg(' ', styleText('client_models_channel_selfkick', {'%T': translateText('client_models_channel_selfkick', [options.kiwi.by, msg]), '%C': name}), 'action kick', {time: options.kiwi.time});\r
}\r
} else if (show_message) {\r
- this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_part', [member.displayNick(true)], msg), 'action part', {time: options.kiwi.time});\r
+ this.addMsg(' ', styleText('client_models_channel_part', {'%M': member.getMemberMask(), '%T': translateText('client_models_channel_part', [msg]), '%C': name}), 'action part', {time: options.kiwi.time});\r
\r
}\r
}, this);\r
\r
return display;\r
},\r
+ getMemberMask: function () {\r
+ // Why to use %N and %H is quite clear here. %J is because %I is already for italic and %U for underlines. Better ideas ?\r
+ return {'%N': this.get('nick'), '%J': this.get("ident"), '%H': this.get("hostname")};\r
+ },\r
isOp: function () {\r
var user_prefixes = _kiwi.gateway.get('user_prefixes'),\r
modes = this.get('modes'),\r
// If not a valid channel name, display a warning
if (!that.isChannelName(channel_name)) {
- that.panels.server.addMsg('', _kiwi.global.i18n.translate('client_models_network_channel_invalid_name').fetch(channel_name));
+ that.panels.server.addMsg('', styleText('client_models_network_channel_invalid_name', {'%T': translateText('client_models_network_channel_invalid_name', []), '%C': channel_name}));
_kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_invalid_name').fetch(channel_name), {timeout: 5000});
return;
}
function onDisconnect(event) {
$.each(this.panels.models, function (index, panel) {
- panel.addMsg('', _kiwi.global.i18n.translate('client_models_network_disconnected').fetch(), 'action quit');
+ panel.addMsg('', styleText('client_models_network_disconnected', {'%T': translateText('client_models_network_disconnected', [])}), 'action quit');
});
}
member = panel.get('members').getByNick(event.nick);
if (member) {
member.set('nick', event.newnick);
- panel.addMsg('', _kiwi.global.text_theme.styleText('client_models_network_nickname_changed', [event.nick, event.newnick], 'action nick', {time: event.time}));
+ panel.addMsg('', styleText('client_models_network_nickname_changed', {'%M': member.getMemberMask(), '%T': translateText('client_models_network_nickname_changed', [event.newnick]), '%C': name}), 'action nick', {time: event.time});
}
});
}
if (!c) return;
when = formatDate(new Date(event.when * 1000));
- c.addMsg('', _kiwi.global.i18n.translate('client_models_network_topic').fetch(event.nick, when), 'topic');
+ c.addMsg('', styleText('client_models_network_topic', {'%T': translateText('client_models_network_topic', [event.nick, when]), '%C': event.channel}), 'topic');
}
request_updated_banlist = true;
}
- channel.addMsg('', _kiwi.global.text_theme.styleText('client_models_network_mode', [event.nick, friendlyModeString()]), 'action mode', {time: event.time});
+ console.log('event', event);
+ channel.addMsg('', styleText('client_models_network_mode', {'%N': event.nick, '%T': translateText('client_models_network_mode', [friendlyModeString()]), '%C': event.target}), 'action mode', {time: event.time});
// TODO: Be smart, remove the specific ban from the banlist rather than request a whole banlist
if (request_updated_banlist)
} else {
// This is probably a mode being set on us.
if (event.target.toLowerCase() === this.get("nick").toLowerCase()) {
- this.panels.server.addMsg('', _kiwi.global.text_theme.styleText('client_models_network_selfmode', [event.nick, friendlyModeString()]), 'action mode');
+ this.panels.server.addMsg('', styleText('client_models_network_selfmode', {'%N': event.nick, '%T': translateText('client_models_network_mode', [friendlyModeString()]), '%C': event.target}), 'action mode');
} else {
console.log('MODE command recieved for unknown target %s: ', event.target, event);
}
if (event.ident) {
panel.addMsg(event.nick, event.nick + ' [' + event.nick + '!' + event.ident + '@' + event.host + '] * ' + event.msg, 'whois');
} else if (event.chans) {
- panel.addMsg(event.nick, _kiwi.global.i18n.translate('client_models_network_channels').fetch(event.chans), 'whois');
+ panel.addMsg(event.nick, styleText('client_models_network_channels', {'%N': event.nick, '%T': translateText('client_models_network_channels', [event.chans])}), 'whois');
} else if (event.irc_server) {
- panel.addMsg(event.nick, _kiwi.global.i18n.translate('client_models_network_server').fetch(event.irc_server, event.server_info), 'whois');
+ panel.addMsg(event.nick, styleText('client_models_network_server', {'%N': event.nick, '%T': translateText('client_models_network_server', [event.irc_server, event.server_info])}), 'whois');
} else if (event.msg) {
panel.addMsg(event.nick, event.msg, 'whois');
} else if (event.logon) {
logon_date.setTime(event.logon * 1000);
logon_date = formatDate(logon_date);
- panel.addMsg(event.nick, _kiwi.global.i18n.translate('client_models_network_idle_and_signon').fetch(idle_time, logon_date), 'whois');
+ panel.addMsg(event.nick, styleText('client_models_network_idle_and_signon', {'%N': event.nick, '%T': translateText('client_models_network_idle_and_signon', [idle_time, logon_date])}), 'whois');
} else if (event.away_reason) {
- panel.addMsg(event.nick, _kiwi.global.i18n.translate('client_models_network_away').fetch(event.away_reason), 'whois');
+ panel.addMsg(event.nick, styleText('client_models_network_away', {'%N': event.nick, '%T': translateText('client_models_network_away', [event.away_reason])}), 'whois');
} else {
- panel.addMsg(event.nick, _kiwi.global.i18n.translate('client_models_network_idle').fetch(idle_time), 'whois');
+ panel.addMsg(event.nick, client_models_network_server('client_models_network_idle', {'%N': event.nick, '%T': translateText('client_models_network_idle', [idle_time])}), 'whois');
}
}
if (event.host) {
panel.addMsg(event.nick, event.nick + ' [' + event.nick + ((event.ident)? '!' + event.ident : '') + '@' + event.host + '] * ' + event.real_name, 'whois');
} else {
- panel.addMsg(event.nick, _kiwi.global.i18n.translate('client_models_network_nickname_notfound').fetch(), 'whois');
+ panel.addMsg(event.nick, styleText('client_models_network_nickname_notfound', {'%N': event.nick, '%T': translateText('client_models_network_nickname_notfound', [])}), 'whois');
}
}
switch (event.error) {
case 'banned_from_channel':
- panel.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_banned', [event.channel, event.reason]), 'status');
+ panel.addMsg(' ', styleText('client_models_network_banned', {'%N': event.nick, '%T': translateText('client_models_network_banned', [event.channel, event.reason]), '%C': event.channel}), 'status');
_kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_banned').fetch(event.channel, event.reason));
break;
case 'bad_channel_key':
- panel.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_channel_badkey', [event.channel]), 'status');
+ panel.addMsg(' ', styleText('client_models_network_channel_badkey', {'%N': event.nick, '%T': translateText('client_models_network_channel_badkey', [event.channel]), '%C': event.channel}), 'status');
_kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_badkey').fetch(event.channel));
break;
case 'invite_only_channel':
- panel.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_channel_inviteonly', [event.channel]), 'status');
+ panel.addMsg(' ', styleText('client_models_network_channel_inviteonly', {'%N': event.nick, '%T': translateText('client_models_network_channel_inviteonly', [event.channel]), '%C': event.channel}), 'status');
_kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_inviteonly').fetch(event.channel));
break;
case 'user_on_channel':
panel.addMsg(' ', '== ' + event.nick + ' is already on this channel');
break;
case 'channel_is_full':
- panel.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_channel_limitreached', [event.channel]), 'status');
+ panel.addMsg(' ', styleText('client_models_network_channel_limitreached', {'%N': event.nick, '%T': translateText('client_models_network_channel_limitreached', [event.channel]), '%C': event.channel}), 'status');
_kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_limitreached').fetch(event.channel));
break;
case 'chanop_privs_needed':
}
break;
case 'nickname_in_use':
- this.panels.server.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_nickname_alreadyinuse', [event.nick]), 'status');
+ this.panels.server.addMsg(' ', styleText('client_models_network_nickname_alreadyinuse', {'%N': event.nick, '%T': translateText('client_models_network_nickname_alreadyinuse', [event.nick]), '%C': event.channel}), 'status');
if (this.panels.server !== this.panels.active) {
_kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_nickname_alreadyinuse').fetch(event.nick));
}
break;
case 'password_mismatch':
- this.panels.server.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_badpassword'), 'status');
+ this.panels.server.addMsg(' ', styleText('client_models_network_badpassword', {'%N': event.nick, '%T': translateText('client_models_network_badpassword', []), '%C': event.channel}), 'status');
break;
default:
// We don't know what data contains, so don't do anything with it.
#: client/assets/src/models/channel.js
msgid "client_models_channel_join"
-msgstr "%s has joined"
+msgstr "has joined"
#:
msgid "client_models_channel_quit"
-msgstr "%s has quit %s"
+msgstr "has quit %s"
#:
msgid "client_models_channel_kicked"
-msgstr "%s was kicked by %s %s"
+msgstr "was kicked by %s %s"
#:
msgid "client_models_channel_selfkick"
#:
msgid "client_models_channel_part"
-msgstr "%s has left %s"
+msgstr "has left %s"
#: client/assets/src/models/network.js
msgid "client_models_network_channel_invalid_name"
-msgstr "%s is not a valid channel name"
+msgstr "is not a valid channel name"
#:
msgid "client_models_network_disconnected"
#:
msgid "client_models_network_nickname_changed"
-msgstr "%s is now known as %s"
+msgstr "is now known as %s"
#:
msgid "client_models_network_topic"
#:
msgid "client_models_network_selfmode"
-msgstr "%s sets mode %s"
+msgstr "sets mode %s"
#:
msgid "client_models_network_mode"
-msgstr "%s set mode %s"
+msgstr "set mode %s"
#:
msgid "client_models_network_channels"
#:
msgid "client_models_network_channel_inviteonly"
-msgstr "%s is invite only."
+msgstr "is invite only."
#:
msgid "client_models_network_channel_limitreached"
-msgstr "%s is full."
+msgstr "is full."
#:
msgid "client_models_network_nickname_alreadyinuse"
#: client/assets/src/models/channel.js
msgid "client_models_channel_join"
-msgstr "%s a rejoint"
+msgstr "a rejoint"
#:
msgid "client_models_channel_quit"
-msgstr "%s a quitté %s"
+msgstr "a quitté %s"
#:
msgid "client_models_channel_kicked"
-msgstr "%s a été expulsé par %s : %s"
+msgstr "a été expulsé par %s : %s"
#:
msgid "client_models_channel_selfkick"
#:
msgid "client_models_channel_part"
-msgstr "%s est parti du canal %s"
+msgstr "est parti du canal %s"
#: client/assets/src/models/network.js
msgid "client_models_network_channel_invalid_name"
-msgstr "%s n'est pas un nom de canal valide."
+msgstr "n'est pas un nom de canal valide."
#:
msgid "client_models_network_disconnected"
#:
msgid "client_models_network_nickname_changed"
-msgstr "%s est désormais connu comme %s"
+msgstr "est désormais connu comme %s"
#:
msgid "client_models_network_topic"
#:
msgid "client_models_network_selfmode"
-msgstr "%s a modifié les modes : %s"
+msgstr "a modifié les modes : %s"
#:
msgid "client_models_network_mode"
-msgstr "%s a modifié les modes : %s"
+msgstr "a modifié les modes : %s"
#:
msgid "client_models_network_channels"
#:
msgid "client_models_network_channel_inviteonly"
-msgstr "%s est sur invitation uniquement."
+msgstr "est sur invitation uniquement."
#:
msgid "client_models_network_channel_limitreached"
-msgstr "%s est rempli."
+msgstr "est rempli."
#:
msgid "client_models_network_nickname_alreadyinuse"
topic = this.model.get("topic");
}
- this.model.addMsg('', _kiwi.global.text_theme.styleText('client_views_channel_topic', [this.model.get('name'), topic]), 'topic');
+ this.model.addMsg('', styleText('client_views_channel_topic', {'%T': translateText('client_views_channel_topic', [this.model.get('name'), topic]), '%C': this.model.get('name')}), 'topic');
// If this is the active channel then update the topic bar
if (_kiwi.app.panels().active === this) {
initialize: function(text_theme) {
this.text_theme = text_theme;
},
- getText: function(string_id, params, trailing = '') {
- var translation;
-
- translation = _kiwi.global.i18n.translate(string_id).fetch(params);
-
- return translation + trailing;
- },
- styleText: function(string_id, params, trailing = '') {
+ styleText: function(string_id, params) {
var style, text;
style = formatToIrcMsg(_kiwi.global.text_theme.options[string_id]);
- text = this.getText(string_id, params, trailing);
- return style.replace('%T', text);
+ // Bring member info back to first level of params
+ if (params['%M']) {
+ for(key in params['%M']) {
+ params[key] = params['%M'][key];
+ }
+ }
+
+ text = style.replace(/%([TJHNC])/g, function(match, key) {
+ key = '%' + key;
+
+ if (typeof params[key.toUpperCase()] !== 'undefined')
+ return params[key.toUpperCase()];
+ });
+ return text;
}
});
\ No newline at end of file