Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -Naur /home/max/123/src/hardinfo//hardinfo/hardinfo.c /home/max/123/hardinfo/hardinfo/hardinfo.c
- --- /home/max/123/src/hardinfo//hardinfo/hardinfo.c 2011-03-02 20:22:17.000000000 +0300
- +++ /home/max/123/hardinfo/hardinfo/hardinfo.c 2011-03-02 21:56:53.000000000 +0300
- @@ -32,8 +32,13 @@
- int main(int argc, char **argv)
- {
- + /* gettext init */
- + bindtextdomain ("hardinfo", LOCALEDIR);
- + textdomain ("hardinfo");
- +
- GSList *modules;
- +
- DEBUG("HardInfo version " VERSION ". Debug version.");
- DEBUG("g_thread_init()");
- @@ -45,21 +50,21 @@
- /* show version information and quit */
- if (params.show_version) {
- - g_print("HardInfo version " VERSION "\n");
- + g_print(_("HardInfo version ") VERSION "\n");
- g_print
- - ("Copyright (C) 2003-2009 Leandro A. F. Pereira. See COPYING for details.\n\n");
- + (_("Copyright (C) 2003-2009 Leandro A. F. Pereira. See COPYING for details.\n\n"));
- - g_print("Compile-time options:\n"
- - " Release version: %s (%s)\n"
- - " BinReloc enabled: %s\n"
- - " Data prefix: %s\n"
- - " Library prefix: %s\n"
- - " Compiled on: %s %s (%s)\n",
- - RELEASE ? "Yes" : "No (" VERSION ")", ARCH,
- - ENABLE_BINRELOC ? "Yes" : "No",
- + g_print(_("Compile-time options:\n")
- + _(" Release version: %s (%s)\n")
- + _(" BinReloc enabled: %s\n")
- + _(" Data prefix: %s\n")
- + _(" Library prefix: %s\n")
- + _(" Compiled on: %s %s (%s)\n"),
- + RELEASE ? _("Yes") : "No (" VERSION ")"), ARCH,
- + ENABLE_BINRELOC ? _("Yes") : _("No"),
- PREFIX, LIBPREFIX, PLATFORM, KERNEL, HOSTNAME);
- - DEBUG(" Debugging is enabled.");
- + DEBUG(_(" Debugging is enabled."));
- /* show also available modules */
- params.list_modules = TRUE;
- @@ -67,15 +72,15 @@
- /* initialize the binreloc library, so we can load program data */
- if (!binreloc_init(FALSE))
- - g_error("Failed to find runtime data.\n\n"
- - "\342\200\242 Is HardInfo correctly installed?\n"
- - "\342\200\242 See if %s and %s exists and you have read permision.",
- + g_error(N_("Failed to find runtime data.\n\n")
- + N_("\342\200\242 Is HardInfo correctly installed?\n")
- + N_("\342\200\242 See if %s and %s exists and you have read permision."),
- PREFIX, LIBPREFIX);
- /* list all module names */
- if (params.list_modules) {
- - g_print("Modules:\n"
- - "%-20s%-15s%-12s\n", "File Name", "Name", "Version");
- + g_print(_("Modules:\n")
- + "%-20s%-15s%-12s\n", _("File Name"), _("Name"), _("Version"));
- for (modules = modules_load_all(); modules;
- modules = modules->next) {
- @@ -125,7 +130,7 @@
- result = module_call_method_param("benchmark::runBenchmark", params.run_benchmark);
- if (!result) {
- - g_error("Unknown benchmark ``%s'' or libbenchmark.so not loaded", params.run_benchmark);
- + g_error(_("Unknown benchmark ``%s'' or libbenchmark.so not loaded"), params.run_benchmark);
- } else {
- g_print("%s\n", result);
- g_free(result);
- @@ -153,7 +158,7 @@
- g_free(report);
- } else {
- - g_error("Don't know what to do. Exiting.");
- + g_error(_("Don't know what to do. Exiting."));
- }
- DEBUG("finished");
- diff -Naur /home/max/123/src/hardinfo//hardinfo/util.c /home/max/123/hardinfo/hardinfo/util.c
- --- /home/max/123/src/hardinfo//hardinfo/util.c 2011-03-02 20:22:17.000000000 +0300
- +++ /home/max/123/hardinfo/hardinfo/util.c 2011-03-02 22:29:17.000000000 +0300
- @@ -95,36 +95,36 @@
- minutes %= 60;
- days = hours / 24;
- hours %= 24;
- -
- -#define plural(x) ((x > 1) ? "s" : "")
- +/*
- +* little fuzzy here. if you know how to fix this, ...;
- +* http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
- +*/
- if (days < 1) {
- if (hours < 1) {
- - return g_strdup_printf("%d minute%s", minutes,
- - plural(minutes));
- + return g_strdup_printf(ngettext("%d minute","%d minutes",minutes),minutes);
- } else {
- - return g_strdup_printf("%d hour%s, %d minute%s",
- - hours,
- - plural(hours), minutes,
- - plural(minutes));
- + return g_strdup_printf(ngettext("%d hour, ","%d hours, ",hours),hours,
- + ngettext("%d minute","%d minutes",minutes),minutes);
- }
- }
- - return g_strdup_printf("%d day%s, %d hour%s and %d minute%s",
- - days, plural(days), hours,
- - plural(hours), minutes, plural(minutes));
- + return g_strdup_printf(ngettext("%d day, ","%d days, ",days),
- + ngettext("%d hour and ","%d hours and ",hours)
- + ngettext("%d minute","%d hours",hours),
- +)
- }
- inline gchar *size_human_readable(gfloat size)
- {
- if (size < KiB)
- - return g_strdup_printf("%.1f B", size);
- + return g_strdup_printf(_("%.1f B"), size);
- if (size < MiB)
- - return g_strdup_printf("%.1f KiB", size / KiB);
- + return g_strdup_printf(_("%.1f KiB"), size / KiB);
- if (size < GiB)
- - return g_strdup_printf("%.1f MiB", size / MiB);
- + return g_strdup_printf(_("%.1f MiB"), size / MiB);
- - return g_strdup_printf("%.1f GiB", size / GiB);
- + return g_strdup_printf(_("%.1f GiB"), size / GiB);
- }
- inline char *strend(gchar * str, gchar chr)
- @@ -279,8 +279,7 @@
- g_error_free(error);
- }
- - DEBUG("%strying hardcoded paths.",
- - try_hardcoded ? "" : "binreloc init failed. ");
- + DEBUG("%strying hardcoded paths.", try_hardcoded ? "" : "binreloc init failed. ");
- } else {
- /* If we were able to initialize BinReloc, build the default data
- and library paths. */
- @@ -338,7 +337,7 @@
- if (!params.gui_running) {
- /* No GUI running: spit the message to the terminal */
- g_print("\n\n*** %s: %s\n\n",
- - (log_level & G_LOG_FLAG_FATAL) ? "Error" : "Warning",
- + (log_level & G_LOG_FLAG_FATAL) ? _("Error") : _("Warning"),
- message);
- } else {
- /* Hooray! We have a GUI running! */
- @@ -353,8 +352,8 @@
- "<big><b>%s</b></big>\n\n%s",
- (log_level &
- G_LOG_FLAG_FATAL) ?
- - "Fatal Error" :
- - "Warning", message);
- + _("Fatal Error") :
- + _("Warning"), message);
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
- @@ -378,51 +377,51 @@
- .short_name = 'r',
- .arg = G_OPTION_ARG_NONE,
- .arg_data = &create_report,
- - .description = "creates a report and prints to standard output"},
- + .description = N_("creates a report and prints to standard output")},
- {
- .long_name = "report-format",
- .short_name = 'f',
- .arg = G_OPTION_ARG_STRING,
- .arg_data = &report_format,
- - .description = "chooses a report format (text, html)"},
- + .description = N_("chooses a report format (text, html)")},
- {
- .long_name = "run-benchmark",
- .short_name = 'b',
- .arg = G_OPTION_ARG_STRING,
- .arg_data = &run_benchmark,
- - .description = "run benchmark; requires benchmark.so to be loaded"},
- + .description = N_("run benchmark; requires benchmark.so to be loaded")},
- {
- .long_name = "list-modules",
- .short_name = 'l',
- .arg = G_OPTION_ARG_NONE,
- .arg_data = &list_modules,
- - .description = "lists modules"},
- + .description = N_("lists modules")},
- {
- .long_name = "load-module",
- .short_name = 'm',
- .arg = G_OPTION_ARG_STRING_ARRAY,
- .arg_data = &use_modules,
- - .description = "specify module to load"},
- + .description = N_("specify module to load")},
- {
- .long_name = "autoload-deps",
- .short_name = 'a',
- .arg = G_OPTION_ARG_NONE,
- .arg_data = &autoload_deps,
- - .description = "automatically load module dependencies"},
- + .description = N_("automatically load module dependencies")},
- #ifdef HAS_LIBSOUP
- {
- .long_name = "xmlrpc-server",
- .short_name = 'x',
- .arg = G_OPTION_ARG_NONE,
- .arg_data = &run_xmlrpc_server,
- - .description = "run in XML-RPC server mode"},
- + .description = N_("run in XML-RPC server mode")},
- #endif /* HAS_LIBSOUP */
- {
- .long_name = "version",
- .short_name = 'v',
- .arg = G_OPTION_ARG_NONE,
- .arg_data = &show_version,
- - .description = "shows program version and quit"},
- + .description = N_("shows program version and quit")},
- {NULL}
- };
- GOptionContext *ctx;
- @@ -437,8 +436,8 @@
- g_option_context_free(ctx);
- if (*argc >= 2) {
- - g_print("Unrecognized arguments.\n"
- - "Try ``%s --help'' for more information.\n", *(argv)[0]);
- + g_print(_("Unrecognized arguments.\n")
- + _("Try ``%s --help'' for more information.\n"), *(argv)[0]);
- exit(1);
- }
- @@ -503,7 +502,7 @@
- browser = (gchar *)browsers[i++];
- } while (browser);
- - g_warning("Couldn't find a Web browser to open URL %s.", url);
- + g_warning(_("Couldn't find a Web browser to open URL %s."), url);
- }
- /* Copyright: Jens Låås, SLU 2002 */
- @@ -850,7 +849,7 @@
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- - "Module \"%s\" depends on module \"%s\", load it?",
- + _("Module \"%s\" depends on module \"%s\", load it?"),
- module->name,
- deps[i]);
- gtk_dialog_add_buttons(GTK_DIALOG(dialog),
- @@ -867,13 +866,13 @@
- modules = g_slist_prepend(modules, mod);
- modules = modules_check_deps(modules); /* re-check dependencies */
- } else {
- - g_error("HardInfo cannot run without loading the additional module.");
- + g_error(_("HardInfo cannot run without loading the additional module."));
- exit(1);
- }
- gtk_widget_destroy(dialog);
- } else {
- - g_error("Module \"%s\" depends on module \"%s\".",
- + g_error(_("Module \"%s\" depends on module \"%s\"."),
- module->name, deps[i]);
- }
- }
- @@ -918,12 +917,13 @@
- if (g_slist_length(modules) == 0) {
- if (params.use_modules == NULL) {
- g_error
- - ("No module could be loaded. Check permissions on \"%s\" and try again.",
- + (_("No module could be loaded. Check permissions on \"%s\" and try again."),
- params.path_lib);
- } else {
- g_error
- - ("No module could be loaded. Please use hardinfo -l to list all avai"
- - "lable modules and try again with a valid module list.");
- + (_("No module could be loaded. Please use hardinfo -l to list all avai"
- + "lable modules and try again with a valid module list.")
- +);
- }
- }
- @@ -1100,7 +1100,7 @@
- if (i == except_entry)
- continue;
- - text = g_strdup_printf("Scanning: %s...", entry.name);
- + text = g_strdup_printf("_(Scanning: %s..."), entry.name);
- shell_status_update(text);
- g_free(text);
- diff -Naur /home/max/123/src/hardinfo//includes/hardinfo.h /home/max/123/hardinfo/includes/hardinfo.h
- --- /home/max/123/src/hardinfo//includes/hardinfo.h 2011-03-02 20:22:17.000000000 +0300
- +++ /home/max/123/hardinfo/includes/hardinfo.h 2011-03-02 21:09:43.000000000 +0300
- @@ -19,6 +19,7 @@
- #ifndef __HARDINFO_H__
- #define __HARDINFO_H__
- +#include <glib/gi18n-lib.h>
- #include <gtk/gtk.h>
- #include "config.h"
- #include "shell.h"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement