From b8fdd572cede5dc5fde11e505fb311513f298d80 Mon Sep 17 00:00:00 2001 From: Cory Chaplin Date: Tue, 25 Mar 2014 18:00:50 +0100 Subject: [PATCH] Added non translated strings to text themes. Work in progress. --- client/assets/text_themes/default.json | 16 +++++++++++-- client/src/models/network.js | 31 +++++++++++++------------- client/src/translations/en-gb.po | 4 ++++ client/src/translations/fr.po | 4 ++++ client/src/views/texttheme.js | 2 +- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/client/assets/text_themes/default.json b/client/assets/text_themes/default.json index a0577e0..5b90e8f 100644 --- a/client/assets/text_themes/default.json +++ b/client/assets/text_themes/default.json @@ -10,7 +10,8 @@ "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_inviteonly": "== %T", + "client_models_network_channel_alreadyin": "== %T", "client_models_network_channel_limitreached": "== %C %T", "client_models_network_nickname_alreadyinuse": "== %T", "client_models_network_channel_invalid_name": "== %C %T", @@ -22,5 +23,16 @@ "client_models_network_server": "%T", "client_models_network_idle": "%T", "client_models_network_nickname_notfound": "%T", - "client_models_network_nickname_changed": "%N %T" + "client_models_network_nickname_changed": "%N %T", + "chanop_privs_needed": "== %T", + "no_such_nick": "== %N: %T", + "unknown_command": "%T", + "motd": "%T", + "privmsg": "%T", + "ctcp": "CTCP: %T", + "notice": "NOTICE: %T", + "action": "* %T", + "whois_ident": "%N [%N!%J@%H] * %T", + "whois": "%T", + "who": "%N [%N!%J@%H] * %R" } \ No newline at end of file diff --git a/client/src/models/network.js b/client/src/models/network.js index 287361f..75c3eb5 100644 --- a/client/src/models/network.js +++ b/client/src/models/network.js @@ -287,7 +287,7 @@ function onMotd(event) { - this.panels.server.addMsg(this.get('name'), event.msg, 'motd'); + this.panels.server.addMsg(this.get('name'), styleText('motd', {'%T': event.msg}), 'motd'); } @@ -413,7 +413,7 @@ } } - panel.addMsg(event.nick, event.msg, 'privmsg', {time: event.time}); + panel.addMsg(event.nick, styleText('privmsg', {'%T': event.msg}), 'privmsg', {time: event.time}); } @@ -457,7 +457,7 @@ return; } - this.panels.server.addMsg('[' + event.nick + ']', 'CTCP ' + event.msg, 'ctcp', {time: event.time}); + this.panels.server.addMsg('[' + event.nick + ']', styleText('ctcp', {'%T': event.msg}), 'ctcp', {time: event.time}); } @@ -491,11 +491,11 @@ panel = this.panels.server; } - panel.addMsg('[' + (event.nick||'') + ']', event.msg, 'notice', {time: event.time}); + panel.addMsg('[' + (event.nick||'') + ']', styleText('notice', {'%T': event.msg}), 'notice', {time: event.time}); // Show this notice to the active panel if it didn't have a set target if (!event.from_server && panel === this.panels.server && _kiwi.app.panels().active !== this.panels.server) - _kiwi.app.panels().active.addMsg('[' + (event.nick||'') + ']', event.msg, 'notice', {time: event.time}); + _kiwi.app.panels().active.addMsg('[' + (event.nick||'') + ']', styleText('notice', {'%T': event.msg}), 'notice', {time: event.time}); } @@ -526,7 +526,7 @@ } } - panel.addMsg('', '* ' + event.nick + ' ' + event.msg, 'action', {time: event.time}); + panel.addMsg('', styleText('action', {'%N': event.nick, '%T': event.msg}), 'action', {time: event.time}); } @@ -720,13 +720,14 @@ panel = _kiwi.app.panels().active; if (event.ident) { - panel.addMsg(event.nick, event.nick + ' [' + event.nick + '!' + event.ident + '@' + event.host + '] * ' + event.msg, 'whois'); + panel.addMsg(event.nick, styleText('whois_ident', {'%N': event.nick, '%J': event.ident, '%H': event.host, '%T': event.msg}), 'whois'); + } else if (event.chans) { 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, 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'); + panel.addMsg(event.nick, styleText('whois', {'%T': event.msg}), 'whois'); } else if (event.logon) { logon_date = new Date(); logon_date.setTime(event.logon * 1000); @@ -748,7 +749,7 @@ panel = _kiwi.app.panels().active; if (event.host) { - panel.addMsg(event.nick, event.nick + ' [' + event.nick + ((event.ident)? '!' + event.ident : '') + '@' + event.host + '] * ' + event.real_name, 'whois'); + panel.addMsg(event.nick, styleText('who', {'%N': event.nick, '%J': event.ident, '%H': event.host, '%R': event.real_name, '%T': event.msg}), 'whois'); } else { panel.addMsg(event.nick, styleText('client_models_network_nickname_notfound', {'%N': event.nick, '%T': translateText('client_models_network_nickname_notfound', [])}), 'whois'); } @@ -792,26 +793,26 @@ _kiwi.app.message.text(_kiwi.global.i18n.translate('client_models_network_channel_badkey').fetch(event.channel)); break; case 'invite_only_channel': - panel.addMsg(' ', styleText('client_models_network_channel_inviteonly', {'%N': event.nick, '%T': translateText('client_models_network_channel_inviteonly', [event.channel]), '%C': event.channel}), 'status'); + panel.addMsg(' ', styleText('client_models_network_channel_inviteonly', {'%N': event.nick, '%T': translateText('client_models_network_channel_inviteonly', [event.nick, 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'); + panel.addMsg(' ', styleText('client_models_network_channel_alreadyin', {'%N': event.nick, '%T': translateText('client_models_network_channel_alreadyin', [event.nick]), '%C': event.channel})); break; case 'channel_is_full': 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': - panel.addMsg(' ', '== ' + event.reason, 'status'); + panel.addMsg(' ', styleText('chanop_privs_needed', {'%T': event.reason, '%C': event.channel}), 'status'); _kiwi.app.message.text(event.reason + ' (' + event.channel + ')'); break; case 'no_such_nick': tmp = this.panels.getByName(event.nick); if (tmp) { - tmp.addMsg(' ', '== ' + event.nick + ': ' + event.reason, 'status'); + tmp.addMsg(' ', styleText('no_such_nick', {'%N': event.nick, '%T': event.reason, '%C': event.channel}), 'status'); } else { - this.panels.server.addMsg(' ', '== ' + event.nick + ': ' + event.reason, 'status'); + this.panels.server.addMsg(' ', styleText('no_such_nick', {'%N': event.nick, '%T': event.reason, '%C': event.channel}), 'status'); } break; case 'nickname_in_use': @@ -848,7 +849,7 @@ if (event.trailing) display_params.push(event.trailing); - this.panels.server.addMsg('', '[' + event.command + '] ' + display_params.join(', ', '')); + this.panels.server.addMsg('', styleText('unknown_command', {'%T': '[' + event.command + '] ' + display_params.join(', ', '')})); } } diff --git a/client/src/translations/en-gb.po b/client/src/translations/en-gb.po index 91ba4e4..f478881 100755 --- a/client/src/translations/en-gb.po +++ b/client/src/translations/en-gb.po @@ -256,6 +256,10 @@ msgstr "Bad channel key for %s" msgid "client_models_network_channel_inviteonly" msgstr "is invite only." +#: +msgid "client_models_network_channel_alreadyin" +msgstr "is already on this channel" + #: msgid "client_models_network_channel_limitreached" msgstr "is full." diff --git a/client/src/translations/fr.po b/client/src/translations/fr.po index d37c3fb..de1ca27 100644 --- a/client/src/translations/fr.po +++ b/client/src/translations/fr.po @@ -256,6 +256,10 @@ msgstr "Mauvaise clef pour le canal %s." msgid "client_models_network_channel_inviteonly" msgstr "est sur invitation uniquement." +#: +msgid "client_models_network_channel_alreadyin" +msgstr "est déjà sur le salon" + #: msgid "client_models_network_channel_limitreached" msgstr "est rempli." diff --git a/client/src/views/texttheme.js b/client/src/views/texttheme.js index 68450a4..bb9230f 100644 --- a/client/src/views/texttheme.js +++ b/client/src/views/texttheme.js @@ -14,7 +14,7 @@ _kiwi.view.TextTheme = _kiwi.view.Panel.extend({ } } - text = style.replace(/%([TJHNC])/g, function(match, key) { + text = style.replace(/%([TJHNCR])/g, function(match, key) { key = '%' + key; if (typeof params[key.toUpperCase()] !== 'undefined') -- 2.25.1