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

Re: Language and locale setting in /root/dbootstrap_setting (patch)



[Eduard Bloch]
> I tried this a while ago to install locales. It is broken since I do
> not allocate the string memory correctly, but the basic idea is
> clear.

I combined and corrected your patch.  Here is a better suggestion.
I'm not sure if the question should be presented at all.  If it is
needed to get the translations working, it should be installed.

I'm missing the generation step.  I'm not sure where to add it.  After
debootstrap is finished, /etc/locale.gen must be checked/edited, and
/usr/sbin/locale-gen must be executed.  A problem here is the fact
that locale.gen want 'en_US ISO-8859-1', not 'en_US.ISO-8859-1'.
Hopefully it is enough to replace '.' with ' ', but I'm not that
familiar with the special cases of locale-gen. :-/

Index: utilities/dbootstrap/extract_base.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/extract_base.c,v
retrieving revision 1.71
diff -u -3 -p -u -r1.71 extract_base.c
--- utilities/dbootstrap/extract_base.c 2002/02/08 05:56:11     1.71
+++ utilities/dbootstrap/extract_base.c 2002/02/12 10:48:03
@@ -249,10 +249,11 @@ exec_debootstrap(char **argv){
 int
 debootstrap_extract_base (void) {
   int rs=0;
-  char *argv[8];
+  char *argv[9];
   struct stat statbuf;
   char *source;
   char filename [512];
+  char *locales = NULL;
   int status;

   /* Sanity Check */
@@ -268,6 +269,15 @@ debootstrap_extract_base (void) {

   disqtype=debootstrap;
   if ( choose_medium() ) return 1;
+
+#if 0 && defined(USE_LANGUAGE_CHOOSER)
+   if (DLG_YES ==
+       yesNoBox(_("Would you like to install the localisation package?\n"
+                 "It is needed to support other languages than default (English) later."),
+               _("Locales installation")) ) {
+       locales="--include=locales";
+   }
+#endif

   DEBUGMSG("Extracting base, Archive_Dir: %s", Archive_Dir);
   if (!strcmp (Archive_Dir, "netfetch"))
@@ -332,10 +342,12 @@ debootstrap_extract_base (void) {
   argv[4] = "woody";
   argv[5] = "/target";
   argv[6] = source;
-  argv[7] = NULL;
+  argv[7] = locales;
+  argv[8] = NULL;

-  INFOMSG("running '%s %s %s %s %s %s %s'",
-          argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
+  INFOMSG("running '%s %s %s %s %s %s %s %s'",
+          argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6],
+          argv[7] ? argv[7] : "(null)" );

   rs = exec_debootstrap(argv);

Index: utilities/dbootstrap/util.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/util.c,v
retrieving revision 1.69
diff -u -3 -p -u -r1.69 util.c
--- utilities/dbootstrap/util.c 2002/02/10 19:30:14     1.69
+++ utilities/dbootstrap/util.c 2002/02/12 10:48:03
@@ -670,8 +670,17 @@ check_pending_config(void)
     write_userconfig("CDROM", "true");

 #ifdef USE_LANGUAGE_CHOOSER
-  if ( lang != NULL )
-    write_userconfig("LANG_INST", lang->locale);
+  if ( lang != NULL ) {
+    /* Pick any C/POSIX compatible locale.  Make sure this locale is generated
+       by locale-gen. */
+    write_userconfig("LANG", lang->locale);
+
+    /* Specify which translation to use when displaying messages */
+    write_userconfig("LANGUAGE", lang->msgcat);
+
+    /* Keep perl quiet if something goes wrong and the locale is missing */
+    write_userconfig("PERL_BADLANG", "0");
+  }
 #endif

 #if #cpu(powerpc)



Reply to: