[procps] Re: procps-ng nls support

  • From: Sami Kerola <kerolasa@xxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Thu, 13 Oct 2011 23:40:19 +0200

On Thu, Oct 13, 2011 at 16:47, Jim Warner <james.warner@xxxxxxxxxxx> wrote:

Hi Jim et.al.

> The huge patch below represents, I think, a better approach to top
> nls support.

You are right, that looks much better. Great job.

> It isolates all gettext needs in a separate module which has the
> additional advantage of offering complete control over the order of
> .pot template output.  And once my translated string tables are
> constructed, there is no recurring runtime costs for nls support.
> This was an extremely important objective for top.
>
> It's too bad gettext doesn't provide for emitting comments to aid
> the translators.  I had to engineer my own means to accomplish that
> goal.

There is support for comments in gettext.  The comments should be
wrote like this.

/* TRANSLATORS: this should be visible in .pot file */
printf(_("to be translated"));

I gave that a try to that, and the comment did not appear to .pot
file.  Perhaps something is needed in either autogen.sh, conifgure.ac
or Makefile.am.  I will take a look of this, unless someone else is
quicker and tells how get this working.

> There is some residual text in top that may yet be a candidate for
> nls inclusion.  Please view this patch as simply my first "draft".
> It's designed to be applied to your current nls branch.
>
> I'll be very interested in your comments.

I have feeling translators do not like these; top/top_nls.c:421. The
message looks quite long, and control characters would work as a
repellent if I would think of translating the package. Do you see any
way of making the translation strings to be small segments such as.

"Help for Interactive Commands"
"System"
"Delay"
...

It seems the control chars & spaces are good break points for these
strings.

Another thing I noticed was top/top_nls.c:535 strings. I am not sure
how to translate a line like that, and that is why I propose to drop
these sort of lines.

See also diff for few changes I think should be added to your
commit.

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/
diff --git a/top/top.c b/top/top.c
index 08a4570..a78dbb8 100644
--- a/top/top.c
+++ b/top/top.c
@@ -40,14 +40,14 @@
 #include <unistd.h>
 #include <values.h>
 
-#include "../proc/devname.h"
-#include "../proc/procps.h"
-#include "../proc/readproc.h"
-#include "../proc/sig.h"
-#include "../proc/sysinfo.h"
-#include "../proc/version.h"
-#include "../proc/wchan.h"
-#include "../proc/whattime.h"
+#include "devname.h"
+#include "procps.h"
+#include "readproc.h"
+#include "sig.h"
+#include "sysinfo.h"
+#include "version.h"
+#include "wchan.h"
+#include "whattime.h"
 
 #include "top.h"
 #include "top_nls.h"
diff --git a/top/top.h b/top/top.h
index a911cac..28744eb 100644
--- a/top/top.h
+++ b/top/top.h
@@ -20,7 +20,7 @@
 #ifndef _Itop
 #define _Itop
 
-#include "../proc/readproc.h"
+#include "readproc.h"
 
         /* Development/Debugging defines ----------------------------------- */
 //#define ATEOJ_RPTHSH            /* report on hash specifics, at end-of-job */
@@ -441,7 +441,7 @@ typedef struct WIN_t {
 
 /*######  Display Support *Data*  ########################################*/
 /*######  Some Display Support *Data*  ###################################*/
-/*      ( see module top_txt.c for the nls translatable data ) */
+/*      ( see module top_nls.c for the nls translatable data ) */
 
         /* Configuration files support */
 #define SYS_RCFILESPEC  "/etc/toprc"
diff --git a/top/top_nls.h b/top/top_nls.h
index 0b14d23..058940b 100644
--- a/top/top_nls.h
+++ b/top/top_nls.h
@@ -20,7 +20,7 @@
 #define _Itop_nls
 
 //#include "../include/c.h"
-#include "../include/nls.h"
+#include "nls.h"
 
         /*
          * These are our three string tables with the following contents:

Other related posts: