-
All users publicly followed by @
+
All users publicly followed by@
diff --git a/index.html b/index.html
index d4543f6..77b2c77 100644
--- a/index.html
+++ b/index.html
@@ -22,7 +22,6 @@
});
-
diff --git a/interface_common.js b/interface_common.js
index fff49e2..cb2f286 100644
--- a/interface_common.js
+++ b/interface_common.js
@@ -48,10 +48,7 @@ function checkNetworkStatusAndAskRedirect(cbFunc, cbArg) {
networkUpdate(function(args) {
if( !twisterdConnectedAndUptodate ) {
var redirect =
- window.confirm("Local daemon is not connected to the network or\n" +
- "block chain is outdated. If you stay in this page\n" +
- "your actions may not work.\n" +
- "Do you want to check Network Status page instead?");
+ window.confirm(polyglot.t("switch_to_network"));
if( redirect )
$.MAL.goNetwork();
} else {
@@ -73,31 +70,19 @@ function timeSincePost(t) {
var now = new Date();
var t_delta = Math.ceil((now - d) / 1000);
var expression = "";
- if(t_delta < 2) {
- expression = "1 second"
- }
- else if(t_delta < 60) {
- expression = t_delta + " seconds"
- }
- else if(t_delta < 120) {
- expression = "1 second"
+ if(t_delta < 60) {
+ expression = polyglot.t("seconds", { seconds: t_delta });
}
else if(t_delta < 60 * 60) {
- expression = Math.floor(t_delta/60) + " minutes"
- }
- else if(t_delta < 2 * 60 * 60) {
- expression = "1 hour"
+ expression = polyglot.t("minutes", { minutes: Math.floor(t_delta/60) });
}
else if(t_delta < 24 * 60 * 60) {
- expression = Math.floor(t_delta/60/60) + " hours"
- }
- else if(t_delta < 2 * 24 * 60 * 60) {
- expression = "1 day"
+ expression = polyglot.t("hours", { hours: Math.floor(t_delta/60/60) });
}
else {
- expression = Math.floor(t_delta/24/60/60) + " days"
+ expression = polyglot.t("days", { days: Math.floor(t_delta/24/60/60) });
}
- return expression + " ago";
+ return polyglot.t("time_ago", { time: expression });
}
//
@@ -127,7 +112,7 @@ function openProfileModal(e)
profileModalContent.appendTo("." +profileModalClass + " .modal-content");
//título do modal
- $( "."+profileModalClass + " h3" ).text( username + "'s Profile" );
+ $( "."+profileModalClass + " h3" ).text( polyglot.t("users_profile", { username: username }) );
}
function newHashtagModal(hashtag) {
@@ -194,7 +179,7 @@ function openMentionsModal(e)
hashtagModalContent.appendTo("." +hashtagModalClass + " .modal-content");
//título do modal
- $( "."+hashtagModalClass + " h3" ).text( "Mentions of @" + username );
+ $( "."+hashtagModalClass + " h3" ).text( polyglot.t("users_mentions", { username: username }) );
resetMentionsCount();
}
@@ -222,7 +207,7 @@ function openFollowingModal(e)
followingModalContent.appendTo("." +followingModalClass + " .modal-content");
//título do modal
- $( "."+followingModalClass + " h3" ).text( "Followed by " + username );
+ $( "."+followingModalClass + " h3" ).text( polyglot.t("followed_by", { username: username }) );
}
//
@@ -235,7 +220,7 @@ var reTwistPopup = function( e )
openModal( reTwistClass );
//título do modal
- $( ".reTwist h3" ).text( "Retransmit this post to your followers?" );
+ $( ".reTwist h3" ).text( polyglot.t("retransmit_this") );
var postdata = $(this).parents(".post-data").attr("data-userpost");
var postElem = postToElem($.evalJSON(postdata),"");
@@ -252,7 +237,7 @@ var replyInitPopup = function(e, post)
//título do modal
var fullname = post.find(".post-info-name").text();
- $( ".reply h3" ).text( "Reply to " + fullname);
+ $( ".reply h3" ).text( polyglot.t("reply_to", { fullname: fullname }) );
//para poder exibir a thread selecionada...
var replyModalContent = $(".reply .modal-content").hide();
@@ -307,7 +292,7 @@ var postExpandFunction = function( e, postLi )
originalPost.detach();
postLi.empty();
postLi.addClass( openClass );
- $postInteractionText.text( "Collapse" );
+ $postInteractionText.text( polyglot.t("Collapse") );
var itemOl = $("
", {class:"expanded-post"}).appendTo(postLi);
var originalLi = $("
", {class: "module post original"}).appendTo(itemOl);
@@ -325,7 +310,7 @@ var postExpandFunction = function( e, postLi )
else
{
postLi.removeClass( openClass );
- $postInteractionText.text( "Expand" );
+ $postInteractionText.text( polyglot.t("Expand") );
if( $postsRelated ) $postsRelated.slideUp( "fast" );
$postExpandedContent.slideUp( "fast", function()
@@ -426,7 +411,7 @@ var postSubmit = function(e)
newPostMsg($replyText.val(), $postOrig);
$replyText.val("");
- $replyText.attr("placeholder", "Your message was sent!");
+ $replyText.attr("placeholder", polyglot.t("Your message was sent!"));
closeModal($this);
}
@@ -467,4 +452,4 @@ function initInterfaceCommon() {
$( ".open-hashtag-modal").bind( "click", openHashtagModal );
$( ".open-following-modal").bind( "click", openFollowingModal );
$( ".userMenu-connections a").bind( "click", openMentionsModal );
-}
+}
\ No newline at end of file
diff --git a/interface_home.js b/interface_home.js
index 423c316..8019840 100644
--- a/interface_home.js
+++ b/interface_home.js
@@ -23,7 +23,7 @@ var InterfaceFunctions = function()
function initHome(cbFunc, cbArg) {
if( !defaultScreenName ) {
- alert("Username undefined, login required.");
+ alert(polyglot.t("username_undefined"));
$.MAL.goLogin();
return;
}
diff --git a/interface_localization.js b/interface_localization.js
new file mode 100644
index 0000000..d3fe7ec
--- /dev/null
+++ b/interface_localization.js
@@ -0,0 +1,226 @@
+// interface_localization.js
+//
+// uses JavaScript to detect browser language
+// uses Polyglot.js ( https://github.com/airbnb/polyglot.js ) to translate interface
+
+// translators: add your language code here such as "es" for Spanish, "ru" for Russian
+var knownLanguages = ["en"];
+
+// detect language with JavaScript
+var preferredLanguage = window.navigator.userLanguage || window.navigator.language || "en";
+if(knownLanguages.indexOf(preferredLanguage) > -1){
+ // en for en or similar
+ preferredLanguage = preferredLanguage;
+}
+else if(knownLanguages.indexOf(preferredLanguage.split("-")[0]) > -1){
+ // en for en-US or similar
+ preferredLanguage = preferredLanguage.split("-")[0];
+}
+else{
+ // did not find match
+ preferredLanguage = "en";
+}
+
+// set up Polyglot
+polyglot = new Polyglot();
+var wordset = {};
+
+if(preferredLanguage == "en"){
+ polyglot.locale("en");
+ wordset = {
+ "Actions ▼": "Actions ▼",
+ "Active DHT nodes:": "Active DHT nodes: ",
+ "Add DNS": "Add DNS",
+ "Add peer": "Add peer",
+ "ajax_error": "Ajax error: %{error}", // JavaScript error
+ "All users publicly followed by": "All users publicly followed by",
+ "Available": "Available", // username is available
+ "Block chain information": "Block chain information",
+ "Block chain is up-to-date, twister is ready to use!": "Block chain is up-to-date, twister is ready to use!",
+ "Block generation": "Block generation ",
+ "Cancel": "Cancel",
+ "Change user": "Change user",
+ "Checking...": "Checking...", // checking if username is available
+ "Collapse": "Collapse", // smaller view of a post
+ "Configure block generation": "Configure block generation",
+ "Connections:": "Connections: ", // to network
+ "Connection lost.": "Connection lost.",
+ "days": "%{days} day |||| %{days} days",
+ "Detailed information": "Detailed information",
+ "DHT network down.": "DHT network down.",
+ "Direct Messages": "Direct Messages",
+ "Disable": "Disable",
+ "Display mentions to @": "Display mentions to @",
+ "Display retransmissions": "Display retransmissions",
+ "DNS to obtain list of peers:": "DNS to obtain list of peers:",
+ "downloading_block_chain": "Downloading block chain, please wait before continuing (block chain is %{days} days old).",
+ "download_posts_status": "Downloaded %{portion} posts", // Downloaded 10/30 posts
+ "Enable": "Enable",
+ "error": "Error: %{error}",
+ "error_connecting_to_daemon": "Error connecting to local twister daemon.",
+ "Error in 'createwalletuser' RPC.": "Error in 'createwalletuser' RPC.",
+ "Error in 'importprivkey'": "Error in 'importprivkey' RPC: %{rpc}",
+ "Error in 'sendnewusertransaction' RPC.": "Error in 'sendnewusertransaction' RPC.",
+ "Expand": "Expand", // larger view of a post
+ "Favorite": "Favorite",
+ "File APIs not supported in this browser.": "File APIs not supported in this browser.",
+ "Follow": "Follow",
+ "Followed by": "Followed by",
+ "followed_by": "Followed by %{username}",
+ "Followers": "Followers",
+ "Following": "Following",
+ "Following users": "Following users",
+ "Force connection to peer:": "Force connection to peer:",
+ "General information": "General information",
+ "Generate blocks (send promoted messages)": "Generate blocks (send promoted messages)",
+ "Home": "Home", // homepage
+ "hours": "%{hours} hour |||| %{hours} hours",
+ "Internal error: lastPostId unknown (following yourself may fix!)": "Internal error: lastPostId unknown (following yourself may fix!)",
+ "Known peers:": "Known peers: ",
+ "Last block is ahead of your computer time, check your clock.": "Last block is ahead of your computer time, check your clock.",
+ "mentions_at": "Mentions @%{user}",
+ "minutes": "%{minutes} minute |||| %{minutes} minutes",
+ "Must be 16 characters or less.": "Must be 16 characters or less.", // username
+ "Network": "Network",
+ "Network config": "Network config",
+ "Network status": "Network status",
+ "New direct message...": "New direct message...",
+ "New Post...": "New Post...",
+ "new_posts": "%{count} new post |||| %{count} new posts",
+ "nobody": "nobody", // used to promote a post without attaching the user
+ "Not available": "Not available", // username is not available
+ "Number of blocks in block chain:": "Number of blocks in block chain: ",
+ "Number of CPUs to use": "Number of CPUs to use ",
+ "Only alphanumeric and underscore allowed.": "Only alphanumeric and underscore allowed.",
+ "peer address": "peer address",
+ "Private": "Private",
+ "Profile": "Profile",
+ "Postboard": "Postboard",
+ "post": "post", // verb - button to post a message
+ "Post to promote:": "Post to promote: ",
+ "Posts": "Posts",
+ "propagating_nickname": "Propagating nickname %{username} to the network...",
+ "Public": "Public",
+ "Refresh": "Refresh",
+ "retransmit_this": "Retransmit this post to your followers?",
+ "Reply": "Reply",
+ "Reply...": "Reply...",
+ "reply_to": "Reply to %{fullname}",
+ "Retransmit": "Retransmit",
+ "Retransmits": "Retransmits",
+ "Retransmitted by": "Retransmitted by",
+ "search": "search",
+ "seconds": "%{seconds} second |||| %{seconds} seconds",
+ "send": "send",
+ "Send post with username": "Send post with username ",
+ "Sent Direct Message": "Sent Direct Message",
+ "Sent Post to @": "Sent Post to @",
+ "Setup account": "Setup account",
+ "switch_to_network": "Local daemon is not connected to the network or\n" +
+ "block chain is outdated. If you stay in this page\n" +
+ "your actions may not work.\n" +
+ "Do you want to check Network Status page instead?",
+ "The File APIs are not fully supported in this browser.": "The File APIs are not fully supported in this browser.",
+ "time_ago": "%{time} ago", // 5 minutes ago
+ "Time of the last block:": "Time of the last block: ",
+ "Type message here": "Type message here",
+ "Unfollow": "Unfollow",
+ "Update": "Update",
+ "Updating status...": "Updating status...", // status of block chain
+ "user_not_yet_accepted": "Other peers have not yet accepted this new user.\n" +
+ "Unfortunately it is not possible to save profile\n" +
+ "or send any posts in this state.\n\n" +
+ "Please wait a few minutes to continue.\n\n" +
+ "The 'Save Changes' will be automatically enabled\n" +
+ "when the process completes. (I promise this is\n"+
+ "the last time you will have to wait before using\n" +
+ "twister).\n\n" +
+ "Tip: choose your avatar in the meantime!",
+ "users_mentions": "Mentions of @%{username}",
+ "users_profile": "%{username}'s Profile",
+ "username_undefined": "Username undefined, login required.",
+ "View": "View",
+ "View All": "View All",
+ "Who to Follow": "Who to Follow",
+ "Your message was sent!": "Your message was sent!"
+ };
+}
+
+// translators: sample adding a language
+if(preferredLanguage == "ru"){
+ // polyglot.locale() is used to support plurals
+ // locales currently known by Polyglot.js:
+ /*
+ chinese: ['id', 'ja', 'ko', 'ms', 'th', 'tr', 'zh'],
+ german: ['da', 'de', 'en', 'es', 'fi', 'el', 'he', 'hu', 'it', 'nl', 'no', 'pt', 'sv'],
+ french: ['fr', 'tl'],
+ russian: ['hr', 'ru'],
+ czech: ['cs'],
+ polish: ['pl'],
+ icelandic: ['is']
+ */
+
+ polyglot.locale("ru");
+
+ // list of the English words and translations
+ wordset = {
+ "Actions ▼": "Действия ▼" // , comma after each match except the last
+ };
+}
+
+// uncomment to see all translated words replaced with filler
+//for(var word in wordset){
+// wordset[word] = "AAAA";
+//}
+
+polyglot.extend(wordset);
+
+// Text from HTML and not JavaScript is selected and translated at $(document).ready
+// Add selectors here to translate the text and placeholders inside new UI
+var fixedLabels = [
+ // An easy way to include new items in translation is to add the "label" class
+ ".label",
+
+ // navbar and home
+ "button",
+ ".userMenu > ul > li > a",
+ ".postboard-news",
+ ".post-area-new textarea",
+ ".refresh-users, .view-all-users",
+ ".who-to-follow h3",
+ ".userMenu-search-field",
+ "a.dropdown-menu-item, a.direct-messages",
+ ".post-interactions span",
+ ".post-expand",
+ ".post-context span",
+ ".post-stats .stat-count span",
+ ".postboard h2",
+
+ // following page
+ ".following h2",
+ ".mini-profile-actions span, .mini-profile-actions li",
+
+ // network page
+ ".network h2, .network h3",
+ ".network ul li span",
+ ".network label",
+ ".network textarea, .network input, .network option",
+];
+$(document).ready(function(){
+ for(var i=0;i
+
+
@@ -72,17 +74,17 @@
-
Network status
+
Network status
-
General information
+
General information
-
Detailed information
+
Detailed information
-
@@ -108,7 +110,7 @@
-
Block chain information
+
Block chain information
-
@@ -124,25 +126,25 @@
Configure block generation
-
Generate blocks (send promoted messages)
+
Generate blocks (send promoted messages)
-
-
+
-
-
+
-
-
+
-
-
+
diff --git a/polyglot.min.js b/polyglot.min.js
new file mode 100644
index 0000000..66507fd
--- /dev/null
+++ b/polyglot.min.js
@@ -0,0 +1,17 @@
+// (c) 2012 Airbnb, Inc.
+//
+// polyglot.js may be freely distributed under the terms of the BSD
+// license. For all licensing information, details, and documention:
+// http://airbnb.github.com/polyglot.js
+//
+//
+// Polyglot.js is an I18n helper library written in JavaScript, made to
+// work both in the browser and in Node. It provides a simple solution for
+// interpolation and pluralization, based off of Airbnb's
+// experience adding I18n functionality to its Backbone.js and Node apps.
+//
+// Polylglot is agnostic to your translation backend. It doesn't perform any
+// translation; it simply gives you a way to manage translated phrases from
+// your client- or server-side JavaScript application.
+//
+!function(e){"use strict";function t(e){e=e||{},this.phrases=e.phrases||{},this.currentLocale=e.locale||"en",this.allowMissing=!!e.allowMissing}function s(e){var t,n,r,i={};for(t in e)if(e.hasOwnProperty(t)){n=e[t];for(r in n)i[n[r]]=t}return i}function o(e){var t=/^\s+|\s+$/g;return e.replace(t,"")}function u(e,t,r){var i,s,u;return r!=null&&e?(s=e.split(n),u=s[f(t,r)]||s[0],i=o(u)):i=e,i}function a(e){var t=s(i);return t[e]||t.en}function f(e,t){return r[a(e)](t)}function l(e,t){for(var n in t)n!=="_"&&t.hasOwnProperty(n)&&(e=e.replace(new RegExp("%\\{"+n+"\\}","g"),t[n]));return e}function c(t){e.console&&e.console.warn&&e.console.warn("WARNING: "+t)}function h(e){var t={};for(var n in e)t[n]=e[n];return t}t.VERSION="0.2.0",t.prototype.locale=function(e){return e&&(this.currentLocale=e),this.currentLocale},t.prototype.extend=function(e){for(var t in e)e.hasOwnProperty(t)&&(this.phrases[t]=e[t])},t.prototype.clear=function(){this.phrases={}},t.prototype.replace=function(e){this.clear(),this.extend(e)},t.prototype.t=function(e,t){var n;t=t==null?{}:t,typeof t=="number"&&(t={smart_count:t});var r=this.phrases[e]||t._||(this.allowMissing?e:"");return r===""?(c('Missing translation for key: "'+e+'"'),n=e):(t=h(t),n=u(r,this.currentLocale,t.smart_count),n=l(n,t)),n};var n="||||",r={chinese:function(e){return 0},german:function(e){return e!==1?1:0},french:function(e){return e>1?1:0},russian:function(e){return e%10===1&&e%100!==11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},czech:function(e){return e===1?0:e>=2&&e<=4?1:2},polish:function(e){return e===1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},icelandic:function(e){return e%10!==1||e%100===11?1:0}},i={chinese:["id","ja","ko","ms","th","tr","zh"],german:["da","de","en","es","fi","el","he","hu","it","nl","no","pt","sv"],french:["fr","tl"],russian:["hr","ru"],czech:["cs"],polish:["pl"],icelandic:["is"]};typeof module!="undefined"&&module.exports?module.exports=t:e.Polyglot=t}(this);
\ No newline at end of file
diff --git a/tmobile.js b/tmobile.js
index 61d6a49..2f41670 100644
--- a/tmobile.js
+++ b/tmobile.js
@@ -180,7 +180,7 @@ var router=new $.mobile.Router(
var params=router.getParams(match[1]);
initializeTwister( true, true, function() {
var $replyTextarea = $("#newmsg .post-area-new textarea");
- $replyTextarea.attr("placeholder", "New Post...");
+ $replyTextarea.attr("placeholder", polyglot.t("New Post..."));
if( params && params.hasOwnProperty("replyto") ) {
$replyTextarea.val(params.replyto);
} else {
@@ -227,7 +227,7 @@ var router=new $.mobile.Router(
$newmsgLink.attr("href","#newmsg");
resetMentionsCount();
}
- $("#mentions .rtitle").text("Mentions @" + user);
+ $("#mentions .rtitle").text(polyglot.t("mentions_at", { user: user }));
var $ulMentions = $("#mentions ul.posts");
setupHashtagOrMention( $ulMentions, user, "mention");
});
@@ -375,7 +375,7 @@ function installSubmitClick() {
newPostMsg(s, $postOrig);
$replyText.val("");
- $replyText.attr("placeholder", "Your message was sent!");
+ $replyText.attr("placeholder", polyglot.t("Your message was sent!"));
setTimeout( function() {$.MAL.goHome();}, 1000);
});
@@ -451,7 +451,7 @@ function handleAvatarFileSelectMobile(evt) {
try {
reader = new FileReader();
} catch(e) {
- alert('File APIs not supported in this browser.');
+ alert(polyglot.t('File APIs not supported in this browser.'));
return;
}
diff --git a/twister_actions.js b/twister_actions.js
index 106f19b..5886824 100644
--- a/twister_actions.js
+++ b/twister_actions.js
@@ -130,9 +130,9 @@ function newPostMsg(msg, $postOrig) {
twisterRpc("newpostmsg", params,
function(arg, ret) { incLastPostId(); }, null,
function(arg, ret) { var msg = ("message" in ret) ? ret.message : ret;
- alert("Ajax error: " + msg); }, null);
+ alert(polyglot.t("ajax_error", { error: msg })); }, null);
} else {
- alert("Internal error: lastPostId unknown (following yourself may fix!)");
+ alert(polyglot.t("Internal error: lastPostId unknown (following yourself may fix!)"));
}
}
@@ -150,9 +150,9 @@ function newRtMsg($postOrig) {
twisterRpc("newrtmsg", params,
function(arg, ret) { incLastPostId(); }, null,
function(arg, ret) { var msg = ("message" in ret) ? ret.message : ret;
- alert("Ajax error: " + msg); }, null);
+ alert(polyglot.t("ajax_error", { error: msg })); }, null);
} else {
- alert("Internal error: lastPostId unknown (following yourself may fix!)");
+ alert(polyglot.t("Internal error: lastPostId unknown (following yourself may fix!)"));
}
}
@@ -214,7 +214,7 @@ function processHashtag(postboard, hashtag, data) {
displayHashtagPending(postboard);
} else {
var newTweetsBar = postboard.closest("div").find(".postboard-news");
- newTweetsBar.text(String(_hashtagPendingPosts.length) + " new posts");
+ newTweetsBar.text(polyglot.t("new_posts", { count: _hashtagPendingPosts.length }));
newTweetsBar.fadeIn("slow");
}
}
diff --git a/twister_directmsg.js b/twister_directmsg.js
index 434eb02..e9e1bbb 100644
--- a/twister_directmsg.js
+++ b/twister_directmsg.js
@@ -59,7 +59,7 @@ function requestDmConversation(dmConvo,dm_screenname) {
function(args, ret) { processDmConversation(args.dmConvo, args.dmUser, ret); },
{dmConvo:dmConvo,dmUser:dm_screenname},
function(arg, ret) { var msg = ("message" in ret) ? ret.message : ret;
- alert("Ajax error: " + msg); }, null);
+ alert(polyglot.t("ajax_error", { error: msg })); }, null);
}
function processDmConversation(dmConvo, dm_screenname, dmData) {
@@ -103,7 +103,7 @@ function newDirectMsg(msg, dm_screenname) {
function(arg, ret) { var msg = ("message" in ret) ? ret.message : ret;
alert("Ajax error: " + msg); }, null);
} else {
- alert("Internal error: lastPostId unknown (following yourself may fix!)");
+ alert(polyglot.t("Internal error: lastPostId unknown (following yourself may fix!)"));
}
}
@@ -117,7 +117,7 @@ function directMessagesPopup()
$( directMessagesContent ).clone().appendTo( ".directMessages .modal-content" );
//título do modal
- $( ".directMessages h3" ).text( "Direct Messages" );
+ $( ".directMessages h3" ).text( polyglot.t("Direct Messages") );
requestDMsnippetList($(".directMessages").find(".direct-messages-list"));
}
diff --git a/twister_following.js b/twister_following.js
index 5e3c98c..774862d 100644
--- a/twister_following.js
+++ b/twister_following.js
@@ -472,9 +472,9 @@ function followingListPublicCheckbox(e) {
var public = false;
$this.toggleClass( "private" );
if( $this.hasClass( "private" ) ) {
- $this.text( "Private" );
+ $this.text( polyglot.t("Private") );
} else {
- $this.text( "Public" );
+ $this.text( polyglot.t("Public") );
public = true;
}
@@ -507,7 +507,7 @@ function processSwarmProgressFinal(lastHaves, numPieces)
var $userDiv = $(".mini-profile-info[data-screen-name='" + user + "']");
if( $userDiv.length ) {
var $status = $userDiv.find(".swarm-status");
- $status.text("Downloaded " + numPieces[user] + "/" + (lastHaves[user]+1) + " posts");
+ $status.text(polyglot.t("download_posts_status", { portion: numPieces[user] + "/" + (lastHaves[user]+1) }));
$status.fadeIn();
}
}
@@ -535,7 +535,7 @@ function initInterfaceFollowing() {
initUser( function() {
if( !defaultScreenName ) {
- alert("Username undefined, login required.");
+ alert(polyglot.t("username_undefined"));
$.MAL.goLogin();
return;
}
diff --git a/twister_io.js b/twister_io.js
index 09eb689..b579c28 100644
--- a/twister_io.js
+++ b/twister_io.js
@@ -290,7 +290,7 @@ function clearAvatarAndProfileCache(username) {
function getFollowers( username, item ) {
dhtget( username, "tracker", "m",
function(args, ret) {
- if( ret.length && ret[0]["followers"] ) {
+ if( ret && ret.length && ret[0]["followers"] ) {
args.item.text(ret[0]["followers"])
}
}, {username:username,item:item} );
@@ -322,7 +322,7 @@ function checkPubkeyExists(username, cbFunc, cbArg) {
args.cbFunc(args.cbArg, ret.length > 0);
}, {cbFunc:cbFunc, cbArg:cbArg},
function(args, ret) {
- alert("Error connecting to local twister deamon.");
+ alert(polyglot.t("error_connecting_to_daemon"));
}, {cbFunc:cbFunc, cbArg:cbArg});
}
@@ -336,7 +336,7 @@ function dumpPubkey(username, cbFunc, cbArg) {
args.cbFunc(args.cbArg, ret);
}, {cbFunc:cbFunc, cbArg:cbArg},
function(args, ret) {
- alert("Error connecting to local twister deamon.");
+ alert(polyglot.t("error_connecting_to_daemon"));
}, {cbFunc:cbFunc, cbArg:cbArg});
}
diff --git a/twister_network.js b/twister_network.js
index 5fb144e..0531add 100644
--- a/twister_network.js
+++ b/twister_network.js
@@ -27,7 +27,7 @@ function requestNetInfo(cbFunc, cbArg) {
$(".dht-nodes").text(twisterDhtNodes);
if( !twisterdConnections ) {
- $.MAL.setNetworkStatusMsg("Connection lost.", false);
+ $.MAL.setNetworkStatusMsg(polyglot.t("Connection lost."), false);
twisterdConnectedAndUptodate = false;
}
@@ -66,7 +66,7 @@ function addPeerClick() {
$(".new-peer-addr").val("")
}, {},
function(args, ret) {
- alert("Error: " + ret.message);
+ alert(polyglot.t("error", { error: ret.message }));
}, {});
}
@@ -77,7 +77,7 @@ function addDNSClick() {
$(".new-dns-addr").val("")
}, {},
function(args, ret) {
- alert("Error: " + ret.message);
+ alert(polyglot.t("error", { error: ret.message }));
}, {});
}
@@ -112,22 +112,19 @@ function networkUpdate(cbFunc, cbArg) {
var curTime = new Date().getTime() / 1000;
if( twisterdConnections ) {
if( twisterdLastBlockTime > curTime + 3600 ) {
- $.MAL.setNetworkStatusMsg("Last block is ahead of your computer time, check your clock.", false);
+ $.MAL.setNetworkStatusMsg(polyglot.t("Last block is ahead of your computer time, check your clock."), false);
twisterdConnectedAndUptodate = false;
} else if( twisterdLastBlockTime > curTime - (2 * 3600) ) {
if( twisterDhtNodes ) {
- $.MAL.setNetworkStatusMsg("Block chain is up-to-date, twister is ready to use!", true);
+ $.MAL.setNetworkStatusMsg(polyglot.t("Block chain is up-to-date, twister is ready to use!"), true);
twisterdConnectedAndUptodate = true;
} else {
- $.MAL.setNetworkStatusMsg("DHT network down.", false);
+ $.MAL.setNetworkStatusMsg(polyglot.t("DHT network down."), false);
twisterdConnectedAndUptodate = true;
}
} else {
var daysOld = (curTime - twisterdLastBlockTime) / (3600*24);
- $.MAL.setNetworkStatusMsg("Downloading block chain, please wait before continuing " +
- "(block chain is " +
- daysOld.toFixed(2) +
- " days old).", false);
+ $.MAL.setNetworkStatusMsg(polyglot.t("downloading_block_chain", { days: daysOld.toFixed(2) }), false);
twisterdConnectedAndUptodate = false;
}
}
diff --git a/twister_user.js b/twister_user.js
index 6716a24..3e8d33f 100644
--- a/twister_user.js
+++ b/twister_user.js
@@ -67,7 +67,7 @@ function loadWalletlUsers(cbFunc, cbArg) {
args.cbFunc(args.cbArg);
}, {cbFunc:cbFunc, cbArg:cbArg},
function(args, ret) {
- alert("Error connecting to local twister deamon.");
+ alert(polyglot.t("error_connecting_to_daemon"));
}, {});
}
@@ -103,25 +103,25 @@ function checkUsernameAvailability() {
if( !username.length )
return;
if( username.length > 16 ) {
- $availField.text("Must be 16 characters or less.");
+ $availField.text(polyglot.t("Must be 16 characters or less."));
return;
}
//Check for non-alphabetic characters and space
if(username.search(/[^a-z0-9_]/) != -1) {
- $availField.text("Only alphanumeric and underscore allowed.");
+ $availField.text(polyglot.t("Only alphanumeric and underscore allowed."));
return;
}
- $availField.text("Checking...");
+ $availField.text(polyglot.t("Checking..."));
dumpPubkey(username, function(dummy, pubkey) {
var notAvailable = pubkey.length > 0
var $availField = $(".availability");
if( notAvailable ) {
- $availField.text("Not available");
+ $availField.text(polyglot.t("Not available"));
} else {
- $availField.text("Available");
+ $availField.text(polyglot.t("Available"));
var $createButton = $(".create-user");
$.MAL.enableButton( $createButton );
@@ -147,7 +147,7 @@ function createUserClick(cbFunc) {
args.cbFunc(args.username, ret);
}, {username:username, cbFunc:cbFunc},
function(args, ret) {
- alert("Error in 'createwalletuser' RPC.");
+ alert(polyglot.t("Error in 'createwalletuser' RPC."));
}, {cbFunc:cbFunc});
} else {
// user exists in wallet but transaction not sent
@@ -164,7 +164,7 @@ function sendNewUserTransaction(username, cbFunc) {
args.cbFunc();
}, {cbFunc:cbFunc},
function(args, ret) {
- alert("Error in 'sendnewusertransaction' RPC.");
+ alert(polyglot.t("Error in 'sendnewusertransaction' RPC."));
}, {});
}
@@ -190,7 +190,7 @@ function importSecretKeyClick() {
processNewSecretKeyImported(args.username);
}, {username:username},
function(args, ret) {
- alert("Error in 'importprivkey' RPC: " + ret.message);
+ alert(polyglot.t("Error in 'importprivkey'", {rpc: ret.message }));
}, {});
}