Skip to content

Instantly share code, notes, and snippets.

@vigo vigo/turko.js
Created Nov 28, 2010

Embed
What would you like to do?
Tumblr için Türkçe'ye çevirme jQuery Plugin'i
<script type="text/javascript" charset="utf-8">
(function($){
$.fn.turko = function(options){
var defaults = {
},
dictionaryItems = {
/* aylar uzun */
'January': "Ocak",
'February': "Şubat",
'March': "Mart",
'April': "Nisan",
'May': "Mayıs",
'June': "Haziran",
'July': "Temmuz",
'August': "Ağustos",
'September': "Eylül",
'October': "Ekim",
'November': "Kasım",
'December': "Aralık",
/* aylar kısa */
'Jan': "Oca",
'Feb': "Şub",
'Mar': "Mar",
'Apr': "Nis",
'May': "May",
'Jun': "Haz",
'Jul': "Tem",
'Aug': "Ağu",
'Sep': "Eyl",
'Oct': "Eki",
'Nov': "Kas",
'Dec': "Ara",
/* diğer */
'Permalink': "Link",
'Posted at': "",
'PM': "",
'AM': "",
'notes': "not",
'Older entries': "Önceki kayıtlar",
'Previous post': "Önceki yazı",
'Next post': "Sonraki yazı",
/* footer */
'Archive': "Arşiv",
'Random': "Rastgele",
'Mobile': "Mobil",
'Ask me anything': "Soru sor",
};
settings = $.extend({}, defaults, options);
this.each(function(i){
var $this = $(this),
strText = $this.text();
$.each(dictionaryItems, function(k, v){
strText = strText.replace(k, v);
});
$this.text(strText);
});
return this;
};
})(jQuery);
</script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$(".date .month").turko();
$("#meta-info li a").turko();
$("#searchbox #submit").val('Ara');
var postFooterItems = {
notes: [],
permalinks: [],
postedats: [],
taggeds: []
};
$.each($(".post"), function(i, o){
var lis = $(o).find('.post-footer').find('li');
$.each(lis, function(ii, oo){
var ooText = $(oo).text();
if(ooText.indexOf("notes")>-1){
postFooterItems.notes.push($(oo));
}
if(ooText == "Permalink"){
postFooterItems.permalinks.push($(oo));
}
if(ooText.indexOf("Posted at")>-1){
postFooterItems.postedats.push($(oo));
}
if(ooText.indexOf("Tagged")>-1){
postFooterItems.taggeds.push($(oo));
}
});
});
if(postFooterItems.notes.length>0){
$.each(postFooterItems.notes, function(i){
postFooterItems.notes[i].find('a').turko();
});
}
if(postFooterItems.permalinks.length>0){
$.each(postFooterItems.permalinks, function(i){
postFooterItems.permalinks[i].find('a').turko();
});
}
if(postFooterItems.postedats.length>0){
$.each(postFooterItems.postedats, function(i){
postFooterItems.postedats[i].turko();
});
}
if(postFooterItems.taggeds.length>0){
$.each(postFooterItems.taggeds, function(i){
var lnks = [];
$.each(postFooterItems.taggeds[i].find('a'), function(ii, oo){
lnks.push('<a href="/tagged/' + $(oo).text() + '">' + $(oo).text() + '</a>');
});
postFooterItems.taggeds[i].html("Etiket: " + lnks.join(' '));
});
}
$.each($(".play-count"), function(i, o){
var txt = $(o).text();
$(o).text(txt.split(" ")[1] + " defa çaldı.");
});
$.each($(".reblogged a"), function(i, o){
var user = $(o).text(),
href = o.href;
$(o).parent().html('Alıntı: <a target="_blank" href="' + href +'">' + user +'</a>');
});
$("#pagination a[rel='next']").turko();
// posts prev / next
$.each($("#pagination").find('a'), function(i, o){
if($(o).text().indexOf('Previous post')>-1){
$(o).turko();
}
if($(o).text().indexOf('Next post')>-1){
$(o).turko();
}
});
// fix for gits
$(".gist .gist-file .gist-data pre").css({
'font-family': "Monaco, Courier, monospace",
});
$(".gist .gist-file .gist-data").css({
'font-size': "13px",
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.