update translation information

* Remove commented out code
* Covert translationProgress from an array to an object
* Enlargen progress meters
* Add translation table
This commit is contained in:
Douglas Gardner 2013-04-21 14:28:33 +00:00
parent 47d5404f38
commit ad3e597ad2
4 changed files with 30 additions and 22 deletions

View File

@ -15,16 +15,6 @@ var pages = function(dbot) {
}
});
var trans = [];
// THIS IS TOTALLY LEGIT AND OPTIMISED CODE
/* for (var j = 0; j < Object.keys(dbot.strings).length; j++) {
var str = dbot.strings.j;
for (var k = 0; k < Object.keys(dbot.strings.str).length; k++) {
var lang = str.lang;
trans[lang]++;
}
} */
exec("git rev-list --all | wc -l", function(error, stdout, stderr) {
rev = stdout;
});
@ -55,7 +45,7 @@ var pages = function(dbot) {
res.render('project', {
"translation": dbot.modules.project.api.translationProgress(),
"configList": dbot.modules.project.api.configList(),
"authors": authors, //dbot.modules.project.api.getAuthors(),
"authors": authors,
"credits": dbot.t("credits"),
"thanks": dbot.t("thanks"),
"name": dbot.config.name,

View File

@ -43,7 +43,7 @@ var project = function(dbot) {
return list;
},
'translationProgress' : function(callback){
var translation = [];
var translation = [] ;
var str = _.values(dbot.strings);
for (var i = 0; i < str.length; i++){
var cur = _.keys(str[i]);
@ -51,22 +51,20 @@ var project = function(dbot) {
translation = translation.concat(cur[j]);
}
}
// optimise this, someone who isn't me
var t = [];
var t = {};
for (var k = 0; k < str.length; k++) {
var curr = translation[k];
if (t[curr]) {
t[curr]["count"] += 1;
} else {
t[curr] = [];
// t[curr]["839"] = curr;
t[curr] = {};
t[curr]["iso"] = curr;
t[curr]["count"] = 1;
t[curr]["own"] = dbot.strings[curr][curr];
t[curr]["local"] = dbot.t(curr);
t[curr]["english"] = dbot.strings[curr]["en"];
}
}
_.compact(t);
console.log(t);
return t;
}

View File

@ -9,11 +9,11 @@ div#main {
h2,h3,h4,h5,h6,.center {
text-transform:lowercase;
}
table#milestones {
table {
margin:auto;
width:80%;
}
table#milestones td {
table td {
padding:5px;
}
p.intro {
@ -31,6 +31,7 @@ div.progress {
text-align:left;
font-size:50%;
color:gray;
min-width:200px;
}
div.progress-inner.open {
background-color: #3fff3f;

View File

@ -52,9 +52,28 @@ html(lang='#{curr839}')
td #{milestone.open_issues}
td #{milestone.closed_issues}
h4 Translations
ul
each key in translation
li #{translation[0][1]}
table
tr
th Current
th Native
th English
th Progress
th Translations
each language in translation
- var w = ((language.count/translation.en.count)*100)
tr
td #{language.local}
td #{language.own}
td #{language.english}
td.prog
div.progress(class="open")
unless (language.iso == curr839)
div.progress-inner(style="width:"+w+"%")(class="open")
&nbsp;
else
div.progress-inner(style="width:"+w+"%")(class="closed")
&nbsp;
td #{language.count} / #{translation.en.count}
h4 #{credits}
#{thanks}
ul