3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-26 12:42:51 +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', { 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,
"credits": dbot.t("credits"), "credits": dbot.t("credits"),
"thanks": dbot.t("thanks"), "thanks": dbot.t("thanks"),
"name": dbot.config.name, "name": dbot.config.name,
@ -85,7 +86,13 @@ var pages = function(dbot) {
}), }),
"git": dbot.t("git"), "git": dbot.t("git"),
"milestonehead": dbot.t("milestones"), "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; 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]);
}
}
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){ exports.fetch = function(dbot){
return new project(dbot); return new project(dbot);
} };

View File

@ -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}",
@ -170,5 +174,20 @@
}, },
"git": { "git": {
"en": "version control" "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; text-align:left;
width:80; width:80;
margin:auto; margin:auto;
text-transform:none;
} }
div#main { div#main {
text-align:inherit;
font-size:18px; font-size:18px;
}
h2,h3,h4,h5,h6,.center {
text-align: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 {
text-align:center;
border:1px solid #ccc; border:1px solid #ccc;
padding:20px; padding:20px;
border-radius:4px; border-radius:4px;
@ -34,6 +30,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;
@ -50,13 +47,7 @@ div.progress-inner.closed {
background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f); background-image: linear-gradient(to bottom,#ff3f3f,#ff7f7f);
} }
#config {
text-align:center;
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%;

View File

@ -8,6 +8,12 @@ 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
@ -15,16 +21,13 @@ html(lang='#{curr839}')
div.container#main div.container#main
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 +35,55 @@ 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)
&nbsp; &nbsp;
print #{Math.round(width)+"%"}
td #{milestone.open_issues} td #{milestone.open_issues}
td #{milestone.closed_issues} td #{milestone.closed_issues}
p.center h4 #{languagetranshead}
a(href="https://github.com/"+repo) #{propaganda} table
h4 tr
#{credits} th #{languagecurr}
p.center th #{languagenati}
#{thanks} th #{languageeng}
ul#credits th #{languageprog}
each author in authors th #{languagetrans}
li #{author} 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
each author in authors
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