diff options
-rw-r--r-- | calibrate/calibrate.cpp | 32 | ||||
-rw-r--r-- | cpu/cpu.cpp | 4 | ||||
-rw-r--r-- | cpu/cpu_core.cpp | 2 | ||||
-rw-r--r-- | cpu/cpu_linux.cpp | 4 | ||||
-rw-r--r-- | cpu/cpu_package.cpp | 2 | ||||
-rw-r--r-- | cpu/intel_cpus.cpp | 24 | ||||
-rw-r--r-- | devices/ahci.cpp | 4 | ||||
-rw-r--r-- | devices/alsa.cpp | 6 | ||||
-rw-r--r-- | devices/device.cpp | 8 | ||||
-rw-r--r-- | devices/network.cpp | 2 | ||||
-rw-r--r-- | devices/rfkill.cpp | 4 | ||||
-rw-r--r-- | devices/runtime_pm.cpp | 2 | ||||
-rw-r--r-- | devices/usb.cpp | 8 | ||||
-rw-r--r-- | devlist.cpp | 4 | ||||
-rw-r--r-- | display.cpp | 14 | ||||
-rw-r--r-- | display.h | 2 | ||||
-rw-r--r-- | lib.cpp | 10 | ||||
-rw-r--r-- | main.cpp | 17 | ||||
-rw-r--r-- | parameters/persistent.cpp | 10 | ||||
-rw-r--r-- | perf/perf.cpp | 6 | ||||
-rw-r--r-- | po/powertop.pot | 348 | ||||
-rw-r--r-- | tuning/bluetooth.cpp | 2 | ||||
-rw-r--r-- | tuning/cpufreq.cpp | 4 | ||||
-rw-r--r-- | tuning/ethernet.cpp | 4 | ||||
-rw-r--r-- | tuning/runtime.cpp | 10 | ||||
-rw-r--r-- | tuning/sysfs.cpp | 2 | ||||
-rw-r--r-- | tuning/tunable.cpp | 6 | ||||
-rw-r--r-- | tuning/tunable.h | 2 | ||||
-rw-r--r-- | tuning/tuning.cpp | 2 | ||||
-rw-r--r-- | tuning/usb.cpp | 10 | ||||
-rw-r--r-- | tuning/wifi.cpp | 4 |
31 files changed, 447 insertions, 112 deletions
diff --git a/calibrate/calibrate.cpp b/calibrate/calibrate.cpp index 9acff67..9fe8149 100644 --- a/calibrate/calibrate.cpp +++ b/calibrate/calibrate.cpp @@ -294,7 +294,7 @@ static void *burn_disk(void *dummy) fd = mkstemp(filename); if (fd < 0) { - printf("Cannot create temp file\n"); + printf(_("Cannot create temp file\n")); return NULL; } @@ -313,7 +313,7 @@ static void cpu_calibration(int threads) int i; pthread_t thr; - printf("Calibrating: CPU usage on %i threads\n", threads); + printf(_("Calibrating: CPU usage on %i threads\n"), threads); stop_measurement = 0; for (i = 0; i < threads; i++) @@ -328,7 +328,7 @@ static void wakeup_calibration(unsigned long interval) { pthread_t thr; - printf("Calibrating: CPU wakeup power consumption\n"); + printf(_("Calibrating: CPU wakeup power consumption\n")); stop_measurement = 0; @@ -345,9 +345,9 @@ static void usb_calibration(void) /* chances are one of the USB devices is bluetooth; unrfkill first */ unrfkill_all_radios(); - printf("Calibrating USB devices\n"); + printf(_("Calibrating USB devices\n")); for (i = 0; i < usb_devices.size(); i++) { - printf(".... device %s \n", usb_devices[i].c_str()); + printf(_(".... device %s \n"), usb_devices[i].c_str()); suspend_all_usb_devices(); write_sysfs(usb_devices[i], "on\n"); one_measurement(15); @@ -362,9 +362,9 @@ static void rfkill_calibration(void) { unsigned int i; - printf("Calibrating radio devices\n"); + printf(_("Calibrating radio devices\n")); for (i = 0; i < rfkill_devices.size(); i++) { - printf(".... device %s \n", rfkill_devices[i].c_str()); + printf(_(".... device %s \n"), rfkill_devices[i].c_str()); rfkill_all_radios(); write_sysfs(rfkill_devices[i], "0\n"); one_measurement(15); @@ -372,7 +372,7 @@ static void rfkill_calibration(void) sleep(3); } for (i = 0; i < rfkill_devices.size(); i++) { - printf(".... device %s \n", rfkill_devices[i].c_str()); + printf(_(".... device %s \n"), rfkill_devices[i].c_str()); unrfkill_all_radios(); write_sysfs(rfkill_devices[i], "1\n"); one_measurement(15); @@ -386,10 +386,10 @@ static void backlight_calibration(void) { unsigned int i; - printf("Calibrating backlight\n"); + printf(_("Calibrating backlight\n")); for (i = 0; i < backlight_devices.size(); i++) { char str[4096]; - printf(".... device %s \n", backlight_devices[i].c_str()); + printf(_(".... device %s \n"), backlight_devices[i].c_str()); lower_backlight(); one_measurement(15); sprintf(str, "%i\n", blmax / 4); @@ -410,7 +410,7 @@ static void backlight_calibration(void) lower_backlight(); sleep(1); } - printf("Calibrating idle\n"); + printf(_("Calibrating idle\n")); system("DISPLAY=:0 /usr/bin/xset dpms force off"); one_measurement(15); system("DISPLAY=:0 /usr/bin/xset dpms force on"); @@ -418,7 +418,7 @@ static void backlight_calibration(void) static void idle_calibration(void) { - printf("Calibrating idle\n"); + printf(_("Calibrating idle\n")); system("DISPLAY=:0 /usr/bin/xset dpms force off"); one_measurement(15); system("DISPLAY=:0 /usr/bin/xset dpms force on"); @@ -429,7 +429,7 @@ static void disk_calibration(void) { pthread_t thr; - printf("Calibrating: disk usage \n"); + printf(_("Calibrating: disk usage \n")); set_scsi_link("min_power"); @@ -454,7 +454,7 @@ void calibrate(void) save_sysfs("/sys/modules/snd_hda_intel/parameters/power_save"); - cout << "Starting PowerTOP power estimate calibration \n"; + cout << _("Starting PowerTOP power estimate calibration \n"); suspend_all_usb_devices(); rfkill_all_radios(); lower_backlight(); @@ -477,11 +477,11 @@ void calibrate(void) usb_calibration(); rfkill_calibration(); - cout << "Finishing PowerTOP power estimate calibration \n"; + cout << _("Finishing PowerTOP power estimate calibration \n"); restore_all_sysfs(); learn_parameters(300, 1); - printf("Parameters after calibration:\n"); + printf(_("Parameters after calibration:\n")); dump_parameter_bundle(); save_parameters("saved_parameters.powertop"); save_all_results("saved_results.powertop"); diff --git a/cpu/cpu.cpp b/cpu/cpu.cpp index 4c1fe46..3bd6209 100644 --- a/cpu/cpu.cpp +++ b/cpu/cpu.cpp @@ -71,8 +71,8 @@ static class abstract_cpu * new_package(int package, int cpu, char * vendor, int ret->set_number(package, cpu); ret->childcount = 0; - sprintf(packagename, "cpu package %i", cpu); - cpudev = new class cpudevice("cpu package", packagename, ret); + sprintf(packagename, _("cpu package %i"), cpu); + cpudev = new class cpudevice(_("cpu package"), packagename, ret); all_devices.push_back(cpudev); return ret; } diff --git a/cpu/cpu_core.cpp b/cpu/cpu_core.cpp index 579a1d9..bf969b6 100644 --- a/cpu/cpu_core.cpp +++ b/cpu/cpu_core.cpp @@ -113,7 +113,7 @@ void cpu_core::account_freq(uint64_t freq, uint64_t duration) state->freq = freq; hz_to_human(freq, state->human_name); if (freq == 0) - strcpy(state->human_name, "Idle"); + strcpy(state->human_name, _("Idle")); if (is_turbo(freq, max_frequency, max_minus_one_frequency)) sprintf(state->human_name, _("Turbo Mode")); diff --git a/cpu/cpu_linux.cpp b/cpu/cpu_linux.cpp index a47161c..9ecda79 100644 --- a/cpu/cpu_linux.cpp +++ b/cpu/cpu_linux.cpp @@ -89,7 +89,7 @@ void cpu_linux::measurement_start(void) } if (strcmp(human_name, "C0")==0) - strcpy(human_name, "C0 polling"); + strcpy(human_name, _("C0 polling")); sprintf(filename + len, "/%s/usage", entry->d_name); file.open(filename, ios::in); @@ -326,7 +326,7 @@ void cpu_linux::account_freq(uint64_t freq, uint64_t duration) state->freq = freq; hz_to_human(freq, state->human_name); if (freq == 0) - strcpy(state->human_name, "Idle"); + strcpy(state->human_name, _("Idle")); if (is_turbo(freq, max_frequency, max_minus_one_frequency)) sprintf(state->human_name, _("Turbo Mode")); diff --git a/cpu/cpu_package.cpp b/cpu/cpu_package.cpp index cdd751e..02b6146 100644 --- a/cpu/cpu_package.cpp +++ b/cpu/cpu_package.cpp @@ -142,7 +142,7 @@ void cpu_package::account_freq(uint64_t freq, uint64_t duration) state->freq = freq; hz_to_human(freq, state->human_name); if (freq == 0) - strcpy(state->human_name, "Idle"); + strcpy(state->human_name, _("Idle")); if (is_turbo(freq, max_frequency, max_minus_one_frequency)) sprintf(state->human_name, _("Turbo Mode")); state->after_count = 1; diff --git a/cpu/intel_cpus.cpp b/cpu/intel_cpus.cpp index e59cd76..301592f 100644 --- a/cpu/intel_cpus.cpp +++ b/cpu/intel_cpus.cpp @@ -85,8 +85,8 @@ void nhm_core::measurement_start(void) c6_before = get_msr(first_cpu, MSR_CORE_C6_RESIDENCY); tsc_before = get_msr(first_cpu, MSR_TSC); - insert_cstate("core c3", "C3 (cc3)", 0, c3_before, 1); - insert_cstate("core c6", "C6 (cc6)", 0, c6_before, 1); + insert_cstate("core c3", _("C3 (cc3)"), 0, c3_before, 1); + insert_cstate("core c6", _("C6 (cc6)"), 0, c6_before, 1); sprintf(filename, "/sys/devices/system/cpu/cpu%i/cpufreq/stats/time_in_state", first_cpu); @@ -196,7 +196,7 @@ void nhm_core::account_freq(uint64_t freq, uint64_t duration) state->freq = freq; hz_to_human(freq, state->human_name); if (freq == 0) - strcpy(state->human_name, "Idle"); + strcpy(state->human_name, _("Idle")); if (is_turbo(freq, max_frequency, max_minus_one_frequency)) sprintf(state->human_name, _("Turbo Mode")); @@ -270,7 +270,7 @@ char * nhm_core::fill_pstate_line(int line_nr, char *buffer) } if (line_nr == LEVEL_HEADER) { - sprintf(buffer," Core"); + sprintf(buffer,_(" Core")); return buffer; } @@ -296,7 +296,7 @@ char * nhm_package::fill_pstate_line(int line_nr, char *buffer) if (line_nr == LEVEL_HEADER) { - sprintf(buffer," Package"); + sprintf(buffer,_(" Package")); return buffer; } @@ -320,8 +320,8 @@ void nhm_package::measurement_start(void) c6_before = get_msr(number, MSR_PKG_C6_RESIDENCY); tsc_before = get_msr(first_cpu, MSR_TSC); - insert_cstate("pkg c3", "C3 (pc3)", 0, c3_before, 1); - insert_cstate("pkg c6", "C6 (pc6)", 0, c6_before, 1); + insert_cstate("pkg c3", _("C3 (pc3)"), 0, c3_before, 1); + insert_cstate("pkg c6", _("C6 (pc6)"), 0, c6_before, 1); } void nhm_package::measurement_end(void) @@ -414,7 +414,7 @@ void nhm_package::account_freq(uint64_t freq, uint64_t duration) state->freq = freq; hz_to_human(freq, state->human_name); if (freq == 0) - strcpy(state->human_name, "Idle"); + strcpy(state->human_name, _("Idle")); if (is_turbo(freq, max_frequency, max_minus_one_frequency)) sprintf(state->human_name, _("Turbo Mode")); state->after_count = 1; @@ -486,7 +486,7 @@ void nhm_cpu::measurement_start(void) mperf_before = get_msr(number, MSR_MPERF); tsc_before = get_msr(number, MSR_TSC); - insert_cstate("active", "C0 active", 0, aperf_before, 1); + insert_cstate("active", _("C0 active"), 0, aperf_before, 1); sprintf(filename, "/sys/devices/system/cpu/cpu%i/cpufreq/stats/time_in_state", first_cpu); @@ -545,7 +545,7 @@ void nhm_cpu::measurement_end(void) char * nhm_cpu::fill_pstate_name(int line_nr, char *buffer) { if (line_nr == LEVEL_C0) { - sprintf(buffer, "Actual"); + sprintf(buffer, _("Actual")); return buffer; } return cpu_linux::fill_pstate_name(line_nr, buffer); @@ -562,7 +562,7 @@ char * nhm_cpu::fill_pstate_line(int line_nr, char *buffer) } if (line_nr == LEVEL_HEADER) { - sprintf(buffer," CPU %i", number); + sprintf(buffer,_(" CPU %i"), number); return buffer; } @@ -615,7 +615,7 @@ void nhm_cpu::account_freq(uint64_t freq, uint64_t duration) state->freq = freq; hz_to_human(freq, state->human_name); if (freq == 0) - strcpy(state->human_name, "Idle"); + strcpy(state->human_name, _("Idle")); state->after_count = 1; } diff --git a/devices/ahci.cpp b/devices/ahci.cpp index 1c38e05..510715a 100644 --- a/devices/ahci.cpp +++ b/devices/ahci.cpp @@ -134,9 +134,9 @@ ahci::ahci(char *_name, char *path) diskname = model_name(path, _name); if (strlen(diskname.c_str()) == 0) - sprintf(humanname, "SATA link: %s", _name); + sprintf(humanname, _("SATA link: %s"), _name); else - sprintf(humanname, "SATA disk: %s", diskname.c_str()); + sprintf(humanname, _("SATA disk: %s"), diskname.c_str()); } diff --git a/devices/alsa.cpp b/devices/alsa.cpp index 279a767..3bf4236 100644 --- a/devices/alsa.cpp +++ b/devices/alsa.cpp @@ -74,11 +74,11 @@ alsa::alsa(char *_name, char *path) file.close(); } if (strlen(model) && strlen(vendor)) - sprintf(humanname, "Audio codec %s: %s (%s)", name, model, vendor); + sprintf(humanname, _("Audio codec %s: %s (%s)"), name, model, vendor); else if (strlen(model)) - sprintf(humanname, "Audio codec %s: %s", _name, model); + sprintf(humanname, _("Audio codec %s: %s"), _name, model); else if (strlen(vendor)) - sprintf(humanname, "Audio codec %s: %s", _name, vendor); + sprintf(humanname, _("Audio codec %s: %s"), _name, vendor); } void alsa::start_measurement(void) diff --git a/devices/device.cpp b/devices/device.cpp index 99ed2ff..c03c7af 100644 --- a/devices/device.cpp +++ b/devices/device.cpp @@ -132,22 +132,22 @@ void report_devices(void) pw = global_joules_consumed(); if (pw > 0.0001) { char buf[32]; - wprintw(win, "The battery reports a discharge rate of %sW\n", + wprintw(win, _("The battery reports a discharge rate of %sW\n"), fmt_prefix(pw, buf)); } if (show_power) { char buf[32]; - wprintw(win, "System baseline power is estimated at %sW\n", + wprintw(win, _("System baseline power is estimated at %sW\n"), fmt_prefix(get_parameter_value("base power"), buf)); } if (pw > 0.0001 || show_power) wprintw(win, "\n"); if (show_power) - wprintw(win, "Power est. Usage Device name\n"); + wprintw(win, _("Power est. Usage Device name\n")); else - wprintw(win, " Usage Device name\n"); + wprintw(win, _(" Usage Device name\n")); for (i = 0; i < all_devices.size(); i++) { double P; diff --git a/devices/network.cpp b/devices/network.cpp index 4a74113..eaee371 100644 --- a/devices/network.cpp +++ b/devices/network.cpp @@ -156,7 +156,7 @@ network::network(char *_name, char *path) memset(line, 0, 4096); sprintf(filename, "%s/device/driver", path); if (readlink(filename, line, 4096) > 0) { - sprintf(humanname, "Network interface: %s (%s)",_name, basename(line)); + sprintf(humanname, _("Network interface: %s (%s)"),_name, basename(line)); }; } diff --git a/devices/rfkill.cpp b/devices/rfkill.cpp index c3b3fbf..8562c00 100644 --- a/devices/rfkill.cpp +++ b/devices/rfkill.cpp @@ -60,11 +60,11 @@ rfkill::rfkill(char *_name, char *path) memset(line, 0, 4096); sprintf(filename, "%s/device/driver", path); if (readlink(filename, line, 4096) > 0) { - sprintf(humanname, "Radio device: %s", basename(line)); + sprintf(humanname, _("Radio device: %s"), basename(line)); }; sprintf(filename, "%s/device/device/driver", path); if (readlink(filename, line, 4096) > 0) { - sprintf(humanname, "Radio device: %s", basename(line)); + sprintf(humanname, _("Radio device: %s"), basename(line)); }} void rfkill::start_measurement(void) diff --git a/devices/runtime_pm.cpp b/devices/runtime_pm.cpp index 94ab55a..07e5d11 100644 --- a/devices/runtime_pm.cpp +++ b/devices/runtime_pm.cpp @@ -220,7 +220,7 @@ static void do_bus(const char *bus) if (vendor && device) { char devname[4096]; - sprintf(devname, "PCI Device: %s", pci_id_to_name(vendor, device, filename, 4095)); + sprintf(devname, _("PCI Device: %s"), pci_id_to_name(vendor, device, filename, 4095)); dev->set_human_name(devname); } } diff --git a/devices/usb.cpp b/devices/usb.cpp index f8ef54d..4925d94 100644 --- a/devices/usb.cpp +++ b/devices/usb.cpp @@ -47,7 +47,7 @@ usbdevice::usbdevice(const char *_name, const char *path, const char *devid) strcpy(sysfs_path, path); strcpy(name, _name); strcpy(devname, devid); - sprintf(humanname, "USB Device: %s", pretty_print(devid, vendor, 4096)); + sprintf(humanname, _("USB Device: %s"), pretty_print(devid, vendor, 4096)); active_before = 0; active_after = 0; connected_before = 0; @@ -88,11 +88,11 @@ usbdevice::usbdevice(const char *_name, const char *path, const char *devid) file.close(); }; if (strlen(vendor) && strlen(product)) - sprintf(humanname, "USB device: %s (%s)", product, vendor); + sprintf(humanname, _("USB device: %s (%s)"), product, vendor); else if (strlen(product)) - sprintf(humanname, "USB device: %s", product); + sprintf(humanname, _("USB device: %s"), product); else if (strlen(vendor)) - sprintf(humanname, "USB device: %s", vendor); + sprintf(humanname, _("USB device: %s"), vendor); } diff --git a/devlist.cpp b/devlist.cpp index 6b51b95..a29e0c6 100644 --- a/devlist.cpp +++ b/devlist.cpp @@ -301,9 +301,9 @@ void html_show_open_devices(void) sort(target->begin(), target->end(), devlist_sort); - fprintf(htmlout, "<h2>Process device activity</h2>\n"); + fprintf(htmlout, _("<h2>Process device activity</h2>\n")); fprintf(htmlout, "<table width=100%%>\n"); - fprintf(htmlout, "<tr><th class=\"device\" width=40%%>Process</th><th class=\"device\">Device</th></tr>\n"); + fprintf(htmlout, _("<tr><th class=\"device\" width=40%%>Process</th><th class=\"device\">Device</th></tr>\n")); for (i = 0; i < target->size(); i++) { proc[0] = 0; diff --git a/display.cpp b/display.cpp index 5d48519..0131fdc 100644 --- a/display.cpp +++ b/display.cpp @@ -39,10 +39,11 @@ static int display = 0; vector<string> tab_names; map<string, class tab_window *> tab_windows; +map<string, string> tab_translations; map<string, string> bottom_lines; -void create_tab(string name, class tab_window *w, string bottom_line) +void create_tab(string name, string translation, class tab_window *w, string bottom_line) { if (!w) w = new(class tab_window); @@ -50,6 +51,7 @@ void create_tab(string name, class tab_window *w, string bottom_line) w->win = newpad(1000,1000); tab_names.push_back(name); tab_windows[name] = w; + tab_translations[name] = translation; bottom_lines[name] = bottom_line; } @@ -65,10 +67,10 @@ void init_display(void) use_default_colors(); - create_tab("Overview"); - create_tab("Idle stats"); - create_tab("Frequency stats"); - create_tab("Device stats"); + create_tab("Overview", _("Overview")); + create_tab("Idle stats", _("Idle stats")); + create_tab("Frequency stats", _("Frequency stats")); + create_tab("Device stats", _("Device stats")); display = 1; } @@ -135,7 +137,7 @@ void show_tab(unsigned int tab) wattrset(tab_bar, A_NORMAL); else wattrset(tab_bar, A_REVERSE); - mvwprintw(tab_bar, 0, tab_pos, " %s ", _(tab_names[i].c_str())); + mvwprintw(tab_bar, 0, tab_pos, " %s ", tab_translations[tab_names[i]].c_str()); tab_pos += 3 + tab_names[i].length(); } @@ -65,7 +65,7 @@ WINDOW *get_ncurses_win(const char *name); WINDOW *get_ncurses_win(string name); WINDOW *get_ncurses_win(int nr); -void create_tab(string name, class tab_window *w = NULL, string bottom_line = ""); +void create_tab(string name, string translation, class tab_window *w = NULL, string bottom_line = ""); #endif @@ -230,10 +230,10 @@ void format_watts(double W, char *buffer, unsigned int len) buffer[0] = 0; char buf[32]; - sprintf(buffer, "%7sW", fmt_prefix(W, buf)); + sprintf(buffer, _("%7sW"), fmt_prefix(W, buf)); if (W < 0.0001) - sprintf(buffer, " 0 mW"); + sprintf(buffer, _(" 0 mW")); while (mbstowcs(NULL,buffer,0) < len) @@ -341,9 +341,9 @@ static int pretty_print_init = 0; static void init_pretty_print(void) { - pretty_prints["[12] i8042"] = "PS/2 Touchpad / Keyboard / Mouse"; - pretty_prints["ahci"] = "SATA controller"; - pretty_prints["usb-device-8087-0020"] = "Intel built in USB hub"; + pretty_prints["[12] i8042"] = _("PS/2 Touchpad / Keyboard / Mouse"); + pretty_prints["ahci"] = _("SATA controller"); + pretty_prints["usb-device-8087-0020"] = _("Intel built in USB hub"); } @@ -162,11 +162,15 @@ int main(int argc, char **argv) set_new_handler(out_of_memory); + setlocale (LC_ALL, ""); + bindtextdomain ("powertop", "/usr/share/locale"); + textdomain ("powertop"); + uid = getuid(); if (uid != 0) { - printf("PowerTOP " POWERTOP_VERSION " must be run with root privileges.\n"); - printf("exiting...\n"); + printf(_("PowerTOP " POWERTOP_VERSION " must be run with root privileges.\n")); + printf(_("exiting...\n")); exit(EXIT_FAILURE); } system("/sbin/modprobe cpufreq_stats > /dev/null 2>&1"); @@ -176,13 +180,6 @@ int main(int argc, char **argv) mkdir("/var/cache/powertop", 0600); - setlocale (LC_ALL, ""); - bindtextdomain ("powertop", "/usr/share/locale"); - textdomain ("powertop"); - - - - load_results("/var/cache/powertop/saved_results.powertop"); load_parameters("/var/cache/powertop/saved_parameters.powertop"); @@ -213,7 +210,7 @@ int main(int argc, char **argv) if (argc > 1) { if (strcmp(argv[1], "--html") == 0) { - fprintf(stderr, "Measuring for 20 seconds\n"); + fprintf(stderr, _("Measuring for 20 seconds\n")); /* one to warm up everything */ one_measurement(1); init_html_output("powertop.html"); diff --git a/parameters/persistent.cpp b/parameters/persistent.cpp index 7fc7c0f..069095d 100644 --- a/parameters/persistent.cpp +++ b/parameters/persistent.cpp @@ -40,7 +40,7 @@ void save_all_results(const char *filename) file.open(filename, ios::out); if (!file) { - cout << "Cannot save to file " << filename << "\n"; + cout << _("Cannot save to file ") << filename << "\n"; return; } for (i = 0; i < past_results.size(); i++) { @@ -69,7 +69,7 @@ void load_results(const char *filename) file.open(filename, ios::in); if (!file) { - cout << "Cannot load from file " << filename << "\n"; + cout << _("Cannot load from file ") << filename << "\n"; return; } @@ -113,7 +113,7 @@ void load_results(const char *filename) } file.close(); - printf("Loaded %i prior measurements\n", count); + printf(_("Loaded %i prior measurements\n"), count); } void save_parameters(const char *filename) @@ -127,7 +127,7 @@ void save_parameters(const char *filename) file.open(filename, ios::out); if (!file) { - cout << "Cannot save to file " << filename << "\n"; + cout << _("Cannot save to file ") << filename << "\n"; return; } @@ -149,7 +149,7 @@ void load_parameters(const char *filename) file.open(filename, ios::in); if (!file) { - cout << "Cannot load from file " << filename << "\n"; + cout << _("Cannot load from file ") << filename << "\n"; return; } diff --git a/perf/perf.cpp b/perf/perf.cpp index 29e464c..7cdb2aa 100644 --- a/perf/perf.cpp +++ b/perf/perf.cpp @@ -108,9 +108,9 @@ void perf_event::create_perf_event(char *eventname, int _cpu) if (perf_fd < 0) { reset_display(); - fprintf(stderr, "PowerTOP " POWERTOP_VERSION " needs the kernel to support the 'perf' subsystem\n"); - fprintf(stderr, "as well as support for trace points in the kernel:\n"); - fprintf(stderr, "CONFIG_PERF_EVENTS=y\nCONFIG_PERF_COUNTERS=y\nCONFIG_TRACEPOINTS=y\nCONFIG_TRACING=y\n"); + fprintf(stderr, _("PowerTOP " POWERTOP_VERSION " needs the kernel to support the 'perf' subsystem\n")); + fprintf(stderr, _("as well as support for trace points in the kernel:\n")); + fprintf(stderr, _("CONFIG_PERF_EVENTS=y\nCONFIG_PERF_COUNTERS=y\nCONFIG_TRACEPOINTS=y\nCONFIG_TRACING=y\n")); exit(EXIT_FAILURE); } if (read(perf_fd, &read_data, sizeof(read_data)) == -1) { diff --git a/po/powertop.pot b/po/powertop.pot index 23e8807..13650f0 100644 --- a/po/powertop.pot +++ b/po/powertop.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-01-02 10:20-0800\n" +"POT-Creation-Date: 2011-01-02 10:48-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -21,22 +21,31 @@ msgstr "" msgid " Usage Events/s Category Description\n" msgstr "" +#: devices/device.cpp:150 +msgid " Usage Device name\n" +msgstr "" + +#: lib.cpp:236 +#, c-format +msgid " 0 mW" +msgstr "" + #: cpu/cpu_linux.cpp:231 #, c-format msgid " CPU %i" msgstr "" -#: cpu/cpu_core.cpp:46 cpu/cpu_core.cpp:190 +#: cpu/cpu_core.cpp:46 cpu/cpu_core.cpp:190 cpu/intel_cpus.cpp:273 #, c-format msgid " Core" msgstr "" -#: cpu/cpu_package.cpp:104 +#: cpu/cpu_package.cpp:104 cpu/intel_cpus.cpp:299 #, c-format msgid " Package" msgstr "" -#: display.cpp:128 +#: display.cpp:130 msgid " <ESC> Exit | " msgstr "" @@ -44,7 +53,7 @@ msgstr "" msgid " <ESC> Exit | <Enter> Toggle tunable" msgstr "" -#: cpu/cpu_linux.cpp:289 +#: cpu/cpu_linux.cpp:289 cpu/intel_cpus.cpp:565 #, c-format msgid " CPU %i" msgstr "" @@ -69,11 +78,165 @@ msgstr "" msgid "%6lli Mhz" msgstr "" +#: lib.cpp:233 +#, c-format +msgid "%7sW" +msgstr "" + #: lib.cpp:79 #, c-format msgid "%9lli" msgstr "" +#: tuning/runtime.cpp:49 +#, c-format +msgid "%s device %s has no runtime power management" +msgstr "" + +#: calibrate/calibrate.cpp:350 calibrate/calibrate.cpp:367 +#: calibrate/calibrate.cpp:375 calibrate/calibrate.cpp:392 +#, c-format +msgid ".... device %s \n" +msgstr "" + +#: devlist.cpp:304 +#, c-format +msgid "<h2>Process device activity</h2>\n" +msgstr "" + +#: devlist.cpp:306 +#, c-format +msgid "" +"<tr><th class=\"device\" width=40%%>Process</th><th class=\"device\">Device</" +"th></tr>\n" +msgstr "" + +#: cpu/intel_cpus.cpp:548 +#, c-format +msgid "Actual" +msgstr "" + +#: devices/alsa.cpp:79 devices/alsa.cpp:81 +#, c-format +msgid "Audio codec %s: %s" +msgstr "" + +#: devices/alsa.cpp:77 +#, c-format +msgid "Audio codec %s: %s (%s)" +msgstr "" + +#: tuning/usb.cpp:72 +#, c-format +msgid "Autosuspend for USB device %s (%s)" +msgstr "" + +#: tuning/usb.cpp:74 tuning/usb.cpp:76 +#, c-format +msgid "Autosuspend for USB device %s [%s]" +msgstr "" + +#: tuning/usb.cpp:55 +#, c-format +msgid "Autosuspend for unknown USB device %s (%s:%s)" +msgstr "" + +#: tuning/cpufreq.cpp:42 tuning/ethernet.cpp:50 tuning/runtime.cpp:41 +#: tuning/sysfs.cpp:37 tuning/tunable.cpp:49 tuning/usb.cpp:40 +#: tuning/wifi.cpp:45 +msgid "Bad" +msgstr "" + +#: tuning/bluetooth.cpp:48 +#, c-format +msgid "Bluetooth device interface status" +msgstr "" + +#: cpu/intel_cpus.cpp:489 +msgid "C0 active" +msgstr "" + +#: cpu/cpu_linux.cpp:92 +msgid "C0 polling" +msgstr "" + +#: cpu/intel_cpus.cpp:88 +msgid "C3 (cc3)" +msgstr "" + +#: cpu/intel_cpus.cpp:323 +msgid "C3 (pc3)" +msgstr "" + +#: cpu/intel_cpus.cpp:89 +msgid "C6 (cc6)" +msgstr "" + +#: cpu/intel_cpus.cpp:324 +msgid "C6 (pc6)" +msgstr "" + +#: perf/perf.cpp:113 +#, c-format +msgid "" +"CONFIG_PERF_EVENTS=y\n" +"CONFIG_PERF_COUNTERS=y\n" +"CONFIG_TRACEPOINTS=y\n" +"CONFIG_TRACING=y\n" +msgstr "" + +#: calibrate/calibrate.cpp:348 +#, c-format +msgid "Calibrating USB devices\n" +msgstr "" + +#: calibrate/calibrate.cpp:389 +#, c-format +msgid "Calibrating backlight\n" +msgstr "" + +#: calibrate/calibrate.cpp:413 calibrate/calibrate.cpp:421 +#, c-format +msgid "Calibrating idle\n" +msgstr "" + +#: calibrate/calibrate.cpp:365 +#, c-format +msgid "Calibrating radio devices\n" +msgstr "" + +#: calibrate/calibrate.cpp:316 +#, c-format +msgid "Calibrating: CPU usage on %i threads\n" +msgstr "" + +#: calibrate/calibrate.cpp:331 +#, c-format +msgid "Calibrating: CPU wakeup power consumption\n" +msgstr "" + +#: calibrate/calibrate.cpp:432 +#, c-format +msgid "Calibrating: disk usage \n" +msgstr "" + +#: calibrate/calibrate.cpp:297 +#, c-format +msgid "Cannot create temp file\n" +msgstr "" + +#: parameters/persistent.cpp:72 parameters/persistent.cpp:152 +msgid "Cannot load from file " +msgstr "" + +#: parameters/persistent.cpp:43 parameters/persistent.cpp:130 +msgid "Cannot save to file " +msgstr "" + +#: display.cpp:73 +msgid "Device stats" +msgstr "" + #: tuning/tuning.cpp:61 msgid "Enable Audio codec power management" msgstr "" @@ -89,20 +252,85 @@ msgid "" "\n" msgstr "" -#: main.cpp:269 +#: calibrate/calibrate.cpp:480 +msgid "Finishing PowerTOP power estimate calibration \n" +msgstr "" + +#: display.cpp:72 +msgid "Frequency stats" +msgstr "" + +#: tuning/cpufreq.cpp:42 tuning/ethernet.cpp:50 tuning/runtime.cpp:41 +#: tuning/sysfs.cpp:37 tuning/tunable.cpp:48 tuning/usb.cpp:40 +#: tuning/wifi.cpp:45 +msgid "Good" +msgstr "" + +#: cpu/cpu_core.cpp:116 cpu/cpu_linux.cpp:329 cpu/cpu_package.cpp:145 +#: cpu/intel_cpus.cpp:199 cpu/intel_cpus.cpp:417 cpu/intel_cpus.cpp:618 +msgid "Idle" +msgstr "" + +#: display.cpp:71 +msgid "Idle stats" +msgstr "" + +#: lib.cpp:346 +msgid "Intel built in USB hub" +msgstr "" + +#: main.cpp:266 #, c-format msgid "Leaving PowerTOP\n" msgstr "" +#: parameters/persistent.cpp:116 +#, c-format +msgid "Loaded %i prior measurements\n" +msgstr "" + +#: main.cpp:213 +#, c-format +msgid "Measuring for 20 seconds\n" +msgstr "" + #: tuning/tuning.cpp:63 msgid "NMI watchdog should be turned off" msgstr "" +#: devices/network.cpp:159 +#, c-format +msgid "Network interface: %s (%s)" +msgstr "" + +#: display.cpp:70 +msgid "Overview" +msgstr "" + +#: tuning/runtime.cpp:73 +#, c-format +msgid "PCI Device %s has no runtime power management" +msgstr "" + +#: devices/runtime_pm.cpp:223 +#, c-format +msgid "PCI Device: %s" +msgstr "" + +#: lib.cpp:344 +msgid "PS/2 Touchpad / Keyboard / Mouse" +msgstr "" + #: cpu/cpu_package.cpp:46 #, c-format msgid "Package" msgstr "" +#: calibrate/calibrate.cpp:484 +#, c-format +msgid "Parameters after calibration:\n" +msgstr "" + #: tuning/tuning.cpp:64 msgid "Power Aware CPU scheduler" msgstr "" @@ -111,7 +339,54 @@ msgstr "" msgid "Power est. Usage Events/s Category Description\n" msgstr "" -#: process/do_process.cpp:588 +#: devices/device.cpp:148 +msgid "Power est. Usage Device name\n" +msgstr "" + +#: main.cpp:172 perf/perf.cpp:111 +#, c-format +msgid "PowerTOP " +msgstr "" + +#: devices/rfkill.cpp:63 devices/rfkill.cpp:67 +#, c-format +msgid "Radio device: %s" +msgstr "" + +#: tuning/runtime.cpp:47 +#, c-format +msgid "Runtime PM for %s device %s" +msgstr "" + +#: tuning/runtime.cpp:75 +#, c-format +msgid "Runtime PM for PCI Device %s" +msgstr "" + +#: lib.cpp:345 +msgid "SATA controller" +msgstr "" + +#: devices/ahci.cpp:139 +#, c-format +msgid "SATA disk: %s" +msgstr "" + +#: devices/ahci.cpp:137 +#, c-format +msgid "SATA link: %s" +msgstr "" + +#: calibrate/calibrate.cpp:457 +msgid "Starting PowerTOP power estimate calibration \n" +msgstr "" + +#: devices/device.cpp:141 +#, c-format +msgid "System baseline power is estimated at %sW\n" +msgstr "" + +#: devices/device.cpp:135 process/do_process.cpp:588 #, c-format msgid "The battery reports a discharge rate of %sW\n" msgstr "" @@ -121,12 +396,71 @@ msgstr "" msgid "The estimated remaining time is %i minutes\n" msgstr "" +#: tuning/tuning.cpp:60 +msgid "Tunables" +msgstr "" + #: cpu/cpu_core.cpp:118 cpu/cpu_linux.cpp:331 cpu/cpu_package.cpp:147 #: cpu/intel_cpus.cpp:201 cpu/intel_cpus.cpp:419 #, c-format msgid "Turbo Mode" msgstr "" +#: devices/usb.cpp:50 +#, c-format +msgid "USB Device: %s" +msgstr "" + +#: devices/usb.cpp:93 devices/usb.cpp:95 +#, c-format +msgid "USB device: %s" +msgstr "" + +#: devices/usb.cpp:91 +#, c-format +msgid "USB device: %s (%s)" +msgstr "" + +#: tuning/cpufreq.cpp:42 tuning/ethernet.cpp:50 tuning/runtime.cpp:41 +#: tuning/sysfs.cpp:37 tuning/tunable.cpp:50 tuning/usb.cpp:40 +#: tuning/wifi.cpp:45 +msgid "Unknown" +msgstr "" + +#: tuning/cpufreq.cpp:45 +#, c-format +msgid "Using 'ondemand' cpufreq governor" +msgstr "" + #: tuning/tuning.cpp:65 msgid "VM writeback timeout" msgstr "" + +#: tuning/ethernet.cpp:54 +#, c-format +msgid "Wake-on-lan status for device %s" +msgstr "" + +#: tuning/wifi.cpp:48 +#, c-format +msgid "Wireless Power Saving for interface %s" +msgstr "" + +#: perf/perf.cpp:112 +#, c-format +msgid "as well as support for trace points in the kernel:\n" +msgstr "" + +#: cpu/cpu.cpp:75 +msgid "cpu package" +msgstr "" + +#: cpu/cpu.cpp:74 +#, c-format +msgid "cpu package %i" +msgstr "" + +#: main.cpp:173 +#, c-format +msgid "exiting...\n" +msgstr "" diff --git a/tuning/bluetooth.cpp b/tuning/bluetooth.cpp index 93afdd9..3957316 100644 --- a/tuning/bluetooth.cpp +++ b/tuning/bluetooth.cpp @@ -45,7 +45,7 @@ bt_tunable::bt_tunable(void) : tunable("", 1.0, "Good", "Bad", "Unknown") { - sprintf(desc, "Bluetooth device interface status"); + sprintf(desc, _("Bluetooth device interface status")); } diff --git a/tuning/cpufreq.cpp b/tuning/cpufreq.cpp index ef6f9ec..bf2b8ae 100644 --- a/tuning/cpufreq.cpp +++ b/tuning/cpufreq.cpp @@ -39,10 +39,10 @@ #include "../lib.h" #include "cpufreq.h" -cpufreq_tunable::cpufreq_tunable(void) : tunable("", 0.3, "Good", "Bad", "Unknown") +cpufreq_tunable::cpufreq_tunable(void) : tunable("", 0.3, _("Good"), _("Bad"), _("Unknown")) { string str; - sprintf(desc, "Using 'ondemand' cpufreq governor"); + sprintf(desc, _("Using 'ondemand' cpufreq governor")); str = read_sysfs_string("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"); strcpy(original, str.c_str()); diff --git a/tuning/ethernet.cpp b/tuning/ethernet.cpp index 907f947..b3ac0a5 100644 --- a/tuning/ethernet.cpp +++ b/tuning/ethernet.cpp @@ -47,11 +47,11 @@ #include "../lib.h" #include "ethernet.h" -ethernet_tunable::ethernet_tunable(const char *iface) : tunable("", 0.3, "Good", "Bad", "Unknown") +ethernet_tunable::ethernet_tunable(const char *iface) : tunable("", 0.3, _("Good"), _("Bad"), _("Unknown")) { memset(interf, 0, sizeof(interf)); strncpy(interf, iface, sizeof(interf)); - sprintf(desc, "Wake-on-lan status for device %s", iface); + sprintf(desc, _("Wake-on-lan status for device %s"), iface); } diff --git a/tuning/runtime.cpp b/tuning/runtime.cpp index 0eb3531..03cfa0b 100644 --- a/tuning/runtime.cpp +++ b/tuning/runtime.cpp @@ -38,15 +38,15 @@ #include "../lib.h" #include "../devices/runtime_pm.h" -runtime_tunable::runtime_tunable(const char *path, const char *bus, const char *dev) : tunable("", 0.4, "Good", "Bad", "Unknown") +runtime_tunable::runtime_tunable(const char *path, const char *bus, const char *dev) : tunable("", 0.4, _("Good"), _("Bad"), _("Unknown")) { ifstream file; sprintf(runtime_path, "%s/power/control", path); - sprintf(desc, "Runtime PM for %s device %s", bus, dev); + sprintf(desc, _("Runtime PM for %s device %s"), bus, dev); if (!device_has_runtime_pm(path)) - sprintf(desc, "%s device %s has no runtime power management", bus, dev); + sprintf(desc, _("%s device %s has no runtime power management"), bus, dev); if (strcmp(bus, "pci") == 0) { char filename[4096]; @@ -70,9 +70,9 @@ runtime_tunable::runtime_tunable(const char *path, const char *bus, const char * if (vendor && device) { if (!device_has_runtime_pm(path)) - sprintf(desc, "PCI Device %s has no runtime power management", pci_id_to_name(vendor, device, filename, 4095)); + sprintf(desc, _("PCI Device %s has no runtime power management"), pci_id_to_name(vendor, device, filename, 4095)); else - sprintf(desc, "Runtime PM for PCI Device %s", pci_id_to_name(vendor, device, filename, 4095)); + sprintf(desc, _("Runtime PM for PCI Device %s"), pci_id_to_name(vendor, device, filename, 4095)); } diff --git a/tuning/sysfs.cpp b/tuning/sysfs.cpp index 8f13110..e1742a3 100644 --- a/tuning/sysfs.cpp +++ b/tuning/sysfs.cpp @@ -34,7 +34,7 @@ #include "../lib.h" -sysfs_tunable::sysfs_tunable(const char *str, const char *_sysfs_path, const char *_target_content) : tunable(str, 1.0, "Good", "Bad", "Unknown") +sysfs_tunable::sysfs_tunable(const char *str, const char *_sysfs_path, const char *_target_content) : tunable(str, 1.0, _("Good"), _("Bad"), _("Unknown")) { strcpy(sysfs_path, _sysfs_path); strcpy(target_value, _target_content); diff --git a/tuning/tunable.cpp b/tuning/tunable.cpp index 612e458..74362b4 100644 --- a/tuning/tunable.cpp +++ b/tuning/tunable.cpp @@ -45,8 +45,8 @@ tunable::tunable(void) { score = 0; desc[0] = 0; - strcpy(good_string, "Good"); - strcpy(bad_string, "Bad"); - strcpy(neutral_string, "Unknown"); + strcpy(good_string, _("Good")); + strcpy(bad_string, _("Bad")); + strcpy(neutral_string, _("Unknown")); } diff --git a/tuning/tunable.h b/tuning/tunable.h index 4d3e0f2..a4e994d 100644 --- a/tuning/tunable.h +++ b/tuning/tunable.h @@ -27,6 +27,8 @@ #include <vector> +#include "../lib.h" + using namespace std; #define TUNE_GOOD 1 diff --git a/tuning/tuning.cpp b/tuning/tuning.cpp index 4c9691a..e5c7003 100644 --- a/tuning/tuning.cpp +++ b/tuning/tuning.cpp @@ -57,7 +57,7 @@ void initialize_tuning(void) class tuning_window *w; w = new tuning_window(); - create_tab("Tunables", w, _(" <ESC> Exit | <Enter> Toggle tunable")); + create_tab("Tunables", _("Tunables"), w, _(" <ESC> Exit | <Enter> Toggle tunable")); add_sysfs_tunable(_("Enable Audio codec power management"), "/sys/module/snd_hda_intel/parameters/power_save", "1"); add_sysfs_tunable(_("Enable SATA link power management for /dev/sda"), "/sys/class/scsi_host/host0/link_power_management_policy", "min_power"); add_sysfs_tunable(_("NMI watchdog should be turned off"), "/proc/sys/kernel/nmi_watchdog", "0"); diff --git a/tuning/usb.cpp b/tuning/usb.cpp index f98eb61..22e3702 100644 --- a/tuning/usb.cpp +++ b/tuning/usb.cpp @@ -37,7 +37,7 @@ #include "../lib.h" -usb_tunable::usb_tunable(const char *path, const char *name) : tunable("", 0.9, "Good", "Bad", "Unknown") +usb_tunable::usb_tunable(const char *path, const char *name) : tunable("", 0.9, _("Good"), _("Bad"), _("Unknown")) { ifstream file; char filename[4096]; @@ -52,7 +52,7 @@ usb_tunable::usb_tunable(const char *path, const char *name) : tunable("", 0.9, str1 = read_sysfs_string("%s/idVendor", path); str2 = read_sysfs_string("%s/idProduct", path); - sprintf(desc, "Autosuspend for unknown USB device %s (%s:%s)", name, str1.c_str(), str2.c_str()); + sprintf(desc, _("Autosuspend for unknown USB device %s (%s:%s)"), name, str1.c_str(), str2.c_str()); sprintf(filename, "%s/manufacturer", path); file.open(filename, ios::in); @@ -69,11 +69,11 @@ usb_tunable::usb_tunable(const char *path, const char *name) : tunable("", 0.9, file.close(); }; if (strlen(vendor) && strlen(product)) - sprintf(desc, "Autosuspend for USB device %s (%s)", product, vendor); + sprintf(desc, _("Autosuspend for USB device %s (%s)"), product, vendor); else if (strlen(product)) - sprintf(desc, "Autosuspend for USB device %s [%s]", product, name); + sprintf(desc, _("Autosuspend for USB device %s [%s]"), product, name); else if (strlen(vendor)) - sprintf(desc, "Autosuspend for USB device %s [%s]", vendor, name); + sprintf(desc, _("Autosuspend for USB device %s [%s]"), vendor, name); } int usb_tunable::good_bad(void) diff --git a/tuning/wifi.cpp b/tuning/wifi.cpp index bb106d0..9d64a9f 100644 --- a/tuning/wifi.cpp +++ b/tuning/wifi.cpp @@ -42,10 +42,10 @@ extern "C" { } -wifi_tunable::wifi_tunable(const char *_iface) : tunable("", 1.5, "Good", "Bad", "Unknown") +wifi_tunable::wifi_tunable(const char *_iface) : tunable("", 1.5, _("Good"), _("Bad"), _("Unknown")) { strcpy(iface, _iface); - sprintf(desc, "Wireless Power Saving for interface %s", iface); + sprintf(desc, _("Wireless Power Saving for interface %s"), iface); } int wifi_tunable::good_bad(void) |