Page 1 of 3

Hardinfo

Posted: Wed 16 Jan 2013, 16:16
by rodin.s
Hello, Barry.
I have patched source from latest git: http://ompldr.org/vaDNraQ/hardinfo.tar.gz
I do not have Wary with devx now but I've managed to compile it in Precise-5.4.2 and in Racy-5.3.90. Racy is a close relative to Wary, I guess.
The file 'hardinfo.po' in 'po' directory is for Russian. Delete it or rename as ru.po.

hardinfo.pot

Posted: Thu 17 Jan 2013, 16:33
by L18L
hardinfo.pot uploaded to my collection of pot files :D
(hardinfo compiled, translated and used, very nice) thank you

hardinfo

Posted: Fri 18 Jan 2013, 10:54
by L18L
Before I am going to dig deeper just one question:
Is it my bug (translating) or yours (is it OK in other languages?) ?

--

edited

It is mine!

Code: Select all

LANGUAGE=en hardinfo
shows that it is correct

hardinfo

Posted: Fri 18 Jan 2013, 16:00
by rodin.s
As far as I remember I didn't translate these items: memory, date/time, uptime, load average. I noticed that these items are not updated when translated so I left them in English and even switched that part of code to LANG=C.

hardinfo

Posted: Fri 18 Jan 2013, 17:44
by L18L
Thanks
so I will dig......
date is strange

Fr Jan 18 18:45:25 2013 :roll:

hardinfo

Posted: Fri 18 Jan 2013, 18:02
by L18L
I have reverted to not translate date and memory
line 683 in hardinfo.po wrote:"Memory=...\n"
"Maschinentyp=%s\n"
"Betriebssystem=%s\n"
"Benutzer=%s\n"
"Date/Time=...\n"
Both of them seem to be kind of very special things,
values are permanently refreshed
that are not just messages

---
edited:
same for
"Uptime=...\n"
---
edited:
I see in modules/computer:
computer_get_formatted_uptime() :wink:

Posted: Sun 20 Jan 2013, 10:36
by esmourguit
Bonjour à toutes et tous,

I made french hardinfo.po then .mo files, but there is a little difference between the two versions of hardinfo executables files.
The ancient (original Precise 5.4.3) hardinfo executable file displays date and time in french and no translations in french (that seems normal), but the new one (from BK blog from today january 20th) displays date and time in english, while all is in french.

And the second one recognize the Operating System...

Cordialement ;)

Re: hardinfo

Posted: Sun 20 Jan 2013, 19:25
by L18L
rodin.s wrote:As far as I remember I didn't translate these items: memory, date/time, uptime, load average. I noticed that these items are not updated when translated so I left them in English and even switched that part of code to LANG=C.
uptime translated :idea:

coming soon :!:

Uptime

Posted: Sun 20 Jan 2013, 20:33
by rodin.s
Did you add any additional gettext lines somewhere for this? I remember it was hard thing for me to do. It was a place where I should have used ngettext for correct translation but in that case it was necessary to rewrite all code in uptime.c. Also I wanted minimal changes to original code not to break something so I decided to leave it in English as well.

hardinfo

Posted: Mon 21 Jan 2013, 09:13
by L18L
It was just try and try and try.... (never learned C)

Changes were made only in modules/computer/uptime.c
Do not forget to add this file in po/POTFILES.in
modules/computer/uptime.c wrote:/*
* HardInfo - Displays System Information
* Copyright (C) 2003-2006 Leandro A. F. Pereira <leandro@hardinfo.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* TODO: done: 2012-01-21 ngettext for days, hours, minutes */

#include "hardinfo.h"
#include "computer.h"

UptimeInfo *
computer_get_uptime(void)
{
UptimeInfo *ui = g_new0(UptimeInfo, 1);
FILE *procuptime;
gulong minutes;

if ((procuptime = fopen("/proc/uptime", "r")) != NULL) {
(void)fscanf(procuptime, "%lu", &minutes);
ui->minutes = minutes / 60;
fclose(procuptime);
} else {
return NULL;
}

ui->hours = ui->minutes / 60;
ui->minutes %= 60;
ui->days = ui->hours / 24;
ui->hours %= 24;

return ui;
}

gchar *
computer_get_formatted_uptime()
{
setlocale(LC_ALL, "");

UptimeInfo *ui;
gchar *tmp;
ui = computer_get_uptime();

if (ui->days < 1) {
if (ui->hours < 1) {
tmp =
g_strdup_printf("%s",
g_strdup_printf (ngettext ("%d minute", "%d minutes", ui->minutes), ui->minutes)

);
} else {
tmp =
g_strdup_printf("%s %s",
g_strdup_printf (ngettext ("%d hour", "%d hours", ui->hours), ui->hours),
g_strdup_printf (ngettext ("%d minute", "%d minutes", ui->minutes), ui->minutes)
);
}
} else {
tmp =
g_strdup_printf("%s %s %s",
g_strdup_printf (ngettext ("%d day", "%d days", ui->days), ui->days),
g_strdup_printf (ngettext ("%d hour", "%d hours", ui->hours), ui->hours),
g_strdup_printf (ngettext ("%d minute", "%d minutes", ui->minutes), ui->minutes)
);
}

g_free(ui);

setlocale(LC_ALL, "C"); //Load Average is not updated if locale is not C, swithc locale to C

return tmp;
}
Would you like to continue using ngettext with other modules ?
It is your baby, I am just the акушер :lol:

Hardinfo and ngettext

Posted: Mon 21 Jan 2013, 10:53
by rodin.s
Thank you, it works great. I actually used ngettext in hardinfo/util.c, but now I understand that I have made a mistake there and printf doesn't work that way. Now I see that function seconds_to_string is used in modules/devices/battery.c. It will work OK with minutes, but there will be an error with hours and days. I guess I can use your code there directly.

Re: Hardinfo and ngettext

Posted: Mon 21 Jan 2013, 11:08
by L18L
:D

Hardinfo new patch

Posted: Mon 21 Jan 2013, 13:02
by rodin.s
Ok, I have made a patch for Hardinfo with fixes in ngettext in util.c and added ngettext in uptime.c. I have also changed position of "LANG=C" for LoadAverage and Date/Time is now displayed in local language. I do not have a battery on my PC to test if util.c ngettext works correctly but I hope it does.
Hardinfo patched source is here.

Re: Hardinfo new patch

Posted: Tue 22 Jan 2013, 18:35
by L18L
rodin.s wrote:... I do not have a battery on my PC to test if util.c ngettext works correctly but I hope it does.
Same with me :)

Thanks for the patch (and the advice how to use it :) )

Localized Help:
my changed function in shell/callbacks.c wrote: void cb_open_online_docs()
{
Shell *shell;

shell = shell_get_main_shell();
if (shell->help_viewer) {
help_viewer_open_page(shell->help_viewer, "index.hlp");
} else {
gchar *help_dir;

help_dir = g_build_filename(params.path_data, "doc", NULL);

gchar *lang_ptr, *lang, *lang1, *lang2;
lang_ptr = getenv ("LANG");
lang = g_strdup_printf("%s", lang_ptr); /* ex: pt_BR.utf-8 */
lang2 = lang;
lang2 = strtok(lang2, "_"); /* ex: pt */

if (lang2 != "en") {
lang1 = strtok(lang, "."); /* ex: pt_BR */
help_dir = g_build_filename(help_dir, lang1, NULL);
if (!g_file_test(help_dir, G_FILE_TEST_EXISTS)) {
help_dir = g_build_filename(params.path_data, "doc", NULL);
help_dir = g_build_filename(help_dir, lang2, NULL);
if (!g_file_test(help_dir, G_FILE_TEST_EXISTS)) {
help_dir = g_build_filename(params.path_data, "doc", NULL);
}

}
}

shell->help_viewer = help_viewer_new(help_dir, "index.hlp");

g_free(help_dir);

}
}
@all
Just insert the green text
and test

hardinfo

Posted: Wed 23 Jan 2013, 12:31
by L18L
Found a way to change something (translation) in a static module
Example benchmarks
modules/benchmark.c wrote:ModuleAbout *hi_module_get_about(void)
{
static ModuleAbout ma[] = {
{
.author = "Leandro A. F. Pereira",
.description = "Perform tasks and compare with other systems",
.version = VERSION,
.license = "GNU GPL version 2"}
};
ma->description = _("Perform tasks and compare with other systems");
return ma;
}
Apply the equivalent for network.c devices.c and computer.c

Hardinfo update

Posted: Thu 21 Feb 2013, 21:31
by rodin.s
I have made some changes to Hardinfo. Now it can display distro name and version number. I have also applied ideas of L18L above. Thanks.
I have made a pet with new2dir: http://ompldr.org/vaGpvbQ/hardinfo-0.5.2pre-i486.pet
Source directory: http://ompldr.org/vaGpveA/hardinfo-i18n.tar.gz

Re: Hardinfo update

Posted: Fri 22 Feb 2013, 15:31
by L18L
rodin.s wrote:I have made some changes to Hardinfo. Now it can display distro name and version number. I have also applied ideas of L18L above.. .
Thanks.

Scripting Languages
Compiler
Tools

do not translate :cry:

I have uploaded updated hardinfo.pot to PortableObjectTemplate Files

Benefit presented with recent HARDINFO update

Posted: Fri 22 Feb 2013, 20:54
by gcmartin
This helps community, at large. Hardinfo presents in its top 2 pages system identity information that was not present before on 32bit PUPs built with WOOF.

This is helpful when members post their system's behavior so that its known which distro & version is being presented.

In addition, the following terminal command creates a report, "PUPPY_System_Report.txt.gz"

Code: Select all

# hardinfo -r >> PUPPY_System_Report.txt.gz
when posted to forum helps those reviewing and providing assistance.

Thanks for this @Rodin.S

Hmmm?? Should Hardinfo has a dedicated thread?

hardinfo tranlsations fixed

Posted: Sat 23 Feb 2013, 20:59
by rodin.s
I have fixed translations of Development section. Thank you.
The pet is re-uploaded here: http://ompldr.org/vaGtkdg/hardinfo-0.5.2pre-i486.pet

Re: hardinfo tranlsations fixed

Posted: Sun 24 Feb 2013, 07:16
by L18L
One idea leads to another:

Should not exist a choice for language in generated reports to be locale OR English (sent to developer)?

@BarryK, would you like to get Arabic reports? :wink: