diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2011-12-03 12:43:42 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2011-12-03 12:43:42 +0000 |
commit | ab65daf831114c0f8f41fa92b5105bb8193b80d2 (patch) | |
tree | e6e8ac9e0df0a7233fdf97294fb70044cde6d9d9 | |
parent | 37fc2ba109fe0c9dc1ebdb37e2c4bf4b828494f0 (diff) | |
download | libgphoto2-ab65daf831114c0f8f41fa92b5105bb8193b80d2.tar.gz |
pluralize translated entries correctly
git-svn-id: https://svn.code.sf.net/p/gphoto/code/branches/libgphoto2-2_4/libgphoto2@13788 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c | 24 | ||||
-rw-r--r-- | libgphoto2_port/libgphoto2_port/gphoto2-port.c | 114 |
2 files changed, 87 insertions, 51 deletions
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c index 53ec7fcad..ef18552b3 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port-info-list.c @@ -59,6 +59,7 @@ # define bind_textdomain_codeset(Domain,codeset) (codeset) # define _(String) (String) # define N_(String) (String) +# define ngettext(String1,String2,Count) ((Count==1)?String1:String2) #endif /** @@ -309,8 +310,11 @@ gp_port_info_list_count (GPPortInfoList *list) CHECK_NULL (list); - gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", _("Counting entries " - "(%i available)..."), list->count); + gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", ngettext( + "Counting entry (%i available)...", + "Counting entries (%i available)...", + list->count + ), list->count); /* Ignore generic entries */ count = list->count; @@ -318,9 +322,12 @@ gp_port_info_list_count (GPPortInfoList *list) if (!strlen (list->info[i].name)) count--; - gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", _("%i regular entries " - "available."), count); - return (count); + gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", ngettext( + "%i regular entry available.", + "%i regular entries available.", + count + ), count); + return count; } /** @@ -348,8 +355,11 @@ gp_port_info_list_lookup_path (GPPortInfoList *list, const char *path) CHECK_NULL (list && path); - gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", _("Looking for " - "path '%s' (%i entries available)..."), path, list->count); + gp_log (GP_LOG_DEBUG, "gphoto2-port-info-list", ngettext( + "Looking for path '%s' (%i entry available)...", + "Looking for path '%s' (%i entries available)...", + list->count + ), path, list->count); /* Exact match? */ for (generic = i = 0; i < list->count; i++) diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port.c b/libgphoto2_port/libgphoto2_port/gphoto2-port.c index be730ef85..338816055 100644 --- a/libgphoto2_port/libgphoto2_port/gphoto2-port.c +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port.c @@ -48,6 +48,7 @@ #else # define _(String) (String) # define N_(String) (String) +# define ngettext(String1,String2,Count) ((Count==1)?String1:String2) #endif #define CHECK_RESULT(result) {int r=(result); if (r<0) return (r);} @@ -353,8 +354,10 @@ gp_port_write (GPPort *port, const char *data, int size) { int retval; - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Writing %i=0x%x byte(s) " - "to port..."), size, size); + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Writing %i=0x%x byte to port...", + "Writing %i=0x%x bytes to port...", + size), size, size); CHECK_NULL (port && data); CHECK_INIT (port); @@ -366,10 +369,12 @@ gp_port_write (GPPort *port, const char *data, int size) retval = port->pc->ops->write (port, data, size); CHECK_RESULT (retval); if ((port->type != GP_PORT_SERIAL) && (retval != size)) - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Could only write %i " - "out of %i byte(s)"), retval, size); - - return (retval); + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Could only write %i out of %i byte", + "Could only write %i out of %i bytes", + size + ), retval, size); + return retval; } /** @@ -389,7 +394,10 @@ gp_port_read (GPPort *port, char *data, int size) { int retval; - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Reading %i=0x%x bytes from port..."), + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Reading %i=0x%x byte from port...", + "Reading %i=0x%x bytes from port...", + size), size, size); CHECK_NULL (port); @@ -400,12 +408,13 @@ gp_port_read (GPPort *port, char *data, int size) retval = port->pc->ops->read (port, data, size); CHECK_RESULT (retval); if (retval != size) - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Could only read %i " - "out of %i byte(s)"), retval, size); - + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Could only read %i out of %i byte", + "Could only read %i out of %i bytes", + size + ), retval, size); gp_log_data ("gphoto2-port", data, retval); - - return (retval); + return retval; } /** @@ -426,8 +435,11 @@ gp_port_check_int (GPPort *port, char *data, int size) { int retval; - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Reading %i=0x%x bytes from interrupt endpoint..."), - size, size); + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Reading %i=0x%x byte from interrupt endpoint...", + "Reading %i=0x%x bytes from interrupt endpoint...", + size + ), size, size); CHECK_NULL (port); CHECK_INIT (port); @@ -437,12 +449,12 @@ gp_port_check_int (GPPort *port, char *data, int size) retval = port->pc->ops->check_int (port, data, size, port->timeout); CHECK_RESULT (retval); if (retval != size) - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Could only read %i " - "out of %i byte(s)"), retval, size); - + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Could only read %i out of %i byte", + "Could only read %i out of %i bytes", + size), retval, size); gp_log_data ("gphoto2-port", data, retval); - - return (retval); + return retval; } /** The timeout in milliseconds for fast interrupt reads. */ @@ -477,8 +489,11 @@ gp_port_check_int_fast (GPPort *port, char *data, int size) #else if (retval != size ) #endif - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Could only read %i " - "out of %i byte(s)"), retval, size); + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Could only read %i out of %i byte", + "Could only read %i out of %i bytes", + size + ), retval, size); #ifdef IGNORE_EMPTY_INTR_READS if ( retval != 0 ) { @@ -486,15 +501,17 @@ gp_port_check_int_fast (GPPort *port, char *data, int size) /* For Canon cameras, we will make lots of reads that will return zero length. Don't bother to log them as errors. */ - gp_log (GP_LOG_DEBUG, "gphoto2-port", - _("Reading %i=0x%x bytes from interrupt endpoint (fast)..."), + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Reading %i=0x%x byte from interrupt endpoint (fast)...", + "Reading %i=0x%x bytes from interrupt endpoint (fast)...", + size + ), size, size); gp_log_data ("gphoto2-port", data, retval); #ifdef IGNORE_EMPTY_INTR_READS } #endif - - return (retval); + return retval; } @@ -512,8 +529,11 @@ gp_port_check_int_fast (GPPort *port, char *data, int size) int gp_port_set_timeout (GPPort *port, int timeout) { - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Setting timeout to %i " - "millisecond(s)..."), timeout); + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Setting timeout to %i millisecond...", + "Setting timeout to %i milliseconds...", + timeout + ), timeout); CHECK_NULL (port); @@ -724,8 +744,11 @@ gp_port_set_pin (GPPort *port, GPPin pin, GPLevel level) int gp_port_send_break (GPPort *port, int duration) { - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Sending break (%i " - "milliseconds)..."), duration); + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Sending break (%i millisecond)...", + "Sending break (%i milliseconds)...", + duration + ), duration); CHECK_NULL (port); CHECK_INIT (port); @@ -902,12 +925,13 @@ gp_port_usb_msg_read (GPPort *port, int request, int value, int index, CHECK_RESULT (retval); if (retval != size) - gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Could only read %i " - "out of %i byte(s)"), retval, size); - + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Could only read %i out of %i byte", + "Could only read %i out of %i bytes", + size + ), retval, size); gp_log_data ("gphoto2-port", bytes, retval); - - return (retval); + return retval; } /* @@ -984,12 +1008,13 @@ gp_port_usb_msg_interface_read (GPPort *port, int request, int value, int index, CHECK_RESULT (retval); if (retval != size) - gp_log (GP_LOG_DEBUG, "gphoto2-port", "Could only read %i " - "out of %i byte(s)", retval, size); - + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Could only read %i out of %i byte", + "Could only read %i out of %i bytes", + size + ),retval, size); gp_log_data ("gphoto2-port", bytes, retval); - - return (retval); + return retval; } @@ -1068,12 +1093,13 @@ gp_port_usb_msg_class_read (GPPort *port, int request, int value, int index, CHECK_RESULT (retval); if (retval != size) - gp_log (GP_LOG_DEBUG, "gphoto2-port", "Could only read %i " - "out of %i byte(s)", retval, size); - + gp_log (GP_LOG_DEBUG, "gphoto2-port", ngettext( + "Could only read %i out of %i byte", + "Could only read %i out of %i bytes", + size + ), retval, size); gp_log_data ("gphoto2-port", bytes, retval); - - return (retval); + return retval; } /** |