Skip to content

Commit

Permalink
Merged i18n branch - finally burying #29
Browse files Browse the repository at this point in the history
  • Loading branch information
toyg committed Jan 23, 2014
2 parents 91b6187 + fd71992 commit 561b882
Show file tree
Hide file tree
Showing 20 changed files with 1,199 additions and 92 deletions.
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -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
Expand Down Expand Up @@ -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").
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion css/style.css
Expand Up @@ -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;
Expand Down
15 changes: 9 additions & 6 deletions following.html
Expand Up @@ -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>
Expand Down Expand Up @@ -166,7 +168,8 @@ <h2> Following </h2>
<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>
Expand Down Expand Up @@ -347,9 +350,9 @@ <h2 class="profile-screen-name">@<b></b></h2>
</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>
Expand All @@ -362,7 +365,7 @@ <h2 class="profile-screen-name">@<b></b></h2>
<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">
Expand All @@ -382,7 +385,7 @@ <h2>
<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">
Expand Down
25 changes: 14 additions & 11 deletions home.html
Expand Up @@ -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>
Expand Down Expand Up @@ -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">
Expand Down Expand Up @@ -143,7 +145,7 @@ <h3>Who to Follow</h3>
<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">
Expand Down Expand Up @@ -173,7 +175,8 @@ <h2>
<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>
Expand Down Expand Up @@ -356,9 +359,9 @@ <h2 class="profile-screen-name">@<b></b></h2>
</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>
Expand All @@ -371,7 +374,7 @@ <h2 class="profile-screen-name">@<b></b></h2>
<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">
Expand All @@ -391,7 +394,7 @@ <h2>
<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">
Expand All @@ -405,7 +408,7 @@ <h2>
<!-- 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 -->
Expand Down
44 changes: 15 additions & 29 deletions interface_common.js
Expand Up @@ -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 {
Expand All @@ -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 });
}

//
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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 }) );
}

//
Expand All @@ -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),"");
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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()
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion interface_home.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit 561b882

Please sign in to comment.