From: Chris Ferron <chris.e.ferron at linux.intel.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH] add more strings to transalte
Date: Thu, 31 May 2012 08:50:30 -0700 [thread overview]
Message-ID: <4FC79346.4080601@linux.intel.com> (raw)
In-Reply-To: 4FC70693.3000205@freemail.hu
[-- Attachment #1: Type: text/plain, Size: 15761 bytes --]
I like about half of what you have done. I am facing a couple of issues
1. I do not want CSV reports translated. This effects parsing, and
is commonly the reports I like to have sent to me.
2. I have an idea of making the HTML5 report switchable between
Source language (english) and the traget language (other). This way you
can generate html (pretty) reports in a target language, but when others
get them we can also see the English.
All while making the UI portion as translated as possible.
I am in the process of fixing all the strings I can to be more flexible
and translatable. In this patch I like the HTML portion as a start, but
I do not want to take the CSV portion.
My goal is to have all reports and the UI translated and meeting the
goals before the 2.1 release.
Thanks for the input, its very helpful.
-Chris
On 05/30/2012 10:50 PM, Németh Márton wrote:
> From: Márton Németh<nm127(a)freemail.hu>
>
> Separate the HTML/CSV formatting from the strings to be translated.
> Unify upcase/lowcase in heading strings between HTML/CSV output.
>
> Signed-off-by: Márton Németh<nm127(a)freemail.hu>
> ---
> diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp
> index 4096835..341a40d 100644
> --- a/src/cpu/cpu.cpp
> +++ b/src/cpu/cpu.cpp
> @@ -395,10 +395,12 @@ void report_display_cpu_cstates(void)
>
> if (reporttype)
> fprintf(reportout.http_report,
> - "<div id=\"cpuidle\"><h2>Processor Idle state report</h2>\n");
> + "<div id=\"cpuidle\"><h2>%s</h2>\n",
> + _("Processor Idle State Report"));
> else
> fprintf(reportout.csv_report,
> - "**Processor Idle State Report**, \n");
> + "**%s**, \n",
> + _("Processor Idle State Report"));
>
>
> for (package = 0; package< system_level.children.size(); package++) {
> @@ -437,7 +439,7 @@ void report_display_cpu_cstates(void)
> "<th colspan=2 class=\"package_header\" width=\"25%%\">%s</th>"
> , _package->fill_cstate_line(line, buffer));
> else
> - fprintf(reportout.csv_report, ",%s,", "Package");
> + fprintf(reportout.csv_report, ",%s,", _("Package"));
>
> } else {
> if (reporttype)
> @@ -478,14 +480,19 @@ void report_display_cpu_cstates(void)
> _core->fill_cstate_line(line, buffer2));
> } else {
> if (!first_pkg==0) {
> + fprintf(reportout.csv_report, ",,,");
> fprintf(reportout.csv_report,
> - ",,,Core %s ,,",
> + _("Core %s"),
> _core->fill_cstate_line(line, buffer2));
> + fprintf(reportout.csv_report, " ,,");
> } else {
> - fprintf(reportout.csv_report,
> - ",Core %s ,,",
> + fprintf(reportout.csv_report, ",");
> + fprintf(reportout.csv_report,
> + _("Core %s"),
> _core->fill_cstate_line(line, buffer2));
> - }
> + fprintf(reportout.csv_report,
> + " ,,");
> + }
> }
> } else {
> if (reporttype) {
> @@ -593,9 +600,11 @@ void report_display_cpu_pstates(void)
> return;
>
> if (reporttype)
> - fprintf(reportout.http_report, "<div id=\"cpufreq\"><h2>Processor frequency report</h2>\n");
> + fprintf(reportout.http_report, "<div id=\"cpufreq\"><h2>%s</h2>\n",
> + _("Processor Frequency Report"));
> else
> - fprintf(reportout.csv_report, "**Processor Frequency Report**, \n");
> + fprintf(reportout.csv_report, "**%s**, \n",
> + _("Processor Frequency Report"));
>
> for (package = 0; package< system_level.children.size(); package++) {
> int first_pkg = 0;
> @@ -634,7 +643,7 @@ void report_display_cpu_pstates(void)
> _package->fill_pstate_name(line, buffer),
> _package->fill_pstate_line(line, buffer2));
> else
> - fprintf(reportout.csv_report,",%s,", "Package");
> + fprintf(reportout.csv_report,",%s,", _("Package"));
>
> } else {
> if (reporttype) {
> @@ -903,7 +912,7 @@ void perf_power_bundle::handle_trace_point(void *trace, int cpunr, uint64_t time
> return;
>
> if (cpunr>= (int)all_cpus.size()) {
> - cout<< "INVALID cpu nr in handle_trace_point\n";
> + cout<< _("INVALID cpu nr in handle_trace_point")<< "\n";
> return;
> }
>
> diff --git a/src/process/do_process.cpp b/src/process/do_process.cpp
> index 7366454..03e33b0 100644
> --- a/src/process/do_process.cpp
> +++ b/src/process/do_process.cpp
> @@ -414,7 +414,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
>
> ret = pevent_get_field_val(NULL, event, "vec",&rec,&val, 0);
> if (ret< 0) {
> - fprintf(stderr, "softirq_entry event returned no vector number?\n");
> + fprintf(stderr, _("softirq_entry event returned no vector number?\n"));
> return;
> }
> vec = (int)val;
> @@ -451,7 +451,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
>
> ret = pevent_get_field_val(NULL, event, "function",&rec,&val, 0);
> if (ret< 0) {
> - fprintf(stderr, "timer_expire_entry event returned no fucntion value?\n");
> + fprintf(stderr, _("timer_expire_entry event returned no fucntion value?\n"));
> return;
> }
> function = (uint64_t)val;
> @@ -463,7 +463,7 @@ void perf_process_bundle::handle_trace_point(void *trace, int cpu, uint64_t time
>
> ret = pevent_get_field_val(NULL, event, "timer",&rec,&val, 0);
> if (ret< 0) {
> - fprintf(stderr, "softirq_entry event returned no timer ?\n");
> + fprintf(stderr, _("softirq_entry event returned no timer?\n"));
> return;
> }
> tmr = (uint64_t)val;
> @@ -839,7 +839,7 @@ void process_update_display(void)
> wprintw(win, "\n");
>
>
> - wprintw(win, "Summary: %3.1f wakeups/second, %3.1f GPU ops/second, %3.1f VFS ops/sec and %3.1f%% CPU use\n\n",
> + wprintw(win, _("Summary: %3.1f wakeups/second, %3.1f GPU ops/second, %3.1f VFS ops/sec and %3.1f%% CPU use\n\n"),
> total_wakeups(), total_gpu_ops(), total_disk_hits(), total_cpu_time()*100);
>
>
> @@ -909,21 +909,58 @@ void report_process_update_display(void)
>
> if (reporttype){
> fprintf(reportout.http_report,
> - "<div id=\"software\"><h2>Overview of Software Power Consumers</h2>\n<table width=\"100%%\">\n");
> + "<div id=\"software\"><h2>%s</h2>\n<table width=\"100%%\">\n",
> + _("Overview of Software Power Consumers"));
> if (show_power)
> fprintf(reportout.http_report,
> - "<tr><th width=\"10%%\">Power est.</th><th width=\"10%%\">Usage</th><th width=\"10%%\">Wakeups/s</th><th width=\"10%%\">GPU ops/s</th><th
> width=\"10%%\">Disk IO/s</th><th width=\"10%%\">GFX Wakeups/s</th><th width=\"10%%\" class=\"process\">Category</th><th class=\"process\">Description</th></tr>\n");
> + "<tr>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\" class=\"process\">%s</th>"
> + "<th class=\"process\">%s</th>"
> + "</tr>\n",
> + _("Power est."),
> + _("Usage"),
> + _("Wakeups/s"),
> + _("GPU ops/s"),
> + _("Disk IO/s"),
> + _("GFX Wakeups/s"),
> + _("Category"),
> + _("Description")
> + );
> else
> fprintf(reportout.http_report,
> "<tr><th width=\"10%%\">Usage</th><th width=\"10%%\">Wakeups/s</th><th width=\"10%%\">GPU ops/s</th><th width=\"10%%\">Disk IO/s</th><th width=\"10%%\">GFX
> Wakeups/s</th><th width=\"10%%\" class=\"process\">Category</th><th class=\"process\">Description</th></tr>\n");
> }else {
> - fprintf(reportout.csv_report,"**Overview of Software Power Consumers**, \n\n");
> + fprintf(reportout.csv_report,"**%s**, \n\n",
> + _("Overview of Software Power Consumers"));
> if (show_power)
> fprintf(reportout.csv_report,
> - "Power est., Usage, Wakeups, GPU ops, Disk IO, GFX Wakeups, Category, Description, \n");
> + "%s, %s, %s, %s, %s, %s, %s, %s, \n",
> + _("Power est."),
> + _("Usage"),
> + _("Wakeups"),
> + _("GPU ops"),
> + _("Disk IO"),
> + _("GFX Wakeups"),
> + _("Category"),
> + _("Description")
> + );
> else
> fprintf(reportout.csv_report,
> - "Usage, Wakeups, GPU ops, Disk IO, GFX Wakeups, Category, Description, \n");
> + "%s, %s, %s, %s, %s, %s, %s, \n",
> + _("Usage"),
> + _("Wakeups"),
> + _("GPU ops"),
> + _("Disk IO"),
> + _("GFX Wakeups"),
> + _("Category"),
> + _("Description")
> + );
> }
>
> total = all_power.size();
> @@ -1024,29 +1061,68 @@ void report_summary(void)
>
> if (reporttype) {
> fprintf(reportout.http_report,
> - "<div id=\"summary\"><h2>Power Consumption Summary</h2>\n");
> + "<div id=\"summary\"><h2>%s</h2>\n",
> + _("Power Consumption Summary"));
> + fprintf(reportout.http_report, "<p>");
> fprintf(reportout.http_report,
> - "<p>%3.1f wakeups/second, %3.1f GPU ops/second, %3.1f VFS ops/sec, %3.1f GFX wakes/sec and %3.1f%% CPU use</p>\n<table width=\"100%%\">\n",
> + _("%3.1f wakeups/second, %3.1f GPU ops/second, %3.1f VFS ops/sec, %3.1f GFX wakes/sec and %3.1f%% CPU use"),
> total_wakeups(), total_gpu_ops(), total_disk_hits(), total_xwakes(), total_cpu_time()*100);
> + fprintf(reportout.http_report,
> + "</p>\n<table width=\"100%%\">\n");
>
> if (show_power)
> fprintf(reportout.http_report,
> - "<tr><th width=\"10%%\">Power est.</th><th width=\"10%%\">Usage</th><th width=\"10%%\">Events/s</th><th width=\"10%%\" class=\"process\">Category</th><th
> class=\"process\">Description</th></tr>\n");
> + "<tr>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\" class=\"process\">%s</th>"
> + "<th class=\"process\">%s</th>"
> + "</tr>\n",
> + _("Power est."),
> + _("Usage"),
> + _("Events/s"),
> + _("Category"),
> + _("Description")
> + );
> else
> fprintf(reportout.http_report,
> - "<tr><th width=\"10%%\">Usage</th><th width=\"10%%\">Events/s</th><th width=\"10%%\" class=\"process\">Category</th><th
> class=\"process\">Description</th></tr>\n");
> + "<tr>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\">%s</th>"
> + "<th width=\"10%%\" class=\"process\">%s</th>"
> + "<th class=\"process\">%s</th>"
> + "</tr>\n",
> + _("Usage"),
> + _("Events/s"),
> + _("Category"),
> + _("Description")
> + );
>
> }else {
> fprintf(reportout.csv_report,
> - "**Power Consumption Summary** \n");
> + "**%s** \n",
> + _("Power Consumption Summary"));
> fprintf(reportout.csv_report,
> - "%3.1f wakeups/second, %3.1f GPU ops/second, %3.1f VFS ops/sec, %3.1f GFX wakes/sec and %3.1f%% CPU use \n\n",
> + _("%3.1f wakeups/second, %3.1f GPU ops/second, %3.1f VFS ops/sec, %3.1f GFX wakes/sec and %3.1f%% CPU use"),
> total_wakeups(), total_gpu_ops(), total_disk_hits(), total_xwakes(), total_cpu_time()*100);
> + fprintf(reportout.csv_report, " \n\n");
>
> if (show_power)
> - fprintf(reportout.csv_report,"Power est., Usage, Events/s, Category, Description, \n");
> + fprintf(reportout.csv_report, "%s, %s, %s, %s, %s, \n",
> + _("Power est."),
> + _("Usage"),
> + _("Events/s"),
> + _("Category"),
> + _("Description")
> + );
> else
> - fprintf(reportout.csv_report,"Usage, Events/s, Category, Description, \n");
> + fprintf(reportout.csv_report, "%s, %s, %s, %s, \n",
> + _("Usage"),
> + _("Events/s"),
> + _("Category"),
> + _("Description")
> + );
>
> }
> total = all_power.size();
> diff --git a/src/report.cpp b/src/report.cpp
> index 1d97d27..86b0964 100644
> --- a/src/report.cpp
> +++ b/src/report.cpp
> @@ -120,20 +120,24 @@ static void system_info(void)
>
> if (reporttype) {
> fprintf(reportout.http_report, "<div id=\"top\">\n<h1><a href=\"#top\"> </a></h1>\n</div>\n<div id=\"system\">\n<table>");
> - fprintf(reportout.http_report, "<tr class=\"system_even\"><td width=\"20%%\">PowerTOP Version</td><td>%s</td></tr>\n", POWERTOP_VERSION);
> + fprintf(reportout.http_report, "<tr class=\"system_even\"><td width=\"20%%\">%s</td><td>%s</td></tr>\n",
> + _("PowerTOP Version"),
> + POWERTOP_VERSION);
> } else {
> - fprintf(reportout.csv_report, "***PowerTOP Report***, \n");
> - fprintf(reportout.csv_report, "**System Information**, \n");
> + fprintf(reportout.csv_report, "***%s***, \n", _("PowerTOP Report"));
> + fprintf(reportout.csv_report, "**%s**, \n", _("System Information"));
> fprintf(reportout.csv_report, "\n");
> - fprintf(reportout.csv_report, "PowerTOP Version:, \"%s\", \n", POWERTOP_VERSION);
> + fprintf(reportout.csv_report, "%s:, \"%s\", \n", "PowerTOP Version", POWERTOP_VERSION);
> }
> str = read_sysfs_string("/proc/version");
>
> if (reporttype)
> - fprintf(reportout.http_report,"<tr class=\"system_odd\"><td>Kernel Version</td><td>%s</td></tr>\n",
> + fprintf(reportout.http_report,"<tr class=\"system_odd\"><td>%s</td><td>%s</td></tr>\n",
> + _("Kernel Version"),
> str.c_str());
> else
> - fprintf(reportout.csv_report, "Kernel Version:, \"%s\", \n",
> + fprintf(reportout.csv_report, "%s:, \"%s\", \n",
> + _("Kernel Version"),
> str.c_str());
>
> str = read_sysfs_string("/sys/devices/virtual/dmi/id/board_vendor");
> @@ -141,19 +145,23 @@ static void system_info(void)
> str3 = read_sysfs_string("/sys/devices/virtual/dmi/id/product_version");
>
> if (reporttype)
> - fprintf(reportout.http_report, "<tr class=\"system_even\"><td>System Name</td><td>%s %s %s</td></tr>\n",
> + fprintf(reportout.http_report, "<tr class=\"system_even\"><td>%s</td><td>%s %s %s</td></tr>\n",
> + _("System Name"),
> str.c_str(), str2.c_str(), str3.c_str());
> else
> - fprintf(reportout.csv_report,"System Name:,\"%s %s %s,\" \n",
> + fprintf(reportout.csv_report,"%s:,\"%s %s %s,\" \n",
> + _("System Name"),
> str.c_str(), str2.c_str(), str3.c_str());
>
> str = cpu_model();
>
> if (reporttype)
> - fprintf(reportout.http_report, "<tr class=\"system_odd\"><td>CPU Information</td><td>%lix %s</td></tr>\n",
> + fprintf(reportout.http_report, "<tr class=\"system_odd\"><td>%s</td><td>%lix %s</td></tr>\n",
> + _("CPU Information"),
> sysconf(_SC_NPROCESSORS_ONLN), str.c_str());
> else
> - fprintf(reportout.csv_report,"CPU Information:, %lix \"%s\", \n",
> + fprintf(reportout.csv_report,"%s:, %lix \"%s\", \n",
> + _("CPU Information"),
> sysconf(_SC_NPROCESSORS_ONLN), str.c_str());
>
> str = read_sysfs_string("/etc/system-release");
> @@ -163,11 +171,13 @@ static void system_info(void)
> str = read_os_release("/etc/os-release");
>
> if (reporttype) {
> - fprintf(reportout.http_report, "<tr class=\"system_even\"><td>OS Information</td><td>%s</td></tr>\n",
> + fprintf(reportout.http_report, "<tr class=\"system_even\"><td>%s</td><td>%s</td></tr>\n",
> + _("OS Information"),
> str.c_str());
> fprintf(reportout.http_report,"</table></div>\n");
> } else {
> - fprintf(reportout.csv_report,"OS Information:,\"%s\", \n",
> + fprintf(reportout.csv_report,"%s:,\"%s\", \n",
> + _("OS Information"),
> str.c_str());
> fprintf(reportout.csv_report,"\n");
> }
reply other threads:[~2012-05-31 15:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FC79346.4080601@linux.intel.com \
--to=powertop@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.