Added localization support to the html.header file.

As of this commit; the localization of gitinspector is pretty much
complete.
This commit is contained in:
Adam Waldenberg 2013-06-26 00:37:55 +02:00
parent a498603a50
commit a952921c32
2 changed files with 26 additions and 15 deletions

View File

@ -69,7 +69,19 @@ def output_header():
logo_file.close() logo_file.close()
logo = base64.b64encode(logo) logo = base64.b64encode(logo)
print(html_header.format(version.__version__, jquery_js, tablesorter_js, flot_js, pie_js, logo.decode("utf-8", "replace"))) print(html_header.format(version = version.__version__,
jquery = jquery_js,
jquery_tablesorter = tablesorter_js,
jquery_flot = flot_js,
jquery_flot_pie = pie_js,
logo = logo.decode("utf-8", "replace"),
logo_text = _("The output has been generated by {0}; the statistical analysis tool " +
"for git repositories.").format(
"<a href=\"http://gitinspector.googlecode.com\">gitinspector</a>"),
show_minor_authors = _("Show minor authors"),
hide_minor_authors = _("Hide minor authors"),
show_minor_rows = _("Show rows with minor work"),
hide_minor_rows = _("Hide rows with minor work")))
elif __selected_format__ == "xml": elif __selected_format__ == "xml":
print("<gitinspector>") print("<gitinspector>")
print("\t<version>" + version.__version__ + "</version>") print("\t<version>" + version.__version__ + "</version>")

View File

@ -2,11 +2,11 @@
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<head> <head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<title>Generated by gitinspector {0}</title> <title>Generated by gitinspector {version}</title>
<script type="application/javascript">{1}</script> <script type="application/javascript">{jquery}</script>
<script type="application/javascript">{2}</script> <script type="application/javascript">{jquery_tablesorter}</script>
<script type="application/javascript">{3}</script> <script type="application/javascript">{jquery_flot}</script>
<script type="application/javascript">{4}</script> <script type="application/javascript">{jquery_flot_pie}</script>
<script type="application/javascript"> <script type="application/javascript">
$(document).ready(function() {{ $(document).ready(function() {{
var row = 0; var row = 0;
@ -67,12 +67,12 @@
return $(this).parent().parent().parent().find("tbody tr:hidden").length > 0; return $(this).parent().parent().parent().find("tbody tr:hidden").length > 0;
}}).each(function() {{ }}).each(function() {{
$(this).addClass("hoverable"); $(this).addClass("hoverable");
this.innerHTML = "Show minor authors &or;"; this.innerHTML = "{show_minor_authors} &or;";
}}).toggle(function() {{ }}).toggle(function() {{
this.innerHTML = "Hide minor authors &and;"; this.innerHTML = "{hide_minor_authors} &and;";
$(this).parent().parent().parent().find("tbody tr").show().each(colorRows); $(this).parent().parent().parent().find("tbody tr").show().each(colorRows);
}}, function() {{ }}, function() {{
this.innerHTML = "Show minor authors &or;"; this.innerHTML = "{show_minor_authors} &or;";
$(this).parent().parent().parent().find("tbody tr td:last-child").filter(function() {{ $(this).parent().parent().parent().find("tbody tr td:last-child").filter(function() {{
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE; return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
}}).parent().hide(); }}).parent().hide();
@ -83,13 +83,13 @@
if ($("div#timeline table.git tbody tr:hidden").length > 0) {{ if ($("div#timeline table.git tbody tr:hidden").length > 0) {{
$("div#timeline table.git tbody tr:visible").each(colorRows); $("div#timeline table.git tbody tr:visible").each(colorRows);
$("div#timeline").prepend("<div class=\"button\">Show rows with minor work &or;</div>"); $("div#timeline").prepend("<div class=\"button\">{show_minor_rows} &or;</div>");
$("div#timeline div.button").toggle(function() {{ $("div#timeline div.button").toggle(function() {{
this.innerHTML = "Hide rows with minor work &and;" this.innerHTML = "{hide_minor_rows} &and;";
$("div#timeline table.git tbody tr").show().each(colorRows); $("div#timeline table.git tbody tr").show().each(colorRows);
}}, function() {{ }}, function() {{
this.innerHTML = "Show rows with minor work &or;"; this.innerHTML = "{show_minor_rows} &or;";
filterTimeLine(); filterTimeLine();
$("div#timeline table.git tbody tr:visible").each(colorRows); $("div#timeline table.git tbody tr:visible").each(colorRows);
}}); }});
@ -229,7 +229,6 @@
</head> </head>
<body> <body>
<div><div class="box logo"> <div><div class="box logo">
<img src="data:image/png;base64,{5}" /> <img src="data:image/png;base64,{logo}" />
<p>The output has been generated by <a href="http://gitinspector.googlecode.com">gitinspector</a>; <p>{logo_text}<p>
the statistical analysis tool for git repositories.<p>
</div></div> </div></div>