Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
Re: [Freeciv-Dev] patch: Internationalization (PR#69)
Home

Re: [Freeciv-Dev] patch: Internationalization (PR#69)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] patch: Internationalization (PR#69)
From: David Pérez Serrada <dperezs@xxxxxxxxxxxxxxx>
Date: Tue, 27 Jul 1999 09:25:27 +0200


On Sat, 24 Jul 1999 dwp@xxxxxxxxxxxxxx wrote:

Hello David:

   Thanks for all of your correction, some of them were of the
type ItWorksForMe(c) :), if someone have others problems compiling it
please let me know.



> +#ifdef HAVE_LOCALE_H
> +#include <locale.h>
> +#endif
> (The internal libintl.h includes this by my system one doesn't.)
> (Or this could instead go in fcintl.h ?)
I think is better in fcintl.h

> With this patch I can now get a server starting up with a Spanish
> or French intro message, depending on env var LANG, using either
> system or included gettext.  :-)
Great!!!!

> The next question is which autogen files we should keep in
> CVS or not...
Well... really I don't know which files will be work on others sistem,
the configure file which is now in cvs works great for me so maybe we
could add the new generate file.

A good file to include is po/freeciv.pot, although it could be generated
from the source code it's better to add, cause some sistem could not
have
the xgettext program.. Other file will be POTFILES.

About the gmo files, I dont know if a sistem could have support for
gettext but not the msgmft program (if it use the included gettext
support then it'll not have the msgfmt program, so it would be a good
idea to include the .gmo and maybe .po files). But they are binary files
(althoug they say are machine indepent).


BTW: I have created a web page, with my lasts patchs to freeciv:
 * a lot of strings marked for translation, and translated to Spanish
and
   french
 * support for translate help files (I add a patch in this mail to do
it)
 * and of course... a lot of bugs... and incompatibilites to haunt

The web page is in:
http://dirac.dec.cie.uva.es/~dperezs/i18nfreeciv.html


                Ta otra.... David

-----------------------------------------------------------------------------

--- freeciv/client/gui-gtk/helpdlg.c Sun Jul 25 16:29:52 1999
+++ freeciv.i18n/client/gui-gtk/helpdlg.c Sun Jul 25 21:07:13 1999
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
+#include <ctype.h>

 #include <gtk/gtk.h>

@@ -216,6 +217,8 @@
   FILE *fs;
   char *dfname;
   char buf[512], *p;
+  char filename[18],lang[3];
+  char *language;
   char expect[32], name[MAX_LEN_NAME+2];
   char seen[MAX_LAST], *pname;
   int len;
@@ -245,15 +248,51 @@
     freelog(LOG_VERBOSE, "Rebooting help texts");
   }

-  dfname = datafilename("helpdata.txt");
+  /* Try to find the language of the system */
+  language = getenv("LANGUAGE");
+  if ( language == NULL ) {
+     language = getenv("LC_ALL");
+     if ( language == NULL ) {
+ language = getenv("LANG");
+     }
+  }
+
+  if ( language == NULL ) {
+    strncpy(filename,"helpdata.txt.en",8*sizeof(char));
+  } else {
+    strncpy(lang,language,2);
+
+    for(i=0;i<2;i++)
+       lang[i] = (char)tolower(lang[i]);
+    lang[2]=(char)0;
+
+    sprintf(filename,"helpdata.%s.txt",lang);
+  }
+
+  dfname = datafilename(filename);
   if (dfname == NULL) {
-    freelog(LOG_NORMAL, "Could not find readable helpdata.txt in data
path");
-    freelog(LOG_NORMAL, "The data path may be set via"
-                 " the environment variable FREECIV_PATH");
-    freelog(LOG_NORMAL, "Current data path is: \"%s\"",
datafilename(NULL));

-    freelog(LOG_NORMAL, "Did not read help texts");
-    return;
+    if ( language == NULL ) {
+      freelog(LOG_NORMAL, "Could not find readable helpdata.%s.txt in
data
path",lang);
+      freelog(LOG_NORMAL, "The data path may be set via"
+                      " the environment variable FREECIV_PATH");
+      freelog(LOG_NORMAL, "Current data path is: \"%s\"",
datafilename(NULL));
+      freelog(LOG_NORMAL, "Did not read help texts");
+      return;
+    } else {
+       /* Maybe there is no translation of helpdata */
+       /* Try to open helpdata.txt.en */
+       dfname = datafilename("helpdata.en.txt");
+       if ( dfname == NULL ) {
+         freelog(LOG_NORMAL, "Could not find readable helpdata.en.txt
in
data path");
+         freelog(LOG_NORMAL, "The data path may be set via"
+                             " the environment variable FREECIV_PATH");
+         freelog(LOG_NORMAL, "Current data path is: \"%s\"",
datafilename(NULL));
+         freelog(LOG_NORMAL, "Did not read help texts");
+         return;
+       }
+    }
   }
+
   fs = fopen(dfname, "r");
   if (fs == NULL) {
     /* this is now unlikely to happen */
--- freeciv/data/Makefile.am Sun Jul 25 16:30:01 1999
+++ freeciv.i18n/data/Makefile.am Sun Jul 25 18:31:03 1999
@@ -2,8 +2,9 @@


 pkgdata_DATA = Freeciv \
+ helpdata.en.txt \
+ helpdata.es.txt \
  classic_terrain.ruleset \
- helpdata.txt \
  earth-80x50.sav \
  earth-160x90.sav\
  europe.sav \
---------------------------------------------------------------------------------------------

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