From 1f44a866891e4e44a4dd12a0c4b32da6e6668e2c Mon Sep 17 00:00:00 2001 From: Cory Chaplin Date: Wed, 26 Mar 2014 00:16:39 +0100 Subject: [PATCH] Finishing first run of text themes. --- client/assets/text_themes/default.json | 18 +++++++++- client/src/helpers/utils.js | 2 ++ client/src/models/application.js | 50 +++++++++++++------------- client/src/models/network.js | 2 +- client/src/translations/en-gb.po | 4 +++ client/src/translations/fr.po | 4 +++ 6 files changed, 53 insertions(+), 27 deletions(-) diff --git a/client/assets/text_themes/default.json b/client/assets/text_themes/default.json index 5b90e8f..902ea40 100644 --- a/client/assets/text_themes/default.json +++ b/client/assets/text_themes/default.json @@ -24,6 +24,10 @@ "client_models_network_idle": "%T", "client_models_network_nickname_notfound": "%T", "client_models_network_nickname_changed": "%N %T", + "client_models_application_applet_notfound": "%T", + "client_models_application_has_been_invited": "== %N %T", + "client_models_application_encoding_changed": "%T", + "client_models_application_encoding_invalid": "%T", "chanop_privs_needed": "== %T", "no_such_nick": "== %N: %T", "unknown_command": "%T", @@ -34,5 +38,17 @@ "action": "* %T", "whois_ident": "%N [%N!%J@%H] * %T", "whois": "%T", - "who": "%N [%N!%J@%H] * %R" + "who": "%N [%N!%J@%H] * %R", + "quit": "%T", + "rejoin": "%T", + "set_setting": "%T", + "save_settings": "%T", + "list_aliases": "%T", + "ignore_list": "%T:", + "ignored_pattern": "%T", + "ignore_nick": "%T", + "stop_notice": "%T", + "ignore_stopped": "%T", + "query": "%T", + "msg": "%T" } \ No newline at end of file diff --git a/client/src/helpers/utils.js b/client/src/helpers/utils.js index f9384c3..9c32e02 100644 --- a/client/src/helpers/utils.js +++ b/client/src/helpers/utils.js @@ -505,6 +505,8 @@ function parseISO8601(str) { // Simplyfy the translation syntax function translateText(string_id, params) { + if (params === undefined) var params = ''; + return _kiwi.global.i18n.translate(string_id).fetch(params); } // Simplyfy the text styling syntax diff --git a/client/src/models/application.js b/client/src/models/application.js index bc60a95..f8e91d3 100644 --- a/client/src/models/application.js +++ b/client/src/models/application.js @@ -369,13 +369,13 @@ // Mention the disconnection on every channel _kiwi.app.connections.forEach(function(connection) { - connection.panels.server.addMsg('', msg, 'action quit'); + connection.panels.server.addMsg('', styleText('quit', {'%T': msg}), 'action quit'); connection.panels.forEach(function(panel) { if (!panel.isChannel()) return; - panel.addMsg('', msg, 'action quit'); + panel.addMsg('', styleText('quit', {'%T': msg}), 'action quit'); }); }); @@ -388,7 +388,7 @@ // Only need to mention the repeating re-connection messages on server panels _kiwi.app.connections.forEach(function(connection) { - connection.panels.server.addMsg('', msg, 'action quit'); + connection.panels.server.addMsg('', styleText('quit', {'%T': msg}), 'action quit'); }); }); @@ -404,13 +404,13 @@ // Mention the re-connection on every channel _kiwi.app.connections.forEach(function(connection) { - connection.panels.server.addMsg('', msg, 'action join'); + connection.panels.server.addMsg('', styleText('rejoin', {'%T': msg}), 'action join'); connection.panels.forEach(function(panel) { if (!panel.isChannel()) return; - panel.addMsg('', msg, 'action join'); + panel.addMsg('', styleText('rejoin', {'%T': msg}), 'action join'); }); }); @@ -567,13 +567,13 @@ } // Read the value to the user - _kiwi.app.panels().active.addMsg('', setting + ' = ' + _kiwi.global.settings.get(setting).toString()); + _kiwi.app.panels().active.addMsg('', styleText('set_setting', {'%T': setting + ' = ' + _kiwi.global.settings.get(setting).toString()})); }; fn_to_bind['command:save'] = function (ev) { _kiwi.global.settings.save(); - _kiwi.app.panels().active.addMsg('', _kiwi.global.i18n.translate('client_models_application_settings_saved').fetch()); + _kiwi.app.panels().active.addMsg('', styleText('save_settings', {'%T': translateText('client_models_application_settings_saved')})); }; @@ -583,7 +583,7 @@ // No parameters passed so list them if (!ev.params[1]) { $.each(controlbox.preprocessor.aliases, function (name, rule) { - _kiwi.app.panels().server.addMsg(' ', name + ' => ' + rule); + _kiwi.app.panels().server.addMsg(' ', styleText('list_aliases', {'%T': name + ' => ' + rule})); }); return; } @@ -615,12 +615,12 @@ // No parameters passed so list them if (!ev.params[0]) { if (list.length > 0) { - _kiwi.app.panels().active.addMsg(' ', _kiwi.global.i18n.translate('client_models_application_ignore_title').fetch() + ':'); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_list', {'%T': translateText('client_models_application_ignore_title')})); $.each(list, function (idx, ignored_pattern) { - _kiwi.app.panels().active.addMsg(' ', ignored_pattern); + _kiwi.app.panels().active.addMsg(' ', styleText('ignored_pattern', {'%T': ignored_pattern})); }); } else { - _kiwi.app.panels().active.addMsg(' ', _kiwi.global.i18n.translate('client_models_application_ignore_none').fetch()); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_list', {'%T': translateText('client_models_application_ignore_none')})); } return; } @@ -628,7 +628,7 @@ // We have a parameter, so add it list.push(ev.params[0]); this.connections.active_connection.set('ignore_list', list); - _kiwi.app.panels().active.addMsg(' ', _kiwi.global.i18n.translate('client_models_application_ignore_nick').fetch(ev.params[0])); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_nick', {'%T': translateText('client_models_application_ignore_nick', [ev.params[0]])})); }; @@ -636,7 +636,7 @@ var list = this.connections.active_connection.get('ignore_list'); if (!ev.params[0]) { - _kiwi.app.panels().active.addMsg(' ', _kiwi.global.i18n.translate('client_models_application_ignore_stop_notice').fetch()); + _kiwi.app.panels().active.addMsg(' ', styleText('stop_notice', {'%T': translateText('client_models_application_ignore_stop_notice')})); return; } @@ -646,7 +646,7 @@ this.connections.active_connection.set('ignore_list', list); - _kiwi.app.panels().active.addMsg(' ', _kiwi.global.i18n.translate('client_models_application_ignore_stopped').fetch(ev.params[0])); + _kiwi.app.panels().active.addMsg(' ', styleText('ignore_stopped', {'%T': translateText('client_models_application_ignore_stopped', [ev.params[0]])})); }; @@ -706,7 +706,7 @@ if (message) { this.connections.active_connection.gateway.msg(panel.get('name'), message); - panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), message); + panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('query', {'%T': message})); } } @@ -719,7 +719,7 @@ ev.params.shift(); message = formatToIrcMsg(ev.params.join(' ')); - panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), message); + panel.addMsg(_kiwi.app.connections.active_connection.get('nick'), styleText('msg', {'%T': message})); this.connections.active_connection.gateway.msg(destination, message); } @@ -729,7 +729,7 @@ } var panel = _kiwi.app.panels().active; - panel.addMsg('', '* ' + _kiwi.app.connections.active_connection.get('nick') + ' ' + ev.params.join(' '), 'action'); + panel.addMsg('', styleText('action', {'%T': _kiwi.app.connections.active_connection.get('nick') + ' ' + ev.params.join(' ')}), 'action'); this.connections.active_connection.gateway.action(panel.get('name'), ev.params.join(' ')); } @@ -842,7 +842,7 @@ if (_kiwi.applets[ev.params[0]]) { panel.load(new _kiwi.applets[ev.params[0]]()); } else { - _kiwi.app.panels().server.addMsg('', _kiwi.global.i18n.translate('client_models_application_applet_notfound').fetch(ev.params[0])); + _kiwi.app.panels().server.addMsg('', styleText('client_models_application_applet_notfound', {'%T': translateText('client_models_application_applet_notfound', [ev.params[0]])})); return; } } @@ -869,7 +869,7 @@ _kiwi.app.connections.active_connection.gateway.raw('INVITE ' + nick + ' ' + channel); - _kiwi.app.panels().active.addMsg('', '== ' + nick + ' has been invited to ' + channel, 'action'); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_has_been_invited', {'%N': nick, '%T': translateText('client_models_application_has_been_invited', [channel])}), 'action'); } @@ -904,14 +904,14 @@ if (ev.params[0]) { _kiwi.gateway.setEncoding(null, ev.params[0], function (success) { if (success) { - _kiwi.app.panels().active.addMsg('', _kiwi.global.i18n.translate('client_models_application_encoding_changed').fetch(ev.params[0])); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_changed', {'%T': translateText('client_models_application_encoding_changed', [ev.params[0]])})); } else { - _kiwi.app.panels().active.addMsg('', _kiwi.global.i18n.translate('client_models_application_encoding_invalid').fetch(ev.params[0])); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_invalid', {'%T': translateText('client_models_application_encoding_invalid', [ev.params[0]])})); } }); } else { - _kiwi.app.panels().active.addMsg('', _kiwi.global.i18n.translate('client_models_application_encoding_notspecified').fetch()); - _kiwi.app.panels().active.addMsg('', _kiwi.global.i18n.translate('client_models_application_encoding_usage').fetch()); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_notspecified', {'%T': translateText('client_models_application_encoding_notspecified')})); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_encoding_usage', {'%T': translateText('client_models_application_encoding_usage')})); } } @@ -973,7 +973,7 @@ // Use the same nick as we currently have nick = _kiwi.app.connections.active_connection.get('nick'); - _kiwi.app.panels().active.addMsg('', _kiwi.global.i18n.translate('client_models_application_connection_connecting').fetch(server, port.toString())); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_connecting', {'%T': translateText('client_models_application_connection_connecting', [server, port.toString()])})); _kiwi.gateway.newConnection({ nick: nick, @@ -983,7 +983,7 @@ password: password }, function(err, new_connection) { if (err) - _kiwi.app.panels().active.addMsg('', _kiwi.global.i18n.translate('client_models_application_connection_error').fetch(server, port.toString(), err.toString())); + _kiwi.app.panels().active.addMsg('', styleText('client_models_application_connection_error', {'%T': translateText('client_models_application_connection_error', [server, port.toString(), err.toString()])})); }); } diff --git a/client/src/models/network.js b/client/src/models/network.js index dfd03cc..cf83418 100644 --- a/client/src/models/network.js +++ b/client/src/models/network.js @@ -735,7 +735,7 @@ } else if (event.away_reason) { 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, client_models_network_server('client_models_network_idle', {'%N': event.nick, '%T': translateText('client_models_network_idle', [idle_time])}), 'whois'); + panel.addMsg(event.nick, styleText('client_models_network_idle', {'%N': event.nick, '%T': translateText('client_models_network_idle', [idle_time])}), 'whois'); } } diff --git a/client/src/translations/en-gb.po b/client/src/translations/en-gb.po index f478881..ad8271e 100755 --- a/client/src/translations/en-gb.po +++ b/client/src/translations/en-gb.po @@ -148,6 +148,10 @@ msgstr "Stopped ignoring %s" msgid "client_models_application_applet_notfound" msgstr "Applet \"%s\" does not exist" +#: +msgid "client_models_application_has_been_invited" +msgstr "has been invited to %s" + #: msgid "client_models_application_encoding_changed" msgstr "Encoding modified to %s" diff --git a/client/src/translations/fr.po b/client/src/translations/fr.po index de1ca27..6d9b584 100644 --- a/client/src/translations/fr.po +++ b/client/src/translations/fr.po @@ -108,6 +108,10 @@ msgstr "Chargement..." msgid "client_models_applet_notfound" msgstr "Introuvable." +#: +msgid "client_models_application_has_been_invited" +msgstr "a été invité à rejoindre %s" + #: client/assets/src/models/application.js msgid "client_models_application_reconnecting" msgstr "Vous avez été déconnecté. Tentative de reconnexion en cours." -- 2.25.1