Browse Source

Merged i18n branch

master
toyg 11 years ago
parent
commit
5f2fb3cbb0
  1. 2
      css/style.css
  2. 15
      following.html
  3. 25
      home.html
  4. 46
      interface_common.js
  5. 2
      interface_home.js
  6. 347
      interface_localization.js
  7. 2
      interface_login.js
  8. 14
      interface_profile-edit.js
  9. 2
      network.html
  10. 17
      polyglot.min.js
  11. 8
      tmobile.js
  12. 10
      twister_actions.js
  13. 6
      twister_directmsg.js
  14. 8
      twister_following.js
  15. 2
      twister_formatpost.js
  16. 6
      twister_io.js
  17. 17
      twister_network.js
  18. 18
      twister_user.js

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>
<span class="followed-by"></span>
</div>
<a class="twister-user-remove">&times;</a>
@ -354,9 +357,9 @@ @@ -354,9 +357,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>
@ -369,7 +372,7 @@ @@ -369,7 +372,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">
@ -389,7 +392,7 @@ @@ -389,7 +392,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">
@ -403,7 +406,7 @@ @@ -403,7 +406,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 -->

46
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 }) );
resetMentionsCount();
}
@ -222,7 +207,7 @@ function openFollowingModal(e) @@ -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 ) @@ -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) @@ -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 ) @@ -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 = $("<ol/>", {class:"expanded-post"}).appendTo(postLi);
var originalLi = $("<li/>", {class: "module post original"}).appendTo(itemOl);
@ -325,7 +310,7 @@ var postExpandFunction = function( e, postLi ) @@ -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()
@ -428,6 +413,7 @@ var postSubmit = function(e) @@ -428,6 +413,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);
@ -472,4 +458,4 @@ function initInterfaceCommon() { @@ -472,4 +458,4 @@ function initInterfaceCommon() {
$( ".open-hashtag-modal").bind( "click", openHashtagModal );
$( ".open-following-modal").bind( "click", openFollowingModal );
$( ".userMenu-connections a").bind( "click", openMentionsModal );
}
}

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;
}

347
interface_localization.js

@ -0,0 +1,347 @@ @@ -0,0 +1,347 @@
// 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","nl"];
// 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": "%{smart_count} day |||| %{smart_count} 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": "%{smart_count} hour |||| %{smart_count} 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": "%{smart_count} minute |||| %{smart_count} 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": "%{smart_count} new post |||| %{smart_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": "%{smart_count} second |||| %{smart_count} 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!"
};
}
if(preferredLanguage == "nl"){
polyglot.locale("nl");
wordset = {
"Actions ▼": "Acties ▼",
"Active DHT nodes:": "Actieve DHT nodes: ",
"Add DNS": "DNS toevoegen",
"Add peer": "Peer toevoegen",
"ajax_error": "Ajax error: %{error}", // JavaScript error
"All users publicly followed by": "Alle gebruikers openbaarlijk gevolgd door",
"Available": "Beschikbaar", // username is available
"Block chain information": "Block chain informatie",
"Block chain is up-to-date, twister is ready to use!": "Block chain is up-to-date, twister is klaar voor gebruik!",
"Block generation": "Block productie",
"Cancel": "Annuleren",
"Change user": "Gebruiker wijzigen",
"Checking...": "Controleren...", // checking if username is available
"Collapse": "Uitklappen", // smaller view of a post
"Configure block generation": "Block productie configureren",
"Connections:": "Connecties: ", // to network
"Connection lost.": "Verbinding kwijt.",
"days": "%{smart_count} dag |||| %{smart_count} dagen",
"Detailed information": "Gedetailleerde informatie",
"DHT network down.": "DHT netwerk down.",
"Direct Messages": "Privéberichten",
"Disable": "Uitschakelen",
"Display mentions to @": "Toon vermeldingen voor @",
"Display retransmissions": "Toon retransmissions",
"DNS to obtain list of peers:": "DNS om peers lijst op te halen:",
"downloading_block_chain": "Bezig met downloaden block chain, wacht a.u.b. voordat je doorgaat (block chain is %{days} dagen oud).",
"download_posts_status": "%{portion} berichten gedownload", // Downloaded 10/30 posts
"Enable": "Activeren",
"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": "Uitklappen", // larger view of a post
"Favorite": "Favoriet",
"File APIs not supported in this browser.": "File APIs worden nie ondersteund in deze browser.",
"Follow": "Volgen",
"Followed by": "Gevolgd door",
"followed_by": "Gevolgd door %{username}",
"Followers": "Volgers",
"Following": "Volgend",
"Following users": "Volgende gebruikers",
"Force connection to peer:": "Forceer connectie met peer:",
"General information": "Algemene informatie",
"Generate blocks (send promoted messages)": "Blocks genereren (verstuur promotie berichten)",
"Home": "Home", // homepage
"hours": "%{smart_count} uur |||| %{smart_count} uren",
"Internal error: lastPostId unknown (following yourself may fix!)": "Internal error: lastPostId unknown (following yourself may fix!)",
"Known peers:": "Bekende 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": "Vermeldingen @%{user}",
"minutes": "%{smart_count} minuut |||| %{smart_count} minuten",
"Must be 16 characters or less.": "Moet 16 tekens zijn, of minder.", // username
"Network": "Netwerk",
"Network config": "Netwerk configuratie",
"Network status": "Netwerkstatus",
"New direct message...": "Nieuw privébericht...",
"New Post...": "Nieuw bericht...",
"new_posts": "%{smart_count} nieuw bericht |||| %{smart_count} nieuwe berichten",
"nobody": "nobody", // used to promote a post without attaching the user
"Not available": "Niet beschikbaar", // username is not available
"Number of blocks in block chain:": "Aantal blocks in block chain: ",
"Number of CPUs to use": "Aantal CPUs om te gebruiken ",
"Only alphanumeric and underscore allowed.": "Alleen alphanumeriek en underscore toegestaan.",
"peer address": "peer adres",
"Private": "Privé",
"Profile": "Profiel",
"Postboard": "Postboard",
"post": "post", // verb - button to post a message
"Post to promote:": "Bericht om te promoten: ",
"Posts": "Berichten",
"propagating_nickname": "Gebruikersnaam %{username} verspreiden op het netwerk...",
"Public": "Publiek",
"Refresh": "Vernieuwen",
"retransmit_this": "Retransmit dit bericht naar je volgers?",
"Reply": "Beantwoorden",
"Reply...": "Beantwoord...",
"reply_to": "Beantwoord %{fullname}",
"Retransmit": "Retransmit",
"Retransmits": "Retransmits",
"Retransmitted by": "Retransmitted door",
"search": "zoeken",
"seconds": "%{smart_count} seconde |||| %{smart_count} seconden",
"send": "Verstuur",
"Send post with username": "Verstuur bericht met gebruikersnaam ",
"Sent Direct Message": "Verstuur privébericht",
"Sent Post to @": "Verstuur bericht naar @",
"Setup account": "Account instellingen",
"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} geleden", // 5 minutes ago
"Time of the last block:": "Tijd van de laatste block: ",
"Type message here": "Type bericht hier",
"Unfollow": "Ontvolgen",
"Update": "Update",
"Updating status...": "Status aan het updaten...", // 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": "Vermeldingen voor @%{username}",
"users_profile": "%{username}'s profiel",
"username_undefined": "Gebruikersnaam niet opgegeven, inloggen verplicht.",
"View": "Toon",
"View All": "Toon alles",
"Who to Follow": "Wie volgen?",
"Your message was sent!": "Je bericht is verzonden!"
};
}
// 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<fixedLabels.length;i++){
var elems = $(fixedLabels[i]);
for(var e=0;e<elems.length;e++){
var content = $.trim($(elems[e]).text());
if(wordset[content]){
$(elems[e]).text( polyglot.t(content) );
}
else{
// uncomment to see translations not found
//console.log(content);
}
if(typeof $(elems[e]).attr("placeholder") != "undefined" && wordset[ $(elems[e]).attr("placeholder")]){
$(elems[e]).attr("placeholder", polyglot.t( $(elems[e]).attr("placeholder") ) );
}
}
}
});

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);

14
interface_profile-edit.js

@ -10,7 +10,7 @@ function initProfileEdit() { @@ -10,7 +10,7 @@ function initProfileEdit() {
if (window.File && window.FileReader && window.FileList && window.Blob) {
// Great success! All the File APIs are supported.
} else {
alert('The File APIs are not fully supported in this browser.');
alert(polyglot.t("The File APIs are not fully supported in this browser."));
}
initInterfaceCommon();
@ -22,7 +22,7 @@ function initProfileEdit() { @@ -22,7 +22,7 @@ function initProfileEdit() {
initUser( function() {
if( !defaultScreenName ) {
alert("Username undefined, login required.");
alert(polyglot.t("username_undefined"));
$.MAL.goLogin();
return;
}
@ -91,15 +91,7 @@ function verifyUserAlreadyInBlockchain() @@ -91,15 +91,7 @@ function verifyUserAlreadyInBlockchain()
});
} else {
if( !newUserWarnDisplayed ) {
alert("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!");
alert(polyglot.t("user_not_yet_accepted"));
newUserWarnDisplayed = true;
}
setTimeout("verifyUserAlreadyInBlockchain()", 5000);

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);

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

@ -472,9 +472,9 @@ function followingListPublicCheckbox(e) { @@ -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) @@ -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() { @@ -535,7 +535,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