help-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[help-texinfo] Re: Setting human languag for makeinfo


From: Torsten Bronger
Subject: [help-texinfo] Re: Setting human languag for makeinfo
Date: Sat, 09 Apr 2005 20:40:44 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Hallöchen!

address@hidden (Karl Berry) writes:

> [...]  Without reliable locale names, any kind of translation,
> whether based on LANG or @documentlanguage, is hopeless anyway.

Could the attached diff be a viable starting point for document
language based translations?

Tschö,
Torsten.


Index: lang.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/lang.c,v
retrieving revision 1.14
diff -c -r1.14 lang.c
*** lang.c      22 Nov 2004 23:57:33 -0000      1.14
--- lang.c      9 Apr 2005 18:32:42 -0000
***************
*** 262,267 ****
--- 262,288 ----
    { NULL, 0, 0 }
  };

+ typedef struct
+ {
+   char* english;
+   char* translation;
+ } translation_pair_type;
+
+ /* The English translation pairs are not actually used, but only included as a
+    summary of all excerpts that are needed.  */
+
+ translation_pair_type translation_pairs_en[] = {
+   { "See", "See" },
+   { "see", "see" },
+   { NULL, NULL }
+ };
+
+ translation_pair_type translation_pairs_de[] = {
+   { "See", "Siehe" },
+   { "see", "siehe" },
+   { NULL, NULL }
+ };
+



  /* Date: Mon, 31 Mar 2003 00:19:28 +0200
***************
*** 588,593 ****
--- 609,646 ----
    free (lang_arg);
  }

+ /* Only used in translate_excerpt() for getting the foreign language
+    counterpart of "english" in "translation_pairs".  The latter refers to one
+    distinct language. */
+
+ const char *
+ get_translation (const translation_pair_type translation_pairs[],
+                const char* english)
+ {
+   int index = 0;
+   while (translation_pairs_de[index].english != NULL) {
+     if (strcmp (translation_pairs[index].english, english) == 0)
+       return translation_pairs[index].translation;
+     index ++;
+   }
+   return english;
+ }
+
+ /* Used like gettext(), but it returns a translation not according to the
+    active locale, but according to "language_code". */
+
+ const char *
+ translate_excerpt (const char *english)
+ {
+   switch (language_code)
+     {
+     case en:
+       return english;
+     case de:
+       return get_translation (translation_pairs_de, english);
+     default:
+       return english;
+     }
+ }



  /* Search through the encoding table for the given character, returning
Index: lang.h
===================================================================
RCS file: /cvsroot/texinfo/texinfo/makeinfo/lang.h,v
retrieving revision 1.6
diff -c -r1.6 lang.h
*** lang.h      11 Apr 2004 17:56:47 -0000      1.6
--- lang.h      9 Apr 2005 18:32:42 -0000
***************
*** 145,148 ****
--- 145,150 ----

  extern char *current_document_encoding (void);

+ extern const char *translate_excerpt (const char *);
+
  #endif /* not LANG_H */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]