mirror of
https://github.com/reality/dbot.git
synced 2024-11-30 16:09:27 +01:00
Add beginnings of translation progress API
* Add totally legit and optimised code to find the number of strings in each language. * Add this as an API call * Add strings for ``na'vi``, ``es`` and ``nl`` for their own language names * Optimise CSS a bit * Add classes for the languages, for testing purposes
This commit is contained in:
parent
24387200bc
commit
47d5404f38
@ -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) {
|
exec("git rev-list --all | wc -l", function(error, stdout, stderr) {
|
||||||
rev = stdout;
|
rev = stdout;
|
||||||
});
|
});
|
||||||
@ -43,6 +53,7 @@ var pages = function(dbot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.render('project', {
|
res.render('project', {
|
||||||
|
"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, //dbot.modules.project.api.getAuthors(),
|
||||||
"credits": dbot.t("credits"),
|
"credits": dbot.t("credits"),
|
||||||
|
@ -42,16 +42,38 @@ var project = function(dbot) {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
},
|
},
|
||||||
'getAuthors': function(callback) {
|
'translationProgress' : function(callback){
|
||||||
var foo = ['a','b','c'];
|
var translation = [];
|
||||||
exec("git rev-list --all | wc -l", function(error, stdout, stderr){
|
var str = _.values(dbot.strings);
|
||||||
foo.push(stdout);
|
for (var i = 0; i < str.length; i++){
|
||||||
});
|
var cur = _.keys(str[i]);
|
||||||
callback(foo);
|
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){
|
exports.fetch = function(dbot){
|
||||||
return new project(dbot);
|
return new project(dbot);
|
||||||
}
|
};
|
||||||
|
@ -63,17 +63,21 @@
|
|||||||
"fr": "na'vi",
|
"fr": "na'vi",
|
||||||
"de": "Na'vi",
|
"de": "Na'vi",
|
||||||
"it": "Na'vi",
|
"it": "Na'vi",
|
||||||
"nl": "Na'vi"
|
"nl": "Na'vi",
|
||||||
|
"na'vi": "Na'vi"
|
||||||
|
|
||||||
},
|
},
|
||||||
"es": {
|
"es": {
|
||||||
"en": "Spanish",
|
"en": "Spanish",
|
||||||
"fr": "espagnole",
|
"fr": "espagnole",
|
||||||
"de": "Spanisch",
|
"de": "Spanisch",
|
||||||
"it": "spagnolo",
|
"it": "spagnolo",
|
||||||
"nl": "Spaans"
|
"nl": "Spaans",
|
||||||
|
"es": "Español"
|
||||||
},
|
},
|
||||||
"nl": {
|
"nl": {
|
||||||
"en": "Dutch"
|
"en": "Dutch",
|
||||||
|
"nl": "Nederlands"
|
||||||
},
|
},
|
||||||
"revnum": {
|
"revnum": {
|
||||||
"en": "{name} is at revision {rev}",
|
"en": "{name} is at revision {rev}",
|
||||||
|
@ -4,11 +4,9 @@ pre#gitdiff {
|
|||||||
margin:auto;
|
margin:auto;
|
||||||
}
|
}
|
||||||
div#main {
|
div#main {
|
||||||
text-align:inherit;
|
|
||||||
font-size:18px;
|
font-size:18px;
|
||||||
}
|
}
|
||||||
h2,h3,h4,h5,h6,.center {
|
h2,h3,h4,h5,h6,.center {
|
||||||
text-align:center;
|
|
||||||
text-transform:lowercase;
|
text-transform:lowercase;
|
||||||
}
|
}
|
||||||
table#milestones {
|
table#milestones {
|
||||||
@ -19,7 +17,6 @@ table#milestones td {
|
|||||||
padding:5px;
|
padding:5px;
|
||||||
}
|
}
|
||||||
p.intro {
|
p.intro {
|
||||||
text-align:center;
|
|
||||||
border:1px solid #ccc;
|
border:1px solid #ccc;
|
||||||
padding:20px;
|
padding:20px;
|
||||||
border-radius:4px;
|
border-radius:4px;
|
||||||
@ -51,12 +48,10 @@ div.progress-inner.closed {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#config {
|
#config {
|
||||||
text-align:center;
|
|
||||||
text-transform:lowercase;
|
text-transform:lowercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
text-align:center;
|
|
||||||
margin-left:0;
|
margin-left:0;
|
||||||
margin-bottom:5px;
|
margin-bottom:5px;
|
||||||
font-size:80%;
|
font-size:80%;
|
||||||
@ -72,3 +67,28 @@ li {
|
|||||||
#footer {
|
#footer {
|
||||||
font-size:80%;
|
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;
|
||||||
|
}
|
||||||
|
@ -8,23 +8,28 @@ html(lang='#{curr839}')
|
|||||||
link(rel='stylesheet', type='text/css', href='/styles.css')
|
link(rel='stylesheet', type='text/css', href='/styles.css')
|
||||||
link(rel="stylesheet", href="/project.css")
|
link(rel="stylesheet", href="/project.css")
|
||||||
title #{pagetitle}
|
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
|
body
|
||||||
div.container
|
div.container
|
||||||
div#page
|
div#page
|
||||||
div#title #{pagetitle}
|
div#title #{pagetitle}
|
||||||
div.container#main
|
div.container#main
|
||||||
|
p.intro
|
||||||
|
|
||||||
p.intro
|
p.intro
|
||||||
#{dquote}
|
#{dquote}
|
||||||
section#development
|
section#git
|
||||||
h3 #{development}
|
h3 #{development}
|
||||||
h4 #{git}
|
|
||||||
p.center
|
p.center
|
||||||
#{revnum}
|
#{revnum}
|
||||||
ul
|
|
||||||
li #{branch}
|
|
||||||
pre#gitdiff
|
pre#gitdiff
|
||||||
#{diff}
|
#{diff}
|
||||||
h4 #{milestonehead}
|
h4 #{milestoneprog}
|
||||||
table#milestones.center
|
table#milestones.center
|
||||||
tr
|
tr
|
||||||
th #{milestonename}
|
th #{milestonename}
|
||||||
@ -32,34 +37,35 @@ html(lang='#{curr839}')
|
|||||||
th #{openmilestone}
|
th #{openmilestone}
|
||||||
th #{closedmilestone}
|
th #{closedmilestone}
|
||||||
each milestone in milestones
|
each milestone in milestones
|
||||||
- var width = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
|
- var mstone = "milestone"
|
||||||
tr(id="milestone"+milestone.number)
|
- var wd = "width:"
|
||||||
|
- var pc = "%"
|
||||||
|
- var wdth = ((milestone.closed_issues/(milestone.open_issues + milestone.closed_issues))*100)
|
||||||
|
tr(id=mstone+milestone.number)
|
||||||
td
|
td
|
||||||
a(href="https://github.com/"+repo+"/issues?milestone="+milestone.number)
|
a(href=milestone.url)
|
||||||
#{milestone.title}
|
#{milestone.title}
|
||||||
td
|
td
|
||||||
div.progress(class=milestone.state)
|
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.open_issues}
|
||||||
td #{milestone.closed_issues}
|
td #{milestone.closed_issues}
|
||||||
p.center
|
h4 Translations
|
||||||
a(href="https://github.com/"+repo) #{propaganda}
|
ul
|
||||||
h4
|
each key in translation
|
||||||
#{credits}
|
li #{translation[0][1]}
|
||||||
p.center
|
h4 #{credits}
|
||||||
#{thanks}
|
#{thanks}
|
||||||
ul#credits
|
ul
|
||||||
each author in authors
|
each author in authors
|
||||||
li #{author}
|
li
|
||||||
|
#{author}
|
||||||
section#config
|
section#config
|
||||||
h3 #{config}
|
h3 #{config}
|
||||||
ul
|
ul
|
||||||
li #{currlang}
|
li #{currlang}
|
||||||
li #{debugmode}
|
li #{debugmode}
|
||||||
each message in configList
|
|
||||||
li #{message}
|
|
||||||
h4 #{loadmod}
|
h4 #{loadmod}
|
||||||
ul#modules
|
ul#modules
|
||||||
each module in modules
|
each module in modules
|
||||||
|
Loading…
Reference in New Issue
Block a user