The time now is Tue 21 May 2013, 08:05
All times are UTC - 4 |
| Author |
Message |
rodin.s
Joined: 22 Sep 2010 Posts: 321 Location: Ukraine
|
Posted: Wed 16 Jan 2013, 12:16 Post subject:
Hardinfo |
|
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.
| Description |
Patch to Hardinfo to add internationalization.
|

Download |
| Filename |
hardinfo.patch.gz |
| Filesize |
34.21 KB |
| Downloaded |
70 Time(s) |
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Thu 17 Jan 2013, 12:33 Post subject:
hardinfo.pot |
|
hardinfo.pot uploaded to my collection of pot files
(hardinfo compiled, translated and used, very nice) thank you
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Fri 18 Jan 2013, 06:54 Post subject:
hardinfo Subject description: is it my bug or yours? |
|
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: | | LANGUAGE=en hardinfo |
shows that it is correct
| Description |
missing some values in translated hardinfo hardinfo from /intrd/pup_ro2 |
| Filesize |
39.62 KB |
| Viewed |
332 Time(s) |

|
|
|
Back to top
|
|
 |
rodin.s
Joined: 22 Sep 2010 Posts: 321 Location: Ukraine
|
Posted: Fri 18 Jan 2013, 12:00 Post subject:
hardinfo |
|
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.
| Description |
|
| Filesize |
38.92 KB |
| Viewed |
324 Time(s) |

|
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Fri 18 Jan 2013, 13:44 Post subject:
hardinfo Subject description: date..... |
|
Thanks
so I will dig......
date is strange
Fr Jan 18 18:45:25 2013
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Fri 18 Jan 2013, 14:02 Post subject:
hardinfo Subject description: date memory |
|
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()
|
|
Back to top
|
|
 |
esmourguit
Joined: 17 Nov 2006 Posts: 1151 Location: Sur l'ile aux oiseaux.
|
Posted: Sun 20 Jan 2013, 06:36 Post subject:
|
|
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
| Description |
|
| Filesize |
33.59 KB |
| Viewed |
276 Time(s) |

|
| Description |
|
| Filesize |
40.21 KB |
| Viewed |
277 Time(s) |

|
_________________ Toutou Linux - Pets francisés
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Sun 20 Jan 2013, 15:25 Post subject:
Re: hardinfo Subject description: uptime |
|
| 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
coming soon
| Description |
hours and minutes translated |
| Filesize |
34.02 KB |
| Viewed |
247 Time(s) |

|
|
|
Back to top
|
|
 |
rodin.s
Joined: 22 Sep 2010 Posts: 321 Location: Ukraine
|
Posted: Sun 20 Jan 2013, 16:33 Post subject:
Uptime |
|
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.
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Mon 21 Jan 2013, 05:13 Post subject:
hardinfo Subject description: uptime |
|
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 акушер
|
|
Back to top
|
|
 |
rodin.s
Joined: 22 Sep 2010 Posts: 321 Location: Ukraine
|
Posted: Mon 21 Jan 2013, 06:53 Post subject:
Hardinfo and ngettext |
|
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.
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Mon 21 Jan 2013, 07:08 Post subject:
Re: Hardinfo and ngettext |
|
|
|
Back to top
|
|
 |
rodin.s
Joined: 22 Sep 2010 Posts: 321 Location: Ukraine
|
Posted: Mon 21 Jan 2013, 09:02 Post subject:
Hardinfo new patch |
|
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.
| Description |
Re-uploaded with small fixes
|

Download |
| Filename |
hardinfo.patch.gz |
| Filesize |
34.56 KB |
| Downloaded |
79 Time(s) |
Last edited by rodin.s on Tue 22 Jan 2013, 15:43; edited 1 time in total
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Tue 22 Jan 2013, 14:35 Post subject:
Re: Hardinfo new patch Subject description: new Help |
|
| 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
| Description |
translated help in file /usr/share/hardinfo/doc/de/index.hlp |
| Filesize |
34.17 KB |
| Viewed |
184 Time(s) |

|
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1709 Location: Burghaslach, Germany
|
Posted: Wed 23 Jan 2013, 08:31 Post subject:
hardinfo Subject description: about modules |
|
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
| Description |
green underlined line is translated now |
| Filesize |
10.38 KB |
| Viewed |
165 Time(s) |

|
|
|
Back to top
|
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|