21976
|
1 |
--- gdm-2.30.7/gui/simple-greeter/gdm-languages.c.org Tue Jul 12 13:40:00 2011
|
|
2 |
+++ gdm-2.30.7/gui/simple-greeter/gdm-languages.c Tue Jul 12 15:48:26 2011
|
|
3 |
@@ -27,6 +27,9 @@
|
|
4 |
#include <stdio.h>
|
|
5 |
#include <unistd.h>
|
|
6 |
#include <string.h>
|
|
7 |
+#if __sun
|
|
8 |
+#include <strings.h>
|
|
9 |
+#endif
|
|
10 |
#include <errno.h>
|
|
11 |
#include <dirent.h>
|
|
12 |
#include <locale.h>
|
|
13 |
@@ -144,7 +147,7 @@
|
21842
|
14 |
|
|
15 |
if (!g_regex_match (re, name, 0, &match_info) ||
|
|
16 |
g_match_info_is_partial_match (match_info)) {
|
|
17 |
- g_warning ("locale %s isn't valid\n", name);
|
22037
|
18 |
+ g_debug ("locale %s isn't valid\n", name);
|
21842
|
19 |
goto out;
|
|
20 |
}
|
|
21 |
|
21976
|
22 |
@@ -188,6 +191,12 @@
|
|
23 |
}
|
|
24 |
}
|
|
25 |
|
|
26 |
+ /*
|
|
27 |
+ * While Solaris now supports locale aliases but we still prefer
|
|
28 |
+ * unnormalized, canonical locale names. Hence, we do not normalize
|
|
29 |
+ * codeset part of locale names.
|
|
30 |
+ */
|
|
31 |
+#ifndef __sun
|
|
32 |
if (codesetp != NULL && *codesetp != NULL) {
|
|
33 |
normalized_codeset = normalize_codeset (*codesetp);
|
|
34 |
normalized_name = construct_language_name (language_codep ? *language_codep : NULL,
|
|
35 |
@@ -203,6 +212,7 @@
|
|
36 |
}
|
|
37 |
g_free (normalized_name);
|
|
38 |
}
|
|
39 |
+#endif
|
|
40 |
|
|
41 |
out:
|
|
42 |
g_match_info_free (match_info);
|
|
43 |
@@ -350,9 +360,16 @@
|
|
44 |
return has_translations;
|
|
45 |
}
|
|
46 |
|
|
47 |
+#if __sun
|
|
48 |
static gboolean
|
|
49 |
add_locale (const char *language_name,
|
|
50 |
+ gboolean utf8_only,
|
|
51 |
+ gboolean verify_locale)
|
|
52 |
+#else
|
|
53 |
+static gboolean
|
|
54 |
+add_locale (const char *language_name,
|
|
55 |
gboolean utf8_only)
|
|
56 |
+#endif
|
|
57 |
{
|
|
58 |
GdmLocale *locale;
|
|
59 |
GdmLocale *old_locale;
|
|
60 |
@@ -361,6 +378,13 @@
|
|
61 |
|
|
62 |
g_return_val_if_fail (language_name != NULL, FALSE);
|
|
63 |
|
|
64 |
+#if __sun
|
|
65 |
+ if (strstr(language_name, ".UTF-8") != NULL || !utf8_only) {
|
|
66 |
+ name = g_strdup (language_name);
|
|
67 |
+ } else {
|
|
68 |
+ return FALSE;
|
|
69 |
+ }
|
|
70 |
+#else
|
|
71 |
language_name_get_codeset_details (language_name, NULL, &is_utf8);
|
|
72 |
|
|
73 |
if (is_utf8) {
|
|
74 |
@@ -376,12 +398,21 @@
|
|
75 |
} else {
|
|
76 |
name = g_strdup (language_name);
|
|
77 |
}
|
|
78 |
+#endif
|
|
79 |
|
|
80 |
+#if __sun
|
|
81 |
+ if (verify_locale && !language_name_is_valid (name)) {
|
|
82 |
+ g_warning ("Your locale '%s' was failed by setlocale()", name);
|
|
83 |
+ g_free (name);
|
|
84 |
+ return FALSE;
|
|
85 |
+ }
|
|
86 |
+#else
|
|
87 |
if (!language_name_is_valid (name)) {
|
|
88 |
g_warning ("Your locale '%s' was failed by setlocale()", name);
|
|
89 |
g_free (name);
|
|
90 |
return FALSE;
|
|
91 |
}
|
|
92 |
+#endif
|
|
93 |
|
|
94 |
locale = g_new0 (GdmLocale, 1);
|
|
95 |
gdm_parse_language_name (name,
|
|
96 |
@@ -392,6 +423,13 @@
|
21842
|
97 |
g_free (name);
|
|
98 |
name = NULL;
|
|
99 |
|
|
100 |
+#if __sun
|
21976
|
101 |
+ if (locale->language_code == NULL) {
|
|
102 |
+ gdm_locale_free (locale);
|
|
103 |
+ return FALSE;
|
|
104 |
+ }
|
21842
|
105 |
+#endif
|
|
106 |
+
|
|
107 |
#ifdef WITH_INCOMPLETE_LOCALES
|
|
108 |
if (utf8_only) {
|
|
109 |
if (locale->territory_code == NULL || locale->modifier) {
|
21976
|
110 |
@@ -459,7 +497,7 @@
|
21842
|
111 |
error = NULL;
|
|
112 |
mapped = g_mapped_file_new (ARCHIVE_FILE, FALSE, &error);
|
|
113 |
if (mapped == NULL) {
|
|
114 |
- g_warning ("Mapping failed for %s: %s", ARCHIVE_FILE, error->message);
|
22037
|
115 |
+ g_debug ("Mapping failed for %s: %s", ARCHIVE_FILE, error->message);
|
21842
|
116 |
g_error_free (error);
|
|
117 |
return FALSE;
|
|
118 |
}
|
21976
|
119 |
@@ -488,7 +526,11 @@
|
|
120 |
}
|
|
121 |
|
|
122 |
for (cnt = 0; cnt < used; ++cnt) {
|
|
123 |
+#if __sun
|
|
124 |
+ add_locale (names[cnt].name, TRUE, TRUE);
|
|
125 |
+#else
|
|
126 |
add_locale (names[cnt].name, TRUE);
|
|
127 |
+#endif
|
|
128 |
}
|
|
129 |
|
|
130 |
g_free (names);
|
|
131 |
@@ -533,6 +575,19 @@
|
21842
|
132 |
static void
|
|
133 |
collect_locales_from_directory (void)
|
|
134 |
{
|
|
135 |
+#if __sun
|
21976
|
136 |
+ lclist_t *lclp;
|
|
137 |
+ int count;
|
|
138 |
+ int i;
|
21842
|
139 |
+
|
21976
|
140 |
+ count = localelist (&lclp, LCLIST_QUERY);
|
21842
|
141 |
+
|
21976
|
142 |
+ for (i = 0; i < count; i++) {
|
|
143 |
+ add_locale (lclp[i].locale, TRUE, FALSE);
|
|
144 |
+ }
|
21842
|
145 |
+
|
21976
|
146 |
+ localelistfree (lclp);
|
21842
|
147 |
+#else
|
|
148 |
struct dirent **dirents;
|
|
149 |
int ndirents;
|
21976
|
150 |
int cnt;
|
|
151 |
@@ -546,6 +601,7 @@
|
21842
|
152 |
if (ndirents > 0) {
|
|
153 |
free (dirents);
|
|
154 |
}
|
|
155 |
+#endif
|
|
156 |
}
|
|
157 |
|
|
158 |
static void
|
21976
|
159 |
@@ -591,9 +647,15 @@
|
|
160 |
|
|
161 |
lang = NULL;
|
|
162 |
for (i = 0; lang_list[i] != NULL; i++) {
|
|
163 |
+#if __sun
|
|
164 |
+ if (add_locale (lang_list[i], FALSE, TRUE)) {
|
|
165 |
+ break;
|
|
166 |
+ }
|
|
167 |
+#else
|
|
168 |
if (add_locale (lang_list[i], FALSE)) {
|
|
169 |
break;
|
|
170 |
}
|
|
171 |
+#endif
|
|
172 |
}
|
|
173 |
g_strfreev (lang_list);
|
|
174 |
}
|
|
175 |
@@ -696,7 +758,7 @@
|
21842
|
176 |
}
|
|
177 |
|
|
178 |
if (is_fallback_language (code)) {
|
|
179 |
- name = g_strdup (_("Unspecified"));
|
21976
|
180 |
+ name = g_strdup (code);
|
21842
|
181 |
} else {
|
|
182 |
translated_name = dgettext ("iso_639", language);
|
|
183 |
name = get_first_item_in_semicolon_list (translated_name);
|
21976
|
184 |
@@ -1059,6 +1121,11 @@
|
21842
|
185 |
|
|
186 |
full_language = g_string_append (full_language, translated_language);
|
|
187 |
|
21976
|
188 |
+ if (strcmp (translated_language, "C") == 0 ||
|
|
189 |
+ strcmp (translated_language, "POSIX") == 0) {
|
|
190 |
+ goto out;
|
|
191 |
+ }
|
21842
|
192 |
+
|
|
193 |
if (territory_code != NULL) {
|
|
194 |
translated_territory = get_translated_territory (territory_code, locale);
|
|
195 |
}
|