>>>> "sb" == SL Baur <steve(a)xemacs.org>
writes:
sb> Multilingual menubars are overly sensitive to the exact text
sb> name of the locale. For example, LANG=ja yields Japanese
sb> menubars, LANG=ja_JP does not.
Here's an algorithm, I wouldn't show the code to my daughter or other
sensitive beings, it klunks. But it compiles and XEmacs doesn't blow
up, and I get Japanese menubars with both LANG=ja and LANG=ja_JP. One
thing I worry about is if somebody sets LANG to say "_JP" or
".ISO-8859-1", these seem OK (of course I don't get any action on the
menu bar or splash screen).
However ... app-defaults and lisp/locale are still using different
methods to access locale. This is probably not a good idea, but I'll
have to look at lisp/locale to see whether we can do anything about
it.
Also, I'm not sure about the wisdom of doing patching the C code. An
alternative would be to link ja_JP -> ja and ja_JP.ujis -> jp in the
app-defaults directory. (Or actually the other way around; the
encoding is important here, so ja_JP.ujis ought to be the full name
with the others being aliases.)
This works (in an unpatched xemacs), and I think this is what the
quick fix ought to be. In the long run we probably ought to consult
the host's database of locale aliases, too, so that people on hosts
that permit "Japanese" as an alias for "ja_JP.ujis" don't get
hosed.
Unfortunately, there's no canonical name as far as I know, it could be
that the host uses "ja_JP.eucJP" and if we don't know about that and
the .ujis version is not aliased, I see no way to find out the match.
We could try to be "smart" in the other direction and "promote"
LANG=ja to some ja_* version available in the app-defaults directory,
but there's no reason why there wouldn't be both ja_JP.ujis and
ja_JP.utf8, or fr_FR vs fr_CA for that matter. I don't know how we'd
choose. Although it wouldn't matter if the various files for
different encodings are kept synchronized, this is unlikely for
different national variants if both are present, or even with
different encodings, eg ISO-8859-1 vs ISO-8859-15 variants. People
might write their menu-bars to take advantage of the Euro symbol in
the latter, and then both font availability and user preferences would
matter.
In summary, the symlink is a very simple way for sysadmins to
implement their own policy. This would work with a patched XEmacs,
too (since they could guarantee an exact match for host-supported
locales); but why have a complex internal mechanism? This would also
make looking up the policy trivial for users (or for a Lisp function):
ls -l $PACKAGE_ROOT/etc/app-defaults.
Index: src/device-x.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/src/device-x.c,v
retrieving revision 1.33
diff -u -r1.33 device-x.c
--- device-x.c 1998/05/27 20:42:02 1.33
+++ device-x.c 1999/02/05 17:50:02
@@ -1,3 +1,4 @@
+
/* Device functions for X windows.
Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
@@ -409,19 +410,57 @@
if (STRINGP (Vx_app_defaults_directory) &&
XSTRING_LENGTH (Vx_app_defaults_directory) > 0)
{
+ char *internal_pointer;
+
GET_C_STRING_FILENAME_DATA_ALLOCA(Vx_app_defaults_directory, data_dir);
path = (char *)alloca (strlen (data_dir) + strlen (locale) + 7);
sprintf (path, "%s%s/Emacs", data_dir, locale);
if (!access (path, R_OK))
XrmCombineFileDatabase (path, &db, False);
+ /* I can't find a reference that says what to do if multiple
+ instances of a separator `.' or `_' is present. Now, often
+ versions of encodings are expressed like JISX0208.1990, so
+ it seems better to start at the left.
+
+ Order matters. */
+ else if ((internal_pointer = strchr(locale, '_')))
+ {
+ *internal_pointer = '\0';
+ sprintf (path, "%s%s/Emacs", data_dir, locale);
+ if (!access (path, R_OK))
+ XrmCombineFileDatabase (path, &db, False);
+ }
+ else if ((internal_pointer = strchr(locale, '.')))
+ {
+ *internal_pointer = '\0';
+ sprintf (path, "%s%s/Emacs", data_dir, locale);
+ if (!access (path, R_OK))
+ XrmCombineFileDatabase (path, &db, False);
+ }
}
else if (STRINGP (Vdata_directory) && XSTRING_LENGTH (Vdata_directory) >
0)
{
+ char *internal_pointer;
+
GET_C_STRING_FILENAME_DATA_ALLOCA (Vdata_directory, data_dir);
path = (char *)alloca (strlen (data_dir) + 13 + strlen (locale) + 7);
sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale);
if (!access (path, R_OK))
XrmCombineFileDatabase (path, &db, False);
+ else if ((internal_pointer = strchr(locale, '_')))
+ {
+ *internal_pointer = '\0';
+ sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale);
+ if (!access (path, R_OK))
+ XrmCombineFileDatabase (path, &db, False);
+ }
+ else if ((internal_pointer = strchr(locale, '.')))
+ {
+ *internal_pointer = '\0';
+ sprintf (path, "%sapp-defaults/%s/Emacs", data_dir, locale);
+ if (!access (path, R_OK))
+ XrmCombineFileDatabase (path, &db, False);
+ }
}
}
#endif /* LWLIB_MENUBARS_MOTIF or HAVE_XIM USE_XFONTSET */
--
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Institute of Policy and Planning Sciences Tel/fax: +81 (298) 53-5091
__________________________________________________________________________
__________________________________________________________________________
What are those two straight lines for? "Free software rules."