Skip to content

Commit

Permalink
Fixed #63: Fix youHaveBeenKicked/BannedBy to support kick/ban message…
Browse files Browse the repository at this point in the history
…s without an actor

fixed #64: adding japanese translation

fixed accidental overwrite of chinese translation (raptorMessageBlocked again..)

fixed #56: Updating french translation, thanks to @Ajoly
  • Loading branch information
mweibel committed Nov 28, 2011
1 parent cc0aae8 commit 4aff6dd
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 44 deletions.
123 changes: 106 additions & 17 deletions candy.bundle.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2491,14 +2491,20 @@ Candy.View.Observer = (function(self, $) {
self.Presence.notifyPrivateChats(user, args.type); self.Presence.notifyPrivateChats(user, args.type);
// Client has been kicked or banned // Client has been kicked or banned
} else if (args.type === 'kick' || args.type === 'ban') { } else if (args.type === 'kick' || args.type === 'ban') {
var actorName = args.actor ? Strophe.getNodeFromJid(args.actor) : args.roomName, var actorName = args.actor ? Strophe.getNodeFromJid(args.actor) : null,
actionLabel; actionLabel,
translationParams = [args.roomName];

if (actorName) {
translationParams.push(actorName);
}

switch(args.type) { switch(args.type) {
case 'kick': case 'kick':
actionLabel = $.i18n._('youHaveBeenKickedBy', [args.roomName, actorName]); actionLabel = $.i18n._((actorName ? 'youHaveBeenKickedBy' : 'youHaveBeenKicked'), translationParams);
break; break;
case 'ban': case 'ban':
actionLabel = $.i18n._('youHaveBeenBannedBy', [args.roomName, actorName]); actionLabel = $.i18n._((actorName ? 'youHaveBeenBannedBy' : 'youHaveBeenBanned'), translationParams);
break; break;
} }
Candy.View.Pane.Chat.Modal.show(Mustache.to_html(Candy.View.Template.Chat.Context.adminMessageReason, { Candy.View.Pane.Chat.Modal.show(Mustache.to_html(Candy.View.Template.Chat.Context.adminMessageReason, {
Expand Down Expand Up @@ -4366,9 +4372,11 @@ Candy.View.Translation = {
'subject' : 'Subject:', 'subject' : 'Subject:',
'reasonWas' : 'Reason was: %s.', 'reasonWas' : 'Reason was: %s.',
'kickActionLabel' : 'Kick', 'kickActionLabel' : 'Kick',
'youHaveBeenKickedBy' : 'You have been kicked from %s by %s', 'youHaveBeenKickedBy' : 'You have been kicked from %2$s by %1$s',
'youHaveBeenKicked' : 'You have been kicked from %s',
'banActionLabel' : 'Ban', 'banActionLabel' : 'Ban',
'youHaveBeenBannedBy' : 'You have been banned from %s by %s', 'youHaveBeenBannedBy' : 'You have been banned from %1$s by %2$s',
'youHaveBeenBanned' : 'You have been banned from %s',


'privateActionLabel' : 'Private chat', 'privateActionLabel' : 'Private chat',
'ignoreActionLabel' : 'Ignore', 'ignoreActionLabel' : 'Ignore',
Expand Down Expand Up @@ -4430,9 +4438,11 @@ Candy.View.Translation = {
'subject' : 'Titel:', 'subject' : 'Titel:',
'reasonWas' : 'Begründung: %s.', 'reasonWas' : 'Begründung: %s.',
'kickActionLabel' : 'Kick', 'kickActionLabel' : 'Kick',
'youHaveBeenKickedBy' : 'Du wurdest soeben aus dem Raum %s gekickt (%s)', 'youHaveBeenKickedBy' : 'Du wurdest soeben aus dem Raum %1$s gekickt (%2$s)',
'youHaveBeenKicked' : 'Du wurdest soeben aus dem Raum %s gekickt',
'banActionLabel' : 'Ban', 'banActionLabel' : 'Ban',
'youHaveBeenBannedBy' : 'Du wurdest soeben aus dem Raum %s verbannt (%s)', 'youHaveBeenBannedBy' : 'Du wurdest soeben aus dem Raum %1$s verbannt (%2$s)',
'youHaveBeenBanned' : 'Du wurdest soeben aus dem Raum %s verbannt',


'privateActionLabel' : 'Privater Chat', 'privateActionLabel' : 'Privater Chat',
'ignoreActionLabel' : 'Ignorieren', 'ignoreActionLabel' : 'Ignorieren',
Expand Down Expand Up @@ -4494,9 +4504,11 @@ Candy.View.Translation = {
'subject' : 'Titre:', 'subject' : 'Titre:',
'reasonWas' : 'Justification: %s.', 'reasonWas' : 'Justification: %s.',
'kickActionLabel' : 'Kick', 'kickActionLabel' : 'Kick',
'youHaveBeenKickedBy' : 'Tu as été expulsé (%s)', 'youHaveBeenKickedBy' : 'Tu as été expulsé de le salon %1$s (%2$s)',
'youHaveBeenKicked' : 'Tu as été expulsé de le salon %s',
'banActionLabel' : 'Ban', 'banActionLabel' : 'Ban',
'youHaveBeenBannedBy' : 'Tu as été banni (%s)', 'youHaveBeenBannedBy' : 'Tu as été banni de le salon %1$s (%2$s)',
'youHaveBeenBanned' : 'Tu as été banni de le salon %s',


'privateActionLabel' : 'Chat privé', 'privateActionLabel' : 'Chat privé',
'ignoreActionLabel' : 'Ignorer', 'ignoreActionLabel' : 'Ignorer',
Expand Down Expand Up @@ -4526,6 +4538,15 @@ Candy.View.Translation = {
'tooltipAdministration' : 'Administrer le salon', 'tooltipAdministration' : 'Administrer le salon',
'tooltipUsercount' : 'Nombre d\'utilisateurs dans le salon', 'tooltipUsercount' : 'Nombre d\'utilisateurs dans le salon',


'enterRoomPassword' : 'Le salon "%s" est protégé par un mot de passe.',
'enterRoomPasswordSubmit' : 'Entrer dans le salon',
'passwordEnteredInvalid' : 'Le mot de passe four le salon "%s" est invalide.',

'nicknameConflict': 'Le nom d\'utilisateur est déjà utilisé. Choisi un autre.',

'errorMembersOnly': 'Tu ne peut pas entrer de le salon "%s": droits insuffisants.',
'errorMaxOccupantsReached': 'Tu ne peut pas entrer de le salon "%s": Limite d\'utilisateur atteint.',

'antiSpamMessage' : 'S\'il te plaît, pas de spam. Tu as été bloqué pendant une courte période..' 'antiSpamMessage' : 'S\'il te plaît, pas de spam. Tu as été bloqué pendant une courte période..'
}, },


Expand All @@ -4549,9 +4570,11 @@ Candy.View.Translation = {
'subject' : 'Onderwerp:', 'subject' : 'Onderwerp:',
'reasonWas' : 'De reden was: %s.', 'reasonWas' : 'De reden was: %s.',
'kickActionLabel' : 'Verwijderen', 'kickActionLabel' : 'Verwijderen',
'youHaveBeenKickedBy' : 'Je bent verwijderd van %s door %s', 'youHaveBeenKickedBy' : 'Je bent verwijderd van %1$s door %2$s',
'youHaveBeenKicked' : 'Je bent verwijderd van %s',
'banActionLabel' : 'Blokkeren', 'banActionLabel' : 'Blokkeren',
'youHaveBeenBannedBy' : 'Je bent geblokkeerd van %s door %s', 'youHaveBeenBannedBy' : 'Je bent geblokkeerd van %1$s door %2$s',
'youHaveBeenBanned' : 'Je bent geblokkeerd van %s',


'privateActionLabel' : 'Prive gesprek', 'privateActionLabel' : 'Prive gesprek',
'ignoreActionLabel' : 'Negeren', 'ignoreActionLabel' : 'Negeren',
Expand Down Expand Up @@ -4613,9 +4636,11 @@ Candy.View.Translation = {
'subject' : 'Asunto:', 'subject' : 'Asunto:',
'reasonWas' : 'La razón fue: %s.', 'reasonWas' : 'La razón fue: %s.',
'kickActionLabel' : 'Expulsar', 'kickActionLabel' : 'Expulsar',
'youHaveBeenKickedBy' : 'Has sido expulsado de %s por %s', 'youHaveBeenKickedBy' : 'Has sido expulsado de %1$s por %2$s',
'youHaveBeenKicked' : 'Has sido expulsado de %s',
'banActionLabel' : 'Prohibir', 'banActionLabel' : 'Prohibir',
'youHaveBeenBannedBy' : 'Has sido expulsado permanentemente de %s por %s', 'youHaveBeenBannedBy' : 'Has sido expulsado permanentemente de %1$s por %2$s',
'youHaveBeenBanned' : 'Has sido expulsado permanentemente de %s',


'privateActionLabel' : 'Chat privado', 'privateActionLabel' : 'Chat privado',
'ignoreActionLabel' : 'Ignorar', 'ignoreActionLabel' : 'Ignorar',
Expand Down Expand Up @@ -4677,9 +4702,9 @@ Candy.View.Translation = {
'subject': '主题:', 'subject': '主题:',
'reasonWas': '原因是: %s.', 'reasonWas': '原因是: %s.',
'kickActionLabel': '踢除', 'kickActionLabel': '踢除',
'youHaveBeenKickedBy': '你在 %s 被管理者 %s 请出房间', 'youHaveBeenKickedBy': '你在 %1$s 被管理者 %2$s 请出房间',
'banActionLabel': '禁言', 'banActionLabel': '禁言',
'youHaveBeenBannedBy': '你在 %s 被管理者 %s 禁言', 'youHaveBeenBannedBy': '你在 %1$s 被管理者 %2$s 禁言',


'privateActionLabel': '单独对话', 'privateActionLabel': '单独对话',
'ignoreActionLabel': '忽略', 'ignoreActionLabel': '忽略',
Expand Down Expand Up @@ -4718,6 +4743,70 @@ Candy.View.Translation = {
'errorMembersOnly': '您的权限不够,不能登录房间 "%s" ', 'errorMembersOnly': '您的权限不够,不能登录房间 "%s" ',
'errorMaxOccupantsReached': '房间 "%s" 的人数已达上限,您不能登录', 'errorMaxOccupantsReached': '房间 "%s" 的人数已达上限,您不能登录',


'raptorMessageBlocked': '因为您在短时间内发送过多的消息 服务器要阻止您一小段时间。' 'antiSpamMessage': '因为您在短时间内发送过多的消息 服务器要阻止您一小段时间。'
},

'ja' : {
'status' : 'ステータス: %s',
'statusConnecting' : '接続中…',
'statusConnected' : '接続されました',
'statusDisconnecting' : 'ディスコネクト中…',
'statusDisconnected' : 'ディスコネクトされました',
'statusAuthfail' : '認証に失敗しました',

'roomSubject' : 'トピック:',
'messageSubmit' : '送信',

'labelUsername' : 'ユーザーネーム:',
'labelPassword' : 'パスワード:',
'loginSubmit' : 'ログイン',
'loginInvalid' : 'ユーザーネームが正しくありません',

'reason' : '理由:',
'subject' : 'トピック:',
'reasonWas' : '理由: %s。',
'kickActionLabel' : 'キック',
'youHaveBeenKickedBy' : 'あなたは%2$sにより%1$sからキックされました。',
'banActionLabel' : 'アカウントバン',
'youHaveBeenBannedBy' : 'あなたは%2$sにより%1$sからアカウントバンされました。',

'privateActionLabel' : 'プライベートメッセージ',
'ignoreActionLabel' : '無視する',
'unignoreActionLabel' : '無視をやめる',

'setSubjectActionLabel' : 'トピックを変える',

'administratorMessageSubject' : '管理者',

'userJoinedRoom' : '%sは入室しました。',
'userLeftRoom' : '%sは退室しました。',
'userHasBeenKickedFromRoom' : '%sは部屋からキックされました。',
'userHasBeenBannedFromRoom' : '%sは部屋からアカウントバンされました。',

'presenceUnknownWarningSubject' : '忠告:',
'presenceUnknownWarning' : 'このユーザーのステータスは不明です。',

'dateFormat' : 'dd.mm.yyyy',
'timeFormat' : 'HH:MM:ss',

'tooltipRole' : 'モデレーター',
'tooltipIgnored' : 'このユーザーを無視設定にしている',
'tooltipEmoticons' : '絵文字',
'tooltipSound' : '新しいメッセージが届くたびに音を鳴らす',
'tooltipAutoscroll' : 'オートスクロール',
'tooltipStatusmessage' : 'ステータスメッセージを表示',
'tooltipAdministration' : '部屋の管理',
'tooltipUsercount' : 'この部屋の参加者の数',

'enterRoomPassword' : '"%s"の部屋に入るにはパスワードが必要です。',
'enterRoomPasswordSubmit' : '部屋に入る',
'passwordEnteredInvalid' : '"%s"のパスワードと異なるパスワードを入力しました。',

'nicknameConflict' : 'このユーザーネームはすでに利用されているため、別のユーザーネームを選んでください。',

'errorMembersOnly' : '"%s"の部屋に入ることができません: 利用権限を満たしていません。',
'errorMaxOccupantsReached' : '"%s"の部屋に入ることができません: 参加者の数はすでに上限に達しました。',

'antiSpamMessage' : 'スパムなどの行為はやめてください。あなたは一時的にブロックされました。'
} }
}; };
2 changes: 1 addition & 1 deletion candy.min.js

Large diffs are not rendered by default.

39 changes: 31 additions & 8 deletions libs/libs.bundle.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4248,7 +4248,7 @@ var Mustache = function() {
* Licensed under the MIT license: * Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php * http://www.opensource.org/licenses/mit-license.php
* *
* Version: 0.9.1 (201012171436) * Version: 0.9.2 (201111281039)
*/ */
(function($) { (function($) {
/** /**
Expand Down Expand Up @@ -4355,21 +4355,44 @@ $.i18n = {
printf: function(S, L) { printf: function(S, L) {
if (!L) return S; if (!L) return S;


var nS = ""; var nS = "",
search = /%(\d+)\$s/g;
// replace %n1$ where n is a number
while (result = search.exec(S)) {
var index = parseInt(result[1], 10) -1;
S = S.replace('%' + result[1] + '\$s', (L[index]));
L.splice(index, 1);
}
var tS = S.split("%s"); var tS = S.split("%s");

if (tS.length > 1) {
for(var i=0; i<L.length; i++) { for(var i = 0; i < L.length; i++) {
if (tS[i].lastIndexOf('%') == tS[i].length-1 && i != L.length-1) if (tS[i].lastIndexOf('%') == tS[i].length-1 && i != L.length-1)
tS[i] += "s"+tS.splice(i+1,1)[0]; tS[i] += "s"+tS.splice(i+1,1)[0];
nS += tS[i] + L[i]; nS += tS[i] + L[i];
}
} }
return nS + tS[tS.length-1]; return nS + tS[tS.length-1];
} }


}; };


/*
* _t
* Allows you to translate a jQuery selector
*
* eg $('h1')._t('some text')
*
* @param string str : The string to translate
* @param property_list params : params for using printf() on the string
* @return element : chained and translated element(s)
*/
$.fn._t = function(str, params) {
return $(this).text($.i18n._(str, params));
};



})(jQuery);/* })(jQuery);
/*
* Date Format 1.2.3 * Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com> * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license * MIT license
Expand Down
2 changes: 1 addition & 1 deletion libs/libs.min.js

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions src/view/observer.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -94,14 +94,20 @@ Candy.View.Observer = (function(self, $) {
self.Presence.notifyPrivateChats(user, args.type); self.Presence.notifyPrivateChats(user, args.type);
// Client has been kicked or banned // Client has been kicked or banned
} else if (args.type === 'kick' || args.type === 'ban') { } else if (args.type === 'kick' || args.type === 'ban') {
var actorName = args.actor ? Strophe.getNodeFromJid(args.actor) : args.roomName, var actorName = args.actor ? Strophe.getNodeFromJid(args.actor) : null,
actionLabel; actionLabel,
translationParams = [args.roomName];

if (actorName) {
translationParams.push(actorName);
}

switch(args.type) { switch(args.type) {
case 'kick': case 'kick':
actionLabel = $.i18n._('youHaveBeenKickedBy', [args.roomName, actorName]); actionLabel = $.i18n._((actorName ? 'youHaveBeenKickedBy' : 'youHaveBeenKicked'), translationParams);
break; break;
case 'ban': case 'ban':
actionLabel = $.i18n._('youHaveBeenBannedBy', [args.roomName, actorName]); actionLabel = $.i18n._((actorName ? 'youHaveBeenBannedBy' : 'youHaveBeenBanned'), translationParams);
break; break;
} }
Candy.View.Pane.Chat.Modal.show(Mustache.to_html(Candy.View.Template.Chat.Context.adminMessageReason, { Candy.View.Pane.Chat.Modal.show(Mustache.to_html(Candy.View.Template.Chat.Context.adminMessageReason, {
Expand Down
Loading

0 comments on commit 4aff6dd

Please sign in to comment.