i18n-ed Gettexted Scripts In The PET and Hardinfo.
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.
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.
- Attachments
-
- hardinfo.patch.gz
- Patch to Hardinfo to add internationalization.
- (34.21 KiB) Downloaded 784 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
hardinfo.pot
hardinfo.pot uploaded to my collection of pot files
(hardinfo compiled, translated and used, very nice) thank you
(hardinfo compiled, translated and used, very nice) thank you
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
hardinfo
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!
shows that it is correct
Is it my bug (translating) or yours (is it OK in other languages?) ?
--
edited
It is mine!
Code: Select all
LANGUAGE=en hardinfo
- Attachments
-
- hardinfo.png
- missing some values in translated hardinfo
hardinfo from /intrd/pup_ro2 - (39.62 KiB) Downloaded 843 times
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.
- Attachments
-
- capture12338.png
- (38.92 KiB) Downloaded 1056 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
hardinfo
Thanks
so I will dig......
date is strange
Fr Jan 18 18:45:25 2013
so I will dig......
date is strange
Fr Jan 18 18:45:25 2013
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
hardinfo
I have reverted to not translate date and memory
values are permanently refreshed
that are not just messages
---
edited:
same for
"Uptime=...\n"
---
edited:
I see in modules/computer:
computer_get_formatted_uptime()
Both of them seem to be kind of very special things,line 683 in hardinfo.po wrote:"Memory=...\n"
"Maschinentyp=%s\n"
"Betriebssystem=%s\n"
"Benutzer=%s\n"
"Date/Time=...\n"
values are permanently refreshed
that are not just messages
---
edited:
same for
"Uptime=...\n"
---
edited:
I see in modules/computer:
computer_get_formatted_uptime()
- esmourguit
- Posts: 1410
- Joined: Fri 17 Nov 2006, 14:45
- Location: Entre l'ile aux oiseaux.et l'ile de sainte Lucie
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
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
[url=http://moulinier.net/][color=blue][b]Toutou Linux[/b][/color][/url] - [url=http://toutoulinux.free.fr/pet.php][color=blue][b]Paquets français[/b][/color][/url]
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: hardinfo
uptime translatedrodin.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.
coming soon
- Attachments
-
- hardinfo_uptime.png
- hours and minutes translated
- (34.02 KiB) Downloaded 870 times
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.
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
hardinfo
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
It is your baby, I am just the акушер
Changes were made only in modules/computer/uptime.c
Do not forget to add this file in po/POTFILES.in
Would you like to continue using ngettext with other modules ?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;
}
It is your baby, I am just the акушер
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.
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
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.
Hardinfo patched source is here.
- Attachments
-
- hardinfo.patch.gz
- Re-uploaded with small fixes
- (34.56 KiB) Downloaded 886 times
Last edited by rodin.s on Tue 22 Jan 2013, 19:43, edited 1 time in total.
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: Hardinfo new patch
Same with merodin.s wrote:... I do not have a battery on my PC to test if util.c ngettext works correctly but I hope it does.
Thanks for the patch (and the advice how to use it )
Localized Help:
@allmy 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);
}
}
Just insert the green text
and test
- Attachments
-
- hardinfo_help.png
- translated help in file /usr/share/hardinfo/doc/de/index.hlp
- (34.17 KiB) Downloaded 779 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
hardinfo
Found a way to change something (translation) in a static module
Example benchmarks
Example benchmarks
Apply the equivalent for network.c devices.c and computer.cmodules/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;
}
- Attachments
-
- hardinfo_help_about_modules.png
- green underlined line is translated now
- (10.38 KiB) Downloaded 849 times
Hardinfo update
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
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
- Attachments
-
- hardinfo.patch.gz
- (35.96 KiB) Downloaded 874 times
-
- capture8659.png
- (36.31 KiB) Downloaded 1745 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: Hardinfo update
Thanks.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.. .
Scripting Languages
Compiler
Tools
do not translate
I have uploaded updated hardinfo.pot to PortableObjectTemplate Files
Benefit presented with recent HARDINFO update
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"when posted to forum helps those reviewing and providing assistance.
Thanks for this @Rodin.S
Hmmm?? Should Hardinfo has a dedicated thread?
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
Thanks for this @Rodin.S
Hmmm?? Should Hardinfo has a dedicated thread?
hardinfo tranlsations fixed
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
The pet is re-uploaded here: http://ompldr.org/vaGtkdg/hardinfo-0.5.2pre-i486.pet
- Attachments
-
- hardinfo.patch.gz
- New patch to original source
- (35.32 KiB) Downloaded 877 times
- L18L
- Posts: 3479
- Joined: Sat 19 Jun 2010, 18:56
- Location: www.eussenheim.de/
Re: hardinfo tranlsations fixed
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?
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?