Bug #2252 » locale.patch
usr/src/lib/libc/port/i18n/gettext_util.c Tue May 29 18:11:49 2012 -0700 → usr/src/lib/libc/port/i18n/gettext_util.c Sun Jun 03 09:29:22 2012 +0100 | ||
---|---|---|
88 | 88 |
{ |
89 | 89 |
char *p, *q; |
90 | 90 |
const char *catstr; |
91 |
char *country; |
|
92 |
char *charset; |
|
91 | 93 |
uint32_t cblen, loclen, catlen, totallen; |
92 | 94 | |
93 | 95 |
#ifdef GETTEXT_DEBUG |
... | ... | |
127 | 129 |
return (NULL); |
128 | 130 | |
129 | 131 |
q = mp->locale; |
130 |
while (*p++ = *q++) |
|
131 |
; |
|
132 |
*(p - 1) = '/'; |
|
132 |
country = NULL; |
|
133 |
charset = NULL; |
|
134 |
while (*p = *q++) { |
|
135 |
switch (*p) { /* ru_RU.UTF-8 */ |
|
136 |
case '_': country = p; break; |
|
137 |
case '.': charset = p; break; |
|
138 |
default:; |
|
139 |
} |
|
140 |
p++; |
|
141 |
} |
|
142 | ||
143 |
/* if /usr/share/locale/<lang_country.charset> does not exist: */ |
|
144 |
if (access(mp->msgfile, F_OK)) { |
|
145 |
/* cut off charset if any */ |
|
146 |
if (NULL != charset) { |
|
147 |
*charset = '\0'; |
|
148 |
p = charset; |
|
149 |
/* if /usr/share/locale/<lang_country> does not exist: */ |
|
150 |
if (access(mp->msgfile, F_OK)) { |
|
151 |
/* cut off country if any */ |
|
152 |
if (NULL != country) { |
|
153 |
*country = '\0'; |
|
154 |
p = country; |
|
155 |
/* if /usr/share/locale/<lang> does not exist: */ |
|
156 |
if (access(mp->msgfile, F_OK)) { |
|
157 |
return (NULL); |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
161 |
} |
|
162 |
} |
|
163 | ||
164 |
*p++ = '/'; |
|
133 | 165 |
while (*p++ = *catstr++) |
134 | 166 |
; |
135 | 167 |
*(p - 1) = '/'; |