Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Change source code to use translated versions of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
brianking committed Apr 20, 2012
1 parent 2873447 commit 4cabdf8
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions components/facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,12 +721,12 @@ facebookService.prototype = {
var result; var msg;
debug('users.setStatus:', params, data);
if (data) {
msg = is_clear ? 'Your status was cleared successfully.'
: 'Your status was set successfully.';
msg = is_clear ? this.stringBundle.GetStringFromName("statuscleared")
: this.stringBundle.GetStringFromName("statussuccess");
result = is_clear ? 'clear' : 'set';
} else {
result = 'fail';
msg = 'Your status could not be set.';
msg = this.stringBundle.GetStringFromName("statusfail");
}
fbSvc.notify(null, 'facebook-status-set-result', result);
fbSvc._showPopup('you.status', fbSvc._loggedInUser.pic_sq, msg,
Expand Down Expand Up @@ -765,21 +765,22 @@ facebookService.prototype = {
fbSvc._messages = new CountedNotif( data.messages,'facebook-msgs-updated', fbSvc
, function( msgCount ) {
vdebug( "msgCount", msgCount );
var text = 'You have ' + ( msgCount==1 ? 'a new message' : 'new messages.' );
var text = msgCount==1 ? this.stringBundle.GetStringFromName("message")
: this.stringBundle.GetStringFromName("messages");
fbSvc.showPopup('you.msg', 'chrome://facebook/skin/images/mail_request.gif',
text, 'http://www.facebook.com/inbox/');
} );
fbSvc._pokes = new CountedNotif( data.pokes, 'facebook-pokes-updated', fbSvc
, function( pokeCount ) {
vdebug( "pokeCount", pokeCount );
if( pokeCount > 0 ) {
var text = 'You have been ';
var text = '';
if( 1 == pokeCount )
text += 'poked.';
text = this.stringBundle.GetStringFromName("poked");
else if( 4 >= pokeCount )
text += 'poked ' + pokeCount + ' times.';
text = this.stringBundle.GetStringFromName("pokedfew");
else
text += 'poked many times.';
text = this.stringBundle.GetStringFromName("pokedmany");

fbSvc.showPopup('you.poke', 'chrome://facebook/skin/images/poke.gif',
text, 'http://www.facebook.com/home.php');
Expand All @@ -794,7 +795,7 @@ facebookService.prototype = {
for each (var user in users) {
self.items[user.id] = user;
fbSvc.notify(user, 'facebook-new-req', user.id);
fbSvc.showPopup('you.req', user.pic_sq, user.name + ' wants to be your friend',
fbSvc.showPopup('you.req', user.pic_sq, this.stringBundle.formatStringFromName("friendrequest", [user.name]),
'http://www.facebook.com/reqs.php');
}
});
Expand Down Expand Up @@ -933,13 +934,13 @@ facebookService.prototype = {
if( pvs_album ) { // album already existed
if( size > pvs_album.size ) {
fbSvc.showPopup( 'friend.album', 'chrome://facebook/skin/images/photo.gif',
album_owner.name + ' added new photos to "' + name + '"',
this.stringBundle.formatStringFromName("albumnewphotos", [album_owner.name, name]),
link + "&src=fftb" );
}
}
else {
fbSvc.showPopup( 'friend.album', 'chrome://facebook/skin/images/photo.gif',
album_owner.name + ' created the album "' + album.name + '"',
this.stringBundle.formatStringFromName("albumcreate", [album_owner.name, album.name]),
link + "&src=fftb" );
}
fbSvc._albumDict[aid] = { 'modified': modified,
Expand Down Expand Up @@ -990,8 +991,10 @@ facebookService.prototype = {
if (!onInit) {
if (!fbSvc._friendDict[friend.id]) {
fbSvc.notify(friend, 'facebook-new-friend', friend['id']);
fbSvc.showPopup('you.friend', friend.pic_sq, friend.name + ' is now your friend',
'http://www.facebook.com/profile.php?id=' + friend.id + '&src=fftb');
fbSvc.showPopup('you.friend',
friend.pic_sq,
this.stringBundle.formatStringFromName("friendaccepted", [friend.name]),
'http://www.facebook.com/profile.php?id=' + friend.id + '&src=fftb');
fbSvc._friendCount++; // increment the count
friendUpdate = true;
} else {
Expand Down Expand Up @@ -1021,21 +1024,27 @@ facebookService.prototype = {
}
if (fbSvc._friendDict[friend.id].wall < friend.wall) {
fbSvc.notify(friend, 'facebook-friend-updated', 'wall');
notifyProf = notifyProf && !fbSvc.showPopup('friend.wall', friend.pic_sq, 'Someone wrote on ' + friend.name + "'s wall",
'http://www.facebook.com/profile.php?id=' + friend.id + '&src=fftb#wall');
notifyProf = notifyProf && !fbSvc.showPopup('friend.wall',
friend.pic_sq,
this.stringBundle.formatStringFromName("wallpost", [friend.name]),
'http://www.facebook.com/profile.php?id=' + friend.id + '&src=fftb#wall');
vdebug('wall count updated', fbSvc._friendDict[friend.id].wall, friend.wall);
}
if (fbSvc._friendDict[friend.id].notes < friend.notes) {
fbSvc.notify(friend, 'facebook-friend-updated', 'notes');
notifyProf = notifyProf && !fbSvc.showPopup('friend.note', friend.pic_sq, friend.name + ' wrote a note.',
'http://www.facebook.com/notes.php?id=' + friend.id + '&src=fftb');
notifyProf = notifyProf && !fbSvc.showPopup('friend.note',
friend.pic_sq,
this.stringBundle.formatStringFromName("newnote", [friend.name]),
'http://www.facebook.com/notes.php?id=' + friend.id + '&src=fftb');
vdebug('note count updated', fbSvc._friendDict[friend.id].notes, friend.notes);
}
if (fbSvc._friendDict[friend.id].ptime != friend.ptime && 0 != friend.ptime ) {
fbSvc.notify(friend, 'facebook-friend-updated', 'profile');
if (notifyProf) {
fbSvc.showPopup('friend.profile', friend.pic_sq, friend.name + ' updated his/her profile',
'http://www.facebook.com/profile.php?id=' + friend.id + '&src=fftb&highlight');
fbSvc.showPopup('friend.profile',
friend.pic_sq,
this.stringBundle.formatStringFromName("profilechange", [friend.name]),
'http://www.facebook.com/profile.php?id=' + friend.id + '&src=fftb&highlight');
}
friendUpdate = true;
}
Expand Down

0 comments on commit 4cabdf8

Please sign in to comment.