1090 Setting of default locale does not really work
authorJan Damborsky <Jan.Damborsky@Sun.COM>
Mon, 14 Apr 2008 17:55:54 +0200
changeset 107 73ae3dba821c
parent 106 3dc5f5d3d662
child 108 b1b80f16371e
1090 Setting of default locale does not really work 1110 Duplicate locale values on Locale screen for Korean & Chinese-Simplified 1152 cannot find locale_desc for ko_KR.UTF-8 and causes access of freed memory 1155 zh_CN entry in liborchestrator treats macro name as macro value 1108 Tegulu should be corrected as Telugu in languag list
usr/src/cmd/gui-install/src/confirmation-screen.c
usr/src/cmd/slim-install/finish/install-finish
usr/src/lib/liborchestrator/locale.c
usr/src/lib/liborchestrator/orchestrator_lang_codes.h
--- a/usr/src/cmd/gui-install/src/confirmation-screen.c	Sun Apr 13 11:28:53 2008 -0600
+++ b/usr/src/cmd/gui-install/src/confirmation-screen.c	Mon Apr 14 17:55:54 2008 +0200
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -446,8 +446,8 @@
 							InstallationProfile.def_locale));
 				if (!tmpStr2) {
 					tmpStr2 =
-						orchestrator_om_locale_get_name(
-							InstallationProfile.def_locale);
+						g_strdup(orchestrator_om_locale_get_name(
+							InstallationProfile.def_locale));
 					g_warning(
 						"Default language error: no locale description "
 						"for locale: %s",
--- a/usr/src/cmd/slim-install/finish/install-finish	Sun Apr 13 11:28:53 2008 -0600
+++ b/usr/src/cmd/slim-install/finish/install-finish	Mon Apr 14 17:55:54 2008 +0200
@@ -366,7 +366,7 @@
 fi
 
 # add entries for other installed OS's to the grub menu
-mkmenu $GRUBMENU
+/sbin/mkmenu $GRUBMENU
 
 if [ "$rootfstype" = "zfs" ] ; then
 	rootdataset=`grep -v "^#" $BASEDIR/etc/vfstab | \
--- a/usr/src/lib/liborchestrator/locale.c	Sun Apr 13 11:28:53 2008 -0600
+++ b/usr/src/lib/liborchestrator/locale.c	Mon Apr 14 17:55:54 2008 +0200
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"@(#)locale.c	1.3	07/08/27 SMI"
-
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -84,8 +82,9 @@
 	{"zh", SIMPLIFIED_CHINESE, "sc"},
 	{"zh.GBK", SIMPLIFIED_CHINESE, "sc"},
 	{"zh.UTF-8", SIMPLIFIED_CHINESE, "sc"},
-	{"zh_CN", "SIMPLIFIED_CHINESE", "sc"},
+	{"zh_CN", SIMPLIFIED_CHINESE, "sc"},
 	{"zh_CN.GB18030", SIMPLIFIED_CHINESE, "sc"},
+	{"zh_CN.UTF-8", SIMPLIFIED_CHINESE, "sc"},
 	{"zh_HK", TRADITIONAL_CHINESE, "tc"},
 	{"zh_HK.BIG5HK", TRADITIONAL_CHINESE, "tc"},
 	{"zh_HK.UTF-8", TRADITIONAL_CHINESE, "tc"},
@@ -1102,13 +1101,17 @@
 		lang = get_locale_component(&t, &start);
 
 		/*
-		 * If we found a country or codeset sep then we found a
-		 * locale.  The lang value is the language part of
+		 * Valid locale must contain country information.
+		 * The lang value is the language part of
 		 * the lang/locale pair. What was in the original list
 		 * is the locale.
 		 */
 		if (start && *t == COUNTRY_SEP) {
 			region = get_locale_component(&t, &start);
+		} else {
+			free(lang);
+			lang = NULL;
+			continue;
 		}
 
 		if (start && *t == CODESET_SEP) {
@@ -1173,6 +1176,11 @@
 		 */
 		if (locale != NULL)  {
 			is_default = is_locale_in_installer_lang(locale);
+			om_debug_print(OM_DBGLVL_INFO, "Adding locale: "
+			    "locale=%s,lang=%s,region=%s\n", locale,
+			    lang == NULL ? "#" : lang,
+			    region == NULL ? "#" : region);
+
 			if ((lp = get_lang_entry(lang, *return_list)) != NULL) {
 				add_locale_entry_to_lang(lp, locale, region,
 				    is_default);
@@ -1901,42 +1909,10 @@
 static void
 update_init(FILE *fp, char *locale)
 {
-	char path[MAXPATHLEN];
-	char lc_collate[MAX_LOCALE];
-	char lc_ctype[MAX_LOCALE];
-	char lc_messages[MAX_LOCALE];
-	char lc_monetary[MAX_LOCALE];
-	char lc_numeric[MAX_LOCALE];
-	char lc_time[MAX_LOCALE];
-	char lang[MAX_LOCALE];
-	FILE *mfp;
-	int rc;
-
-	(void) snprintf(path, sizeof (path), "%s/%s/locale_map",
-	    NLS_PATH, locale);
-	if ((mfp = fopen(path, "r")) == NULL) {
-		if (strcmp(locale, "C") != 0) {
-			(void) fprintf(fp, "LANG=%s\n", locale);
-		}
-		set_lang(locale);
-	} else {
-		rc = read_locale_file(mfp, lang, lc_collate, lc_ctype,
-		    lc_messages, lc_monetary, lc_numeric, lc_time);
-		(void) fclose(mfp);
-
-		if (rc == 1) {
-			(void) fprintf(fp, "LANG=%s\n", lc_messages);
-			set_lang(lc_messages);
-		} else {
-			(void) fprintf(fp, "LC_COLLATE=%s\n", lc_collate);
-			(void) fprintf(fp, "LC_CTYPE=%s\n", lc_ctype);
-			(void) fprintf(fp, "LC_MESSAGES=%s\n", lc_messages);
-			(void) fprintf(fp, "LC_MONETARY=%s\n", lc_monetary);
-			(void) fprintf(fp, "LC_NUMERIC=%s\n", lc_numeric);
-			(void) fprintf(fp, "LC_TIME=%s\n", lc_time);
-		}
-
+	if (strcmp(locale, "C") != 0) {
+		(void) fprintf(fp, "LANG=%s\n", locale);
 	}
+	set_lang(locale);
 }
 
 static void
--- a/usr/src/lib/liborchestrator/orchestrator_lang_codes.h	Sun Apr 13 11:28:53 2008 -0600
+++ b/usr/src/lib/liborchestrator/orchestrator_lang_codes.h	Mon Apr 14 17:55:54 2008 +0200
@@ -19,15 +19,13 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 #ifndef _ORCHESTRATOR_LANG_CODES_H
 #define	_ORCHESTRATOR_LANG_CODES_H
 
-#pragma ident	"@(#)orchestrator_lang_codes.h	1.2	07/08/25 SMI"
-
 /*
  * This list is created from the ISO 639-1 language code list. It does
  * Not include codes for ISO 639-2 or 3 codes.
@@ -159,7 +157,7 @@
 	{"sv", "Swedish"},
 	{"sw", "Swahili"},
 	{"ta", "Tamil"},
-	{"te", "Tegulu"},
+	{"te", "Telugu"},
 	{"tg", "Tajik"},
 	{"th", "Thai"},
 	{"ti", "Tigrinya"},
@@ -228,7 +226,7 @@
 	{"IS", "Iceland"},
 	{"IT", "Italy"},
 	{"JP", "Japan"},
-	{"KO", "Korea"},
+	{"KR", "Korea"},
 	{"LT", "Lithuania"},
 	{"LU", "Luxembourg"},
 	{"LV", "Latvia"},