--- /dev/null
+{
+ "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"
+}
\ No newline at end of file
__dirname + '/src/views/topicbar.js',\r
__dirname + '/src/views/userbox.js',\r
__dirname + '/src/views/channeltools.js',\r
- __dirname + '/src/views/channelinfo.js'\r
+ __dirname + '/src/views/channelinfo.js',\r
+ __dirname + '/src/views/texttheme.js'\r
];\r
\r
\r
} else {\r
_kiwi.global.i18n = new Jed();\r
}\r
-\r
+ \r
_kiwi.app = new _kiwi.model.Application(opts);\r
\r
// Start the client up\r
\r
callback && callback();\r
};\r
+ \r
+ igniteTextTheme = function(text_theme, s, xhr) {\r
+ _kiwi.global.text_theme = new _kiwi.view.TextTheme(text_theme);\r
+ \r
+ callback && callback();\r
+ }\r
\r
// Set up the settings datastore\r
_kiwi.global.settings = _kiwi.model.DataStore.instance('kiwi.settings');\r
} else {\r
$.getJSON(opts.base_path + '/assets/locales/' + locale + '.json', continueStart);\r
}\r
+\r
+ text_theme = _kiwi.global.settings.get('text_theme');\r
+ if (!text_theme) {\r
+ $.getJSON(opts.base_path + '/assets/text_themes/default.json', igniteTextTheme);\r
+ } else {\r
+ $.getJSON(opts.base_path + '/assets/text_themes/' + text_theme + '.json', igniteTextTheme);\r
+ }\r
+\r
}\r
};\r
\r
return;\r
}\r
\r
- this.addMsg(' ', '== ' + _kiwi.global.i18n.translate('client_models_channel_join').fetch(member.displayNick(true)), 'action join', {time: options.kiwi.time});\r
+ this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_join', [member.displayNick(true)]), '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.i18n.translate('client_models_channel_quit').fetch(member.displayNick(true), msg), 'action quit', {time: options.kiwi.time});\r
+ this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_quit', [member.displayNick(true)], msg), '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.i18n.translate('client_models_channel_kicked').fetch(member.displayNick(true), options.kiwi.by, msg), 'action kick', {time: options.kiwi.time});\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
}\r
} else {\r
- this.addMsg(' ', '== ' + _kiwi.global.i18n.translate('client_models_channel_selfkick').fetch(options.kiwi.by, msg), 'action kick', {time: options.kiwi.time});\r
+ this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_selfkick', [options.kiwi.by], msg), 'action kick', {time: options.kiwi.time});\r
}\r
} else if (show_message) {\r
- this.addMsg(' ', '== ' + _kiwi.global.i18n.translate('client_models_channel_part').fetch(member.displayNick(true), msg), 'action part', {time: options.kiwi.time});\r
+ this.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_channel_part', [member.displayNick(true)], msg), 'action part', {time: options.kiwi.time});\r
+\r
}\r
}, this);\r
},\r
member = panel.get('members').getByNick(event.nick);
if (member) {
member.set('nick', event.newnick);
- panel.addMsg('', '== ' + _kiwi.global.i18n.translate('client_models_network_nickname_changed').fetch(event.nick, event.newnick) , 'action nick', {time: event.time});
+ panel.addMsg('', _kiwi.global.text_theme.styleText('client_models_network_nickname_changed', [event.nick, event.newnick], 'action nick', {time: event.time}));
}
});
}
request_updated_banlist = true;
}
- channel.addMsg('', '== ' + _kiwi.global.i18n.translate('client_models_network_mode').fetch(event.nick, friendlyModeString()), 'action mode', {time: event.time});
+ channel.addMsg('', _kiwi.global.text_theme.styleText('client_models_network_mode', [event.nick, friendlyModeString()]), '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.i18n.translate('client_models_network_selfmode').fetch(event.nick, friendlyModeString()), 'action mode');
+ this.panels.server.addMsg('', _kiwi.global.text_theme.styleText('client_models_network_selfmode', [event.nick, friendlyModeString()]), 'action mode');
} else {
console.log('MODE command recieved for unknown target %s: ', event.target, event);
}
switch (event.error) {
case 'banned_from_channel':
- panel.addMsg(' ', '== ' + _kiwi.global.i18n.translate('client_models_network_banned').fetch(event.channel, event.reason), 'status');
+ panel.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_banned', [event.channel, event.reason]), '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.i18n.translate('client_models_network_channel_badkey').fetch(event.channel), 'status');
+ panel.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_channel_badkey', [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.i18n.translate('client_models_network_channel_inviteonly').fetch(event.channel), 'status');
+ panel.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_channel_inviteonly', [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.i18n.translate('client_models_network_channel_limitreached').fetch(event.channel), 'status');
+ panel.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_channel_limitreached', [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.i18n.translate('client_models_network_nickname_alreadyinuse').fetch( event.nick), 'status');
+ this.panels.server.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_nickname_alreadyinuse', [event.nick]), '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.i18n.translate('client_models_network_badpassword').fetch(), 'status');
+ this.panels.server.addMsg(' ', _kiwi.global.text_theme.styleText('client_models_network_badpassword'), 'status');
break;
default:
// We don't know what data contains, so don't do anything with it.
topic = this.model.get("topic");
}
- this.model.addMsg('', '== ' + _kiwi.global.i18n.translate('client_views_channel_topic').fetch(this.model.get('name'), topic), 'topic');
+ this.model.addMsg('', _kiwi.global.text_theme.styleText('client_views_channel_topic', [this.model.get('name'), topic]), 'topic');
// If this is the active channel then update the topic bar
if (_kiwi.app.panels().active === this) {
--- /dev/null
+_kiwi.view.TextTheme = _kiwi.view.Panel.extend({
+ 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 = '') {
+ var style, text;
+
+ style = formatToIrcMsg(_kiwi.global.text_theme.options[string_id]);
+ text = this.getText(string_id, params, trailing);
+
+ return style.replace('%T', text);
+ }
+});
\ No newline at end of file
'src/views/topicbar.js',
'src/views/userbox.js',
'src/views/channeltools.js',
- 'src/views/channelinfo.js'
+ 'src/views/channelinfo.js',
+ 'src/views/texttheme.js'
]
]);
}
\ No newline at end of file