All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: gettext: commands/*
Date: Tue, 08 Dec 2009 00:23:00 +0100	[thread overview]
Message-ID: <4B1D8E54.5010702@gmail.com> (raw)
In-Reply-To: <20091206182228.GA15091@pina.cat>

[-- Attachment #1: Type: text/plain, Size: 15300 bytes --]

Carles Pina i Estany wrote:
> Hello,
>
> I've started to add gettext support in commands/*
>
> See the attached patch and ChangeLog.
>
> It's not completely exhaustive (hdparm is not in this patch).
>
> Comments before committing?
>
> Notice the the grub_register_command use N_(" ") and then these strings
> gets registered in commands/help.c when they are gonna to be on the
> screen.
>
> I've tried to translate grub_register_command and the obvious
> grub_printf. Maybe some more things need to be translated (other strings
> for example). It will be, but I would like to add gettext support to the
> 90% of the strings soon so the translators can start to work on it (and
> finish everything of course).
>
>   

I've spotted some messages which may be unclear.
@@ -186,7 +187,7 @@ GRUB_MOD_INIT(boot)
 {
   cmd_boot =
     grub_register_command ("boot", grub_cmd_boot,
-			   0, "boot an operating system");
+			   0, N_("boot an operating system"));
 }
This isn't space-constrained anymore. Capitalizing first letter and putting a dot at the will make it nicer and inform translator that it's a whole sentence.
 
@@ -40,7 +41,7 @@ grub_cmd_cmp (grub_command_t cmd __attri
   if (argc != 2)
     return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
 
-  grub_printf ("Compare `%s' and `%s':\n", args[0],
+  grub_printf (_("Compare `%s' and `%s':\n"), args[0],
 	       args[1]);
Translator won't know if %s's are files or some other entities.
"Compare file '%s' with '%s':\n" would be an improvement. BTW here you can use printf_ too.
 
@@ -49,7 +50,7 @@ grub_cmd_cmp (grub_command_t cmd __attri
     goto cleanup;
 
   if (grub_file_size (file1) != grub_file_size (file2))
-    grub_printf ("Differ in size: %llu [%s], %llu [%s]\n",
+    grub_printf (_("Differ in size: %llu [%s], %llu [%s]\n"),
 		 (unsigned long long) grub_file_size (file1), args[0],
 		 (unsigned long long) grub_file_size (file2), args[1]);
   else
Same. Message is unclear.
@@ -76,7 +77,7 @@ grub_cmd_cmp (grub_command_t cmd __attri
 	    {
 	      if (buf1[i] != buf2[i])
 		{
-		  grub_printf ("Differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n",
+		  grub_printf (_("Differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n"),
 			       (unsigned long long) (i + pos), buf1[i], args[0],
 			       buf2[i], args[1]);
 		  goto cleanup;
Same
=== modified file 'commands/efi/fixvideo.c'
--- commands/efi/fixvideo.c	2009-05-04 03:49:08 +0000
+++ commands/efi/fixvideo.c	2009-12-06 16:39:59 +0000
@@ -22,6 +22,7 @@
 #include <grub/file.h>
 #include <grub/pci.h>
 #include <grub/command.h>
+#include <grub/i18n.h>
 
 static struct grub_video_patch
 {
@@ -53,24 +54,24 @@ scan_card (int bus, int dev, int func, g
 	    {
 	      grub_target_addr_t base;
 
-	      grub_printf ("Found graphic card: %s\n", p->name);
+	      grub_printf (_("Found graphic card: %s\n"), p->name);
 	      addr += 8 + p->mmio_bar * 4;
 	      base = grub_pci_read (addr);
 	      if ((! base) || (base & GRUB_PCI_ADDR_SPACE_IO) ||
 		  (base & GRUB_PCI_ADDR_MEM_PREFETCH))
-		grub_printf ("Invalid MMIO bar %d\n", p->mmio_bar);
+		grub_printf (_("Invalid MMIO bar %d\n"), p->mmio_bar);
 	      else
 		{
 		  base &= GRUB_PCI_ADDR_MEM_MASK;
 		  base += p->mmio_reg;
 
 		  if (*((volatile grub_uint32_t *) base) != p->mmio_old)
-		    grub_printf ("Old value don't match\n");
+		    grub_printf (_("Old value don't match\n"));
 		  else
 		    {
 		      *((volatile grub_uint32_t *) base) = 0;
 		      if (*((volatile grub_uint32_t *) base))
-			grub_printf ("Set MMIO fails\n");
+			grub_printf (_("Set MMIO fails\n"));
 		    }
 		}
 
@@ -79,7 +80,7 @@ scan_card (int bus, int dev, int func, g
 	  p++;
 	}
 
-      grub_printf ("Unknown graphic card: %x\n", pciid);
+      grub_printf (_("Unknown graphic card: %x\n"), pciid);
     }
 
   return 0;
This part contains incorrect English. Moreover these strings convey technical data and I don't think they are worth translating. Actually I'll eliminate fixvideo once we have setpci
@@ -99,7 +100,7 @@ static grub_command_t cmd_fixvideo;
 GRUB_MOD_INIT(fixvideo)
 {
   cmd_fixvideo = grub_register_command ("fix_video", grub_cmd_fixvideo,
-					0, "Fix video problem.");
+					0, _N("Fix video problem."));
 
Another unclear message. Just let this file be until we remove it.
 }
 

=== modified file 'commands/efi/loadbios.c'
--- commands/efi/loadbios.c	2009-06-10 23:47:49 +0000
+++ commands/efi/loadbios.c	2009-12-06 16:43:12 +0000
@@ -23,6 +23,7 @@
 #include <grub/efi/efi.h>
 #include <grub/pci.h>
 #include <grub/command.h>
+#include <grub/i18n.h>
 
 static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
 static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
@@ -45,7 +46,7 @@ enable_rom_area (void)
   rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
   if (*rom_ptr != BLANK_MEM)
     {
-      grub_printf ("ROM image present.\n");
+      grub_printf (_("ROM image present.\n"));
Incorrect English.
       return 0;
     }
 
@@ -62,7 +63,7 @@ enable_rom_area (void)
   *rom_ptr = 0;
   if (*rom_ptr != 0)
     {
-      grub_printf ("Can\'t enable rom area.\n");
+      grub_printf (_("Can\'t enable rom area.\n"));
Unclear 
       return 0;
     }
 
@@ -199,11 +200,11 @@ static grub_command_t cmd_fakebios, cmd_
 GRUB_MOD_INIT(loadbios)
 {
   cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios,
-					0, "fake bios.");
+					0, _N("fake bios."));
 
Unclear.
   cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
-					"loadbios BIOS_DUMP [INT10_DUMP]",
-					"Load bios dump.");
+					_N("loadbios BIOS_DUMP [INT10_DUMP]"),
+					_N("Load bios dump."));
 }
 
 GRUB_MOD_FINI(loadbios)

=== modified file 'commands/handler.c'
--- commands/handler.c	2009-05-04 03:49:08 +0000
+++ commands/handler.c	2009-12-06 17:17:28 +0000
@@ -23,6 +23,7 @@
 #include <grub/term.h>
 #include <grub/handler.h>
 #include <grub/command.h>
+#include <grub/i18n.h>
 
 static grub_err_t
 grub_cmd_handler (struct grub_command *cmd,
@@ -95,16 +96,16 @@ GRUB_MOD_INIT(handler)
 {
   cmd_handler =
     grub_register_command ("handler", grub_cmd_handler,
-			   "handler [class [handler]]",
-			   "List or select a handler");
+			   N_("handler [class [handler]]"),
+			   N_("List or select a handler"));
   cmd_terminal_input =
     grub_register_command ("terminal_input", grub_cmd_handler,
-			   "terminal_input [handler]",
-			   "List or select a handler");
+			   N_("terminal_input [handler]"),
+			   N_("List or select a handler"));
   cmd_terminal_output =
     grub_register_command ("terminal_output", grub_cmd_handler,
-			   "terminal_output [handler]",
-			   "List or select a handler");
+			   N_("terminal_output [handler]"),
+			   N_("List or select a handler"));
Help messages are both unclear and in last 2 cases incorrect
 }
 
 GRUB_MOD_FINI(handler)

@@ -94,8 +95,8 @@ GRUB_MOD_INIT(help)
 {
   cmd = grub_register_extcmd ("help", grub_cmd_help,
 			      GRUB_COMMAND_FLAG_CMDLINE,
-			      "help [PATTERN ...]",
-			      "Show a help message.", 0);
+			      N_("help [PATTERN ...]"),
+			      N_("Show a help message."), 0);
 }
 
 GRUB_MOD_FINI(help)

=== modified file 'commands/i386/pc/vbeinfo.c'
--- commands/i386/pc/vbeinfo.c	2009-06-10 21:04:23 +0000
+++ commands/i386/pc/vbeinfo.c	2009-12-06 17:17:52 +0000
@@ -51,14 +52,15 @@ grub_cmd_vbeinfo (grub_command_t cmd __a
   if (err != GRUB_ERR_NONE)
     return err;
 
-  grub_printf ("VBE info:   version: %d.%d  OEM software rev: %d.%d\n",
+  grub_printf (_("VBE info:   version: %d.%d  OEM software rev: %d.%d\n"),
 	       controller_info.version >> 8,
                controller_info.version & 0xFF,
                controller_info.oem_software_rev >> 8,
                controller_info.oem_software_rev & 0xFF);
 
   /* The total_memory field is in 64 KiB units.  */
-  grub_printf ("            total memory: %d KiB\n",
+  grub_printf ("            ");
+  grub_printf (_("total memory: %d KiB\n"),
                (controller_info.total_memory << 16) / 1024);
We may need ngettext for this one
@@ -136,7 +138,7 @@ grub_cmd_vbeinfo (grub_command_t cmd __a
 
       /* Show mask and position details for direct color modes.  */
       if (mode_info_tmp.memory_model == GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR)
-        grub_printf (", mask: %d/%d/%d/%d  pos: %d/%d/%d/%d",
+        grub_printf (_(", mask: %d/%d/%d/%d  pos: %d/%d/%d/%d"),
Unclear out of context.
                      mode_info_tmp.red_mask_size,
                      mode_info_tmp.green_mask_size,
                      mode_info_tmp.blue_mask_size,
@@ -116,7 +117,7 @@ grub_cmd_vbetest (grub_command_t cmd __a
                mode_info.blue_mask_size,
                mode_info.blue_field_position);
 
-  grub_printf ("Press any key to continue.\n");
+  grub_printf (_("Press any key to continue.\n"));
We have several "Press any key to continue." with different ending characters. Can you change all them to single form?
 @@ -29,7 +30,7 @@ grub_cmd_lsmmap (grub_command_t cmd __at
   auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
   int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
     {
-      grub_printf ("base_addr = 0x%llx, length = 0x%llx, type = 0x%x\n",
+      grub_printf (_("base_addr = 0x%llx, length = 0x%llx, type = 0x%x\n"),
 		   (long long) addr, (long long) size, type);
       return 0;
  
Unclear

=== modified file 'commands/memrw.c'
--- commands/memrw.c	2009-05-04 03:49:08 +0000
+++ commands/memrw.c	2009-12-06 17:18:32 +0000
@@ -71,22 +72,22 @@ GRUB_MOD_INIT(memrw)
 {
   cmd_read_byte =
     grub_register_command ("read_byte", grub_cmd_read,
-			   "read_byte ADDR", "read byte.");
+			   _("read_byte ADDR"), _("read byte."));
   cmd_read_word =
     grub_register_command ("read_word", grub_cmd_read,
-			   "read_word ADDR", "read word.");
+			   _("read_word ADDR"), _("read word."));
   cmd_read_dword =
     grub_register_command ("read_dword", grub_cmd_read,
-			   "read_dword ADDR", "read dword.");
+			   _("read_dword ADDR"), _("read dword."));
   cmd_write_byte =
     grub_register_command ("write_byte", grub_cmd_write,
-			   "write_byte ADDR VALUE", "write byte.");
+			   _("write_byte ADDR VALUE"), _("write byte."));
   cmd_write_word =
     grub_register_command ("write_word", grub_cmd_write,
-			   "write_word ADDR VALUE", "write word.");
+			   _("write_word ADDR VALUE"), _("write word."));
   cmd_write_dword =
     grub_register_command ("write_dword", grub_cmd_write,
-			   "write_dword ADDR VALUE", "write dword.");
+			   _("write_dword ADDR VALUE"), _("write dword."));
 }
Unclear.
=== modified file 'commands/minicmd.c'
--- commands/minicmd.c	2009-11-19 10:39:14 +0000
+++ commands/minicmd.c	2009-12-06 17:55:39 +0000
@@ -133,7 +134,7 @@ grub_mini_cmd_root (struct grub_command 
   if (grub_errno == GRUB_ERR_UNKNOWN_FS)
     grub_errno = GRUB_ERR_NONE;
 
-  grub_printf ("(%s): Filesystem is %s.\n",
+  grub_printf (_("((%s): Filesystem is %s.\n"),
 	       grub_env_get ("root"), fs ? fs->name : "unknown");
 
   grub_device_close (dev);
string with unknown has to be separate:
if (fs)
grub_printf (_("((%s): Filesystem is %s.\n"),
 	       grub_env_get ("root"), fs->name);
else
grub_printf (_("((%s): Filesystem is unknown.\n"),
 	       grub_env_get ("root"));


@@ -354,28 +355,28 @@ GRUB_MOD_INIT(minicmd)
 {
   cmd_cat =
     grub_register_command ("cat", grub_mini_cmd_cat,
-			   "cat FILE", "show the contents of a file");
+			   N_("cat FILE"), N_("show the contents of a file"));
   cmd_help =
     grub_register_command ("help", grub_mini_cmd_help,
-			   0, "show this message");
+			   0, N_("show this message"));
   cmd_root =
     grub_register_command ("root", grub_mini_cmd_root,
-			   "root [DEVICE]", "set the root device");
+			   N_("root [DEVICE]"), N_("set the root device"));
   cmd_dump =
     grub_register_command ("dump", grub_mini_cmd_dump,
-			   "dump ADDR", "dump memory");
+			   N_("dump ADDR"), N_("dump memory"));
   cmd_rmmod =
     grub_register_command ("rmmod", grub_mini_cmd_rmmod,
-			   "rmmod MODULE", "remove a module");
+			   N_("rmmod MODULE"), N_("remove a module"));
   cmd_lsmod =
     grub_register_command ("lsmod", grub_mini_cmd_lsmod,
-			   0, "show loaded modules");
+			   0, N_("show loaded modules"));
   cmd_exit =
     grub_register_command ("exit", grub_mini_cmd_exit,
-			   0, "exit from GRUB");
+			   0, N_("exit from GRUB"));
   cmd_clear =
     grub_register_command ("clear", grub_mini_cmd_clear,
-			   0, "clear the screen");
+			   0, N_("clear the screen"));
 }
This part is constrained but I guess we should capitalize first letter and add a dot however 
 static char helpmsg[] =
-  "perform COMMANDS on partition.\n"
+  N_("perform COMMANDS on partition.\n"
Missing capitalization and dot (my fault).
   "Use \"parttool PARTITION help\" for the list "
-  "of available commands";
+  "of available commands");
 
 int
 grub_parttool_register(const char *part_name,
=== modified file 'commands/reboot.c'
--- commands/reboot.c	2009-12-03 23:07:29 +0000
+++ commands/reboot.c	2009-12-06 17:21:03 +0000
@@ -20,6 +20,7 @@
 #include <grub/dl.h>
 #include <grub/command.h>
 #include <grub/misc.h>
+#include <grub/i18n.h>
 
 static grub_err_t
 grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
@@ -35,7 +36,7 @@ static grub_command_t cmd;
 GRUB_MOD_INIT(reboot)
 {
   cmd = grub_register_command ("reboot", grub_cmd_reboot,
-			       0, "Reboot the computer");
+			       0, N_("Reboot the computer"));
Missing dot. I stop reporting missing dots and capitals.
=== modified file 'commands/usbtest.c'
--- commands/usbtest.c	2009-06-10 21:04:23 +0000
+++ commands/usbtest.c	2009-12-06 17:33:53 +0000
@@ -24,6 +24,7 @@
 #include <grub/dl.h>
 #include <grub/usb.h>
 #include <grub/command.h>
+#include <grub/i18n.h>
 
 static const char *usb_classes[] =
   {
@@ -86,14 +87,14 @@ usb_iterate (grub_usb_device_t dev)
   usb_print_str ("Serial", dev, descdev->strserial);
 
   if (descdev->class > 0 && descdev->class <= 0x0E)
-    grub_printf ("Class: (0x%02x) %s, Subclass: 0x%02x, Protocol: 0x%02x\n",
+    grub_printf (_("Class: (0x%02x) %s, Subclass: 0x%02x, Protocol: 0x%02x\n"),
 		 descdev->class, usb_classes[descdev->class],
 		 descdev->subclass, descdev->protocol);
-  grub_printf ("USB version %d.%d, VendorID: 0x%02x, ProductID: 0x%02x, #conf: %d\n",
+  grub_printf (_("USB version %d.%d, VendorID: 0x%02x, ProductID: 0x%02x, #conf: %d\n"),
 	       descdev->usbrel >> 8, (descdev->usbrel >> 4) & 0x0F,
 	       descdev->vendorid, descdev->prodid, descdev->configcnt);
 
-  grub_printf ("%s speed device\n", usb_devspeed[dev->speed]);
+  grub_printf (_("%s speed device\n"), usb_devspeed[dev->speed]);

I'm not sure it's good to translate this but if you do translate strings like "Full speed device." 



-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]

  parent reply	other threads:[~2009-12-07 23:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-06 18:22 gettext: commands/* Carles Pina i Estany
2009-12-07  0:49 ` Carles Pina i Estany
2009-12-07  8:44   ` Carles Pina i Estany
2009-12-07 23:23 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2009-12-21  0:21   ` Carles Pina i Estany
2009-12-21  0:47     ` Carles Pina i Estany
2009-12-21 12:16     ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-21 12:37       ` Colin Watson
2009-12-21 16:17         ` Bruce Dubbs
2009-12-24 21:03           ` Robert Millan
2009-12-21 22:13       ` Carles Pina i Estany

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B1D8E54.5010702@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.