3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 20:22:39 +01:00

Merge pull request #402 from zuzak/translation

Translation
This commit is contained in:
reality 2013-04-21 08:00:47 -07:00
commit 0517ba687d
5 changed files with 110 additions and 49 deletions

View File

@ -43,8 +43,9 @@ 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,
@ -85,7 +86,13 @@ var pages = function(dbot) {
}),
"git": dbot.t("git"),
"milestonehead": dbot.t("milestones"),
"propaganda": dbot.t("propaganda")
"propaganda": dbot.t("propaganda"),
"languagecurr": dbot.t(dbot.config.language),
"languagenati": dbot.t("langhead-native"),
"languageeng": dbot.t("en"),
"languageprog": dbot.t("langhead-progress"),
"languagetrans": dbot.t("langhead-translations"),
"languagetranshead": dbot.t("translations")
});
},
};

View File

@ -42,16 +42,36 @@ 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]);
}
}
}
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]["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"];
}
}
console.log(t);
return t;
}
};
this.api['translationProgress'].external = true;
};
exports.fetch = function(dbot){
return new project(dbot);
}
};

View File

@ -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}",
@ -170,5 +174,20 @@
},
"git": {
"en": "version control"
},
"langhead-current": {
"en": "Current"
},
"langhead-translations": {
"en": "Completion"
},
"translations": {
"en": "Translations"
},
"langhead-progress": {
"en": "Translation Progress"
},
"langhead-native": {
"en": "Native"
}
}

View File

@ -2,24 +2,20 @@ pre#gitdiff {
text-align:left;
width:80;
margin:auto;
text-transform:none;
}
div#main {
text-align:inherit;
font-size:18px;
}
h2,h3,h4,h5,h6,.center {
text-align:center;
text-transform:lowercase;
}
table#milestones {
table {
margin:auto;
width:80%;
}
table#milestones td {
table td {
padding:5px;
}
p.intro {
text-align:center;
border:1px solid #ccc;
padding:20px;
border-radius:4px;
@ -34,6 +30,7 @@ div.progress {
text-align:left;
font-size:50%;
color:gray;
min-width:200px;
}
div.progress-inner.open {
background-color: #3fff3f;
@ -50,13 +47,7 @@ div.progress-inner.closed {
background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f);
}
#config {
text-align:center;
text-transform:lowercase;
}
ul {
text-align:center;
margin-left:0;
margin-bottom:5px;
font-size:80%;

View File

@ -8,6 +8,12 @@ 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
@ -15,16 +21,13 @@ html(lang='#{curr839}')
div.container#main
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 +35,55 @@ 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)
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)
&nbsp;
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
h4 #{languagetranshead}
table
tr
th #{languagecurr}
th #{languagenati}
th #{languageeng}
th #{languageprog}
th #{languagetrans}
each language in translation
- var w = ((language.count/translation.en.count)*100)
tr
td #{language.local}
td #{language.own}
td #{language.english}
td.prog
unless (language.iso == curr839)
div.progress(class="open")
div.progress-inner(style="width:"+w+"%")(class="open")
&nbsp;
else
div.progress(class="closed")
div.progress-inner(style="width:"+w+"%")(class="closed")
&nbsp;
td #{language.count} / #{translation.en.count}
h4 #{credits}
#{thanks}
ul#credits
ul
each author in authors
li #{author}
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