Browse Source

Merged i18n branch - finally burying #29

master
toyg 11 years ago
parent
commit
561b882101
  1. 10
      README.md
  2. 2
      css/style.css
  3. 15
      following.html
  4. 25
      home.html
  5. 44
      interface_common.js
  6. 2
      interface_home.js
  7. 1091
      interface_localization.js
  8. 2
      interface_login.js
  9. 2
      login.html
  10. 2
      network.html
  11. 17
      polyglot.min.js
  12. 4
      profile-edit.html
  13. 8
      tmobile.js
  14. 10
      twister_actions.js
  15. 6
      twister_directmsg.js
  16. 8
      twister_following.js
  17. 2
      twister_formatpost.js
  18. 6
      twister_io.js
  19. 17
      twister_network.js
  20. 18
      twister_user.js

10
README.md

@ -9,7 +9,7 @@ To use it, clone this repo under ~/.twister/html like this: @@ -9,7 +9,7 @@ To use it, clone this repo under ~/.twister/html like this:
Localisation
------------
If you want a localised interface (currently available only for NL, IT, FR and soon RU),
If you want a localised interface (currently available only for NL, IT, FR, DE and RU),
use the experimental `i18n` branch:
git checkout i18n
@ -57,7 +57,7 @@ If you want to add your own translation, edit `interface_localization.js` like t @@ -57,7 +57,7 @@ If you want to add your own translation, edit `interface_localization.js` like t
it should match what the browser reports. The Klingon ISO is "tlh", so:
var knownLanguages = ["en","nl","it","fr","tlh"];`
var knownLanguages = ["en","nl","it","fr","ru","tlh"];`
For multi-region languages, if you want to catch them all, use only the first half
(e.g. to match it and it-ch, specify "it").
@ -73,8 +73,12 @@ For multi-region languages, if you want to catch them all, use only the first ha @@ -73,8 +73,12 @@ For multi-region languages, if you want to catch them all, use only the first ha
}
}
4. stage all changes in file `interface_localization.js`
4. commit & push
git add interface_localization.js
5. commit & push
git commit -m "Klingon translation"

2
css/style.css

@ -443,7 +443,7 @@ button.disabled:hover @@ -443,7 +443,7 @@ button.disabled:hover
{
color: #b43e34;
}
.profile-data li a span
.profile-data li a span.posts-count, .profile-data li a span.following-count, .profile-data li a span.followers-count
{
font-weight: bold;
display: block;

15
following.html

@ -12,6 +12,8 @@ @@ -12,6 +12,8 @@
<script src="jquery.storageapi.js"></script>
<script src="mobile_abstract.js"></script>
<script src="twister_io.js"></script>
<script src="polyglot.min.js"></script>
<script src="interface_localization.js"></script>
<script src="twister_network.js"></script>
<script src="twister_user.js"></script>
<script src="twister_formatpost.js"></script>
@ -166,7 +168,8 @@ @@ -166,7 +168,8 @@
<a href="#" class="twister-user-name open-profile-modal">
<span class="twister-user-tag"></span>
</a>
<div class="followers">Followed by
<div class="followers">
<span class="label">Followed by</span>
<span class="followed-by"></span>
</div>
<a class="twister-user-remove">&times;</a>
@ -347,9 +350,9 @@ @@ -347,9 +350,9 @@
</div>
</div>
<ul class="module profile-data">
<li><a href="#"><span class="posts-count">&nbsp;</span>Posts</a></li>
<li><a href="#" class="open-following-modal"><span class="following-count">&nbsp;</span>Following</a></li>
<li><a href="#"><span class="followers-count">&nbsp;</span>Followers</a></li>
<li><a href="#"><span class="posts-count">&nbsp;</span><span class="label">Posts</span></a></li>
<li><a href="#" class="open-following-modal"><span class="following-count">&nbsp;</span><span class="label">Following</span></a></li>
<li><a href="#"><span class="followers-count">&nbsp;</span><span class="label">Followers</span></a></li>
</ul>
<button class="follow" href="#">Follow</button>
<button class="direct-messages-with-user" href="#">Direct Messages</button>
@ -362,7 +365,7 @@ @@ -362,7 +365,7 @@
<h2>
Posts
<!-- o botão de novas postagens deve ser ocultado quando o usuário clicá-lo via javascript -->
<button class="postboard-news" style="display:none;">5 novos posts</button>
<button class="postboard-news" style="display:none;"></button>
</h2>
<ol id="profile-posts" class="postboard-posts">
@ -382,7 +385,7 @@ @@ -382,7 +385,7 @@
<h2>
Posts
<!-- o botão de novas postagens deve ser ocultado quando o usuário clicá-lo via javascript -->
<button class="postboard-news" style="display:none;">5 novos posts</button>
<button class="postboard-news" style="display:none;"></button>
</h2>
<ol id="profile-posts" class="postboard-posts">

25
home.html

@ -12,6 +12,8 @@ @@ -12,6 +12,8 @@
<script src="jquery.storageapi.js"></script>
<script src="mobile_abstract.js"></script>
<script src="twister_io.js"></script>
<script src="polyglot.min.js"></script>
<script src="interface_localization.js"></script>
<script src="twister_network.js"></script>
<script src="twister_user.js"></script>
<script src="twister_formatpost.js"></script>
@ -106,9 +108,9 @@ @@ -106,9 +108,9 @@
<span class="mini-profile-view">View</span>
</div>
<ul class="module profile-data">
<li><a href="#" class="open-profile-modal"><span class="posts-count">&nbsp;</span>Posts</a></li>
<li><a href="following.html"><span class="following-count">&nbsp;</span>Following</a></li>
<li><a href="#"><span class="followers-count">&nbsp;</span>Followers *</a></li>
<li><a href="#" class="open-profile-modal"><span class="posts-count">&nbsp;</span><span class="label">Posts</span></a></li>
<li><a href="following.html"><span class="following-count">&nbsp;</span><span class="label">Following</span></a></li>
<li><a href="#"><span class="followers-count">&nbsp;</span><span class="label">Followers</span> *</a></li>
</ul>
<div class="post-area">
@ -143,7 +145,7 @@ @@ -143,7 +145,7 @@
<h2>
Postboard
<!-- o botão de novas postagens deve ser ocultado quando o usuário clicá-lo via javascript -->
<button class="postboard-news" style="display: none;">5 novos posts</button>
<button class="postboard-news" style="display: none;"></button>
</h2>
<ol id="posts" class="postboard-posts">
@ -173,7 +175,8 @@ @@ -173,7 +175,8 @@
<a href="#" class="twister-user-name open-profile-modal">
<span class="twister-user-tag"></span>
</a>
<div class="followers">Followed by
<div class="followers">
<span class="label">Followed by</span>
<a href="#" class="twister-by-user-name open-profile-modal">
<span class="followed-by"></span>
</a>
@ -356,9 +359,9 @@ @@ -356,9 +359,9 @@
</div>
</div>
<ul class="module profile-data">
<li><a href="#"><span class="posts-count">&nbsp;</span>Posts</a></li>
<li><a href="#" class="open-following-modal"><span class="following-count">&nbsp;</span>Following</a></li>
<li><a href="#"><span class="followers-count">&nbsp;</span>Followers</a></li>
<li><a href="#"><span class="posts-count">&nbsp;</span><span class="label">Posts</span></a></li>
<li><a href="#" class="open-following-modal"><span class="following-count">&nbsp;</span><span class="label">Following</span></a></li>
<li><a href="#"><span class="followers-count">&nbsp;</span><span class="label">Followers</span></a></li>
</ul>
<button class="follow" href="#">Follow</button>
<button class="direct-messages-with-user" href="#">Direct Messages</button>
@ -371,7 +374,7 @@ @@ -371,7 +374,7 @@
<h2>
Posts
<!-- o botão de novas postagens deve ser ocultado quando o usuário clicá-lo via javascript -->
<button class="postboard-news" style="display:none;">5 novos posts</button>
<button class="postboard-news" style="display:none;"></button>
</h2>
<ol id="profile-posts" class="postboard-posts">
@ -391,7 +394,7 @@ @@ -391,7 +394,7 @@
<h2>
Posts
<!-- o botão de novas postagens deve ser ocultado quando o usuário clicá-lo via javascript -->
<button class="postboard-news" style="display:none;">5 novos posts</button>
<button class="postboard-news" style="display:none;"></button>
</h2>
<ol id="profile-posts" class="postboard-posts">
@ -405,7 +408,7 @@ @@ -405,7 +408,7 @@
<!-- MODAL DE FOLLOWING -->
<div id="following-modal-template">
<!-- ÁREA DE PROFILE PHOTO INIT -->
<h2>All users publicly followed by <span class="following-screen-name">@<b></b></span></h2>
<h2><span class="label">All users publicly followed by</span><span class="following-screen-name">@<b></b></span></h2>
<!-- ÁREA DE PROFILE END -->
<!-- ÁREA DE FOLLOWING INIT -->

44
interface_common.js

@ -48,10 +48,7 @@ function checkNetworkStatusAndAskRedirect(cbFunc, cbArg) { @@ -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) { @@ -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", 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", 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", Math.floor(t_delta/60/60));
}
else {
expression = Math.floor(t_delta/24/60/60) + " days"
expression = polyglot.t("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) @@ -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) @@ -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 }) );
// obtain already cached mention posts from twister_newmsgs.js
processHashtag(hashtagModalContent.find(".postboard-posts"), defaultScreenName, getMentionsData() );
@ -224,7 +209,7 @@ function openFollowingModal(e) @@ -224,7 +209,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 }) );
}
//
@ -237,7 +222,7 @@ var reTwistPopup = function( e ) @@ -237,7 +222,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),"");
@ -254,7 +239,7 @@ var replyInitPopup = function(e, post) @@ -254,7 +239,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();
@ -309,7 +294,7 @@ var postExpandFunction = function( e, postLi ) @@ -309,7 +294,7 @@ var postExpandFunction = function( e, postLi )
originalPost.detach();
postLi.empty();
postLi.addClass( openClass );
$postInteractionText.text( "Collapse" );
$postInteractionText.text( polyglot.t("Collapse") );
var itemOl = $("<ol/>", {class:"expanded-post"}).appendTo(postLi);
var originalLi = $("<li/>", {class: "module post original"}).appendTo(itemOl);
@ -327,7 +312,7 @@ var postExpandFunction = function( e, postLi ) @@ -327,7 +312,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()
@ -430,6 +415,7 @@ var postSubmit = function(e) @@ -430,6 +415,7 @@ var postSubmit = function(e)
newPostMsg($replyText.val(), $postOrig);
$replyText.val("");
$replyText.attr("placeholder", polyglot.t("Your message was sent!"));
var tweetForm = $this.parents("form");
var remainingCount = tweetForm.find(".post-area-remaining");
remainingCount.text(140);

2
interface_home.js

@ -23,7 +23,7 @@ var InterfaceFunctions = function() @@ -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;
}

1091
interface_localization.js

File diff suppressed because it is too large Load Diff

2
interface_login.js

@ -13,7 +13,7 @@ function processCreateUser(username, secretKey) { @@ -13,7 +13,7 @@ function processCreateUser(username, secretKey) {
openModal( newUserClass );
//título do modal
$( "." + newUserClass + " h3" ).text( "Propagating nickname '"+ username + "' to the network..." );
$( "." + newUserClass + " h3" ).text( polyglot.t("propagating_nickname", { username: username }) );
var modalContent = $("." + newUserClass + " .modal-content");
var templateContent = $( "#new-user-modal-template" ).children().clone(true);

2
login.html

@ -15,6 +15,8 @@ @@ -15,6 +15,8 @@
<script src="twister_user.js"></script>
<script src="interface_common.js"></script>
<script src="interface_login.js"></script>
<script src="polyglot.min.js"></script>
<script src="interface_localization.js"></script>
<script>
$(document).ready(function()

2
network.html

@ -15,6 +15,8 @@ @@ -15,6 +15,8 @@
<script src="twister_formatpost.js"></script>
<script src="twister_following.js"></script>
<script src="twister_newmsgs.js"></script>
<script src="polyglot.min.js"></script>
<script src="interface_localization.js"></script>
<script src="twister_network.js"></script>
<script src="interface_common.js"></script>

17
polyglot.min.js vendored

@ -0,0 +1,17 @@ @@ -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);

4
profile-edit.html

@ -11,6 +11,8 @@ @@ -11,6 +11,8 @@
<script src="jquery.storageapi.js"></script>
<script src="mobile_abstract.js"></script>
<script src="twister_io.js"></script>
<script src="polyglot.min.js"></script>
<script src="interface_localization.js"></script>
<script src="twister_user.js"></script>
<script src="twister_network.js"></script>
<script src="twister_following.js"></script>
@ -90,7 +92,7 @@ @@ -90,7 +92,7 @@
</div>
<div style="font-size:80%;text-align: center;" class="secret-key-container">
Secret key: <span class="secret-key"></span>
<span class="label">Secret key:</span> <span class="secret-key"></span>
</div>
</div>

8
tmobile.js

@ -180,7 +180,7 @@ var router=new $.mobile.Router( @@ -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( @@ -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() { @@ -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) { @@ -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;
}

10
twister_actions.js

@ -130,9 +130,9 @@ function newPostMsg(msg, $postOrig) { @@ -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) { @@ -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) { @@ -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", _hashtagPendingPosts.length));
newTweetsBar.fadeIn("slow");
}
}

6
twister_directmsg.js

@ -59,7 +59,7 @@ function requestDmConversation(dmConvo,dm_screenname) { @@ -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) { @@ -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() @@ -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"));
}

8
twister_following.js

@ -473,9 +473,9 @@ function followingListPublicCheckbox(e) { @@ -473,9 +473,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;
}
@ -508,7 +508,7 @@ function processSwarmProgressFinal(lastHaves, numPieces) @@ -508,7 +508,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();
}
}
@ -536,7 +536,7 @@ function initInterfaceFollowing() { @@ -536,7 +536,7 @@ function initInterfaceFollowing() {
initUser( function() {
if( !defaultScreenName ) {
alert("Username undefined, login required.");
alert(polyglot.t("username_undefined"));
$.MAL.goLogin();
return;
}

2
twister_formatpost.js

@ -90,7 +90,7 @@ function postToElem( post, kind ) { @@ -90,7 +90,7 @@ function postToElem( post, kind ) {
replyTo += "@" + mentions[i] + " ";
}
}
elem.find(".post-area-new textarea").attr("placeholder","Reply to " + replyTo + "...");
elem.find(".post-area-new textarea").attr("placeholder", polyglot.t("reply_to", { fullname: replyTo })+ "...");
elem.find(".post-area-new textarea").attr("data-reply-to",replyTo);
postData.attr("data-reply-to",replyTo);

6
twister_io.js

@ -292,7 +292,7 @@ function clearAvatarAndProfileCache(username) { @@ -292,7 +292,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} );
@ -324,7 +324,7 @@ function checkPubkeyExists(username, cbFunc, cbArg) { @@ -324,7 +324,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});
}
@ -338,7 +338,7 @@ function dumpPubkey(username, cbFunc, cbArg) { @@ -338,7 +338,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});
}

17
twister_network.js

@ -33,7 +33,7 @@ function requestNetInfo(cbFunc, cbArg) { @@ -33,7 +33,7 @@ function requestNetInfo(cbFunc, cbArg) {
$(".version").text(twisterDisplayVersion);
if( !twisterdConnections ) {
$.MAL.setNetworkStatusMsg("Connection lost.", false);
$.MAL.setNetworkStatusMsg(polyglot.t("Connection lost."), false);
twisterdConnectedAndUptodate = false;
}
@ -72,7 +72,7 @@ function addPeerClick() { @@ -72,7 +72,7 @@ function addPeerClick() {
$(".new-peer-addr").val("")
}, {},
function(args, ret) {
alert("Error: " + ret.message);
alert(polyglot.t("error", { error: ret.message }));
}, {});
}
@ -83,7 +83,7 @@ function addDNSClick() { @@ -83,7 +83,7 @@ function addDNSClick() {
$(".new-dns-addr").val("")
}, {},
function(args, ret) {
alert("Error: " + ret.message);
alert(polyglot.t("error", { error: ret.message }));
}, {});
}
@ -118,22 +118,19 @@ function networkUpdate(cbFunc, cbArg) { @@ -118,22 +118,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;
}
}

18
twister_user.js

@ -67,7 +67,7 @@ function loadWalletlUsers(cbFunc, cbArg) { @@ -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() { @@ -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) { @@ -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) { @@ -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() { @@ -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 }));
}, {});
}

Loading…
Cancel
Save