diff --git a/modules/project/pages.js b/modules/project/pages.js index 7d964de..944064f 100644 --- a/modules/project/pages.js +++ b/modules/project/pages.js @@ -15,6 +15,16 @@ 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; }); @@ -43,6 +53,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(), "credits": dbot.t("credits"), diff --git a/modules/project/project.js b/modules/project/project.js index 48ed053..b177dbe 100644 --- a/modules/project/project.js +++ b/modules/project/project.js @@ -42,16 +42,38 @@ var project = function(dbot) { } return list; }, - 'getAuthors': function(callback) { - var foo = ['a','b','c']; - exec("git rev-list --all | wc -l", function(error, stdout, stderr){ - foo.push(stdout); - }); - callback(foo); + 'translationProgress' : function(callback){ + var translation = []; + var str = _.values(dbot.strings); + for (var i = 0; i < str.length; i++){ + var cur = _.keys(str[i]); + for (var j = 0; j < cur.length; j++) { + translation = translation.concat(cur[j]); + } + } + // optimise this, someone who isn't me + 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]["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; } - } -} + }; + this.api['translationProgress'].external = true; +}; exports.fetch = function(dbot){ return new project(dbot); -} +}; diff --git a/modules/project/strings.json b/modules/project/strings.json index f3c80b5..e03f30a 100644 --- a/modules/project/strings.json +++ b/modules/project/strings.json @@ -63,17 +63,21 @@ "fr": "na'vi", "de": "Na'vi", "it": "Na'vi", - "nl": "Na'vi" + "nl": "Na'vi", + "na'vi": "Na'vi" + }, "es": { "en": "Spanish", "fr": "espagnole", "de": "Spanisch", "it": "spagnolo", - "nl": "Spaans" + "nl": "Spaans", + "es": "EspaƱol" }, "nl": { - "en": "Dutch" + "en": "Dutch", + "nl": "Nederlands" }, "revnum": { "en": "{name} is at revision {rev}", diff --git a/public/project.css b/public/project.css index 6b36846..b0793a8 100644 --- a/public/project.css +++ b/public/project.css @@ -4,11 +4,9 @@ pre#gitdiff { margin:auto; } div#main { - text-align:inherit; font-size:18px; } h2,h3,h4,h5,h6,.center { - text-align:center; text-transform:lowercase; } table#milestones { @@ -19,7 +17,6 @@ table#milestones td { padding:5px; } p.intro { - text-align:center; border:1px solid #ccc; padding:20px; border-radius:4px; @@ -51,12 +48,10 @@ div.progress-inner.closed { } #config { - text-align:center; text-transform:lowercase; } ul { - text-align:center; margin-left:0; margin-bottom:5px; font-size:80%; @@ -72,3 +67,28 @@ li { #footer { font-size:80%; } +/* testing stuff */ +.en { + background-color:red; + background-image:none; +} +.fr { + background-color:blue; + background-image:none; +} +.de { + background-color:yellow; + background-image:none; +} +.nl { + background-color:darkorange; + background-image:none; +} +.cy { + background-image:palevioletred; + background-image:none; +} +.es { + background-image:none; + background-color:orchid; +} diff --git a/views/project/project.jade b/views/project/project.jade index 9f5e3cd..02c18bc 100644 --- a/views/project/project.jade +++ b/views/project/project.jade @@ -8,23 +8,28 @@ html(lang='#{curr839}') link(rel='stylesheet', type='text/css', href='/styles.css') link(rel="stylesheet", href="/project.css") title #{pagetitle} + - var mstone = "milestone" + style(type="text/css") + each milestone in milestones + - current = mstone+milestone.number + - wdth = ((milestone.open_issues/(milestone.open_issues + milestone.closed_issues))*100) + .current { width: wdth% } body div.container div#page div#title #{pagetitle} div.container#main + p.intro + p.intro #{dquote} - section#development + section#git h3 #{development} - h4 #{git} p.center #{revnum} - ul - li #{branch} pre#gitdiff #{diff} - h4 #{milestonehead} + h4 #{milestoneprog} table#milestones.center tr th #{milestonename} @@ -32,34 +37,35 @@ html(lang='#{curr839}') th #{openmilestone} th #{closedmilestone} each milestone in milestones - - var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100) - tr(id="milestone"+milestone.number) + - var mstone = "milestone" + - var wd = "width:" + - var pc = "%" + - var wdth = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100) + tr(id=mstone+milestone.number) td - a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number) - #{milestone.title} + a(href=milestone.url) + #{milestone.title} td div.progress(class=milestone.state) - div.progress-inner(style="width:"+width+"%")(class=milestone.state) + div.progress-inner(style=wd+wdth+pc)(class=milestone.state)   - print #{Math.round(width)+"%"} td #{milestone.open_issues} td #{milestone.closed_issues} - p.center - a(href="https://github.com/"+repo) #{propaganda} - h4 - #{credits} - p.center - #{thanks} - ul#credits - each author in authors - li #{author} + h4 Translations + ul + each key in translation + li #{translation[0][1]} + h4 #{credits} + #{thanks} + ul + each author in authors + li + #{author} section#config h3 #{config} ul li #{currlang} li #{debugmode} - each message in configList - li #{message} h4 #{loadmod} ul#modules each module in modules