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) { exec("git rev-list --all | wc -l", function(error, stdout, stderr) {
rev = stdout; rev = stdout;
}); });
@ -55,7 +45,7 @@ var pages = function(dbot) {
res.render('project', { res.render('project', {
"translation": dbot.modules.project.api.translationProgress(), "translation": dbot.modules.project.api.translationProgress(),
"configList": dbot.modules.project.api.configList(), "configList": dbot.modules.project.api.configList(),
"authors": authors, //dbot.modules.project.api.getAuthors(), "authors": authors,
"credits": dbot.t("credits"), "credits": dbot.t("credits"),
"thanks": dbot.t("thanks"), "thanks": dbot.t("thanks"),
"name": dbot.config.name, "name": dbot.config.name,

View File

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

View File

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

View File

@ -52,9 +52,28 @@ html(lang='#{curr839}')
td #{milestone.open_issues} td #{milestone.open_issues}
td #{milestone.closed_issues} td #{milestone.closed_issues}
h4 Translations h4 Translations
ul table
each key in translation tr
li #{translation[0][1]} 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} h4 #{credits}
#{thanks} #{thanks}
ul ul