3 # Change locale-dependent settings of WindowMaker.
5 # v0.1 by judas@hell <tomka@oalevice.sk> on Jan 28 2001
12 if [ "x$GNUSTEP_USER_ROOT" == "x" ]; then
15 GSDIR
="$GNUSTEP_USER_ROOT"
16 if [ ! -d "GSDIR" ]; then
17 echo "GNUSTEP_USER_ROOT variable does not contain path to valid directory..." >/dev
/stderr
21 GLOBALDIR
="#pkgdatadir#"
22 LOCALDIR
="$GSDIR/Library/WindowMaker"
26 "$PROGRAM, v$VERSION by judas@hell\n"\
28 " $PROGRAM [--auto] [--nodef] [<new-locale> | default]\n"\
30 "<new-locale> locale you want WindowMaker to move to (e.g. ja or default)\n"\
31 "--auto use current locale\n"\
32 "--nodef try to change only codings of fonts\n"
36 if (( $# == 0 )); then
47 if [ -z "$new_locale" ]; then
50 echo -e "\nUnrecognized command line argument, run without arguments to see help.\n"
55 if [ "$new_locale" == "default" ]; then
59 if [ -n "$auto" ] && [ -z "$new_locale" ]; then
61 if [ -z "$new_locale" ]; then
62 new_locale
="${LC_ALL%_*}"
66 if [ -z "$new_locale" ]; then
67 echo -e "\nNo locale is set, using default...\n" >/dev
/stderr
68 elif ! (locale
-a |
grep "^$new_locale$" &>/dev
/null
); then
70 "Locale $new_locale currently set is not supported on your system...\n"\
71 "Check your LANG and LC_ALL variables or install your locale support\n"\
76 echo -n "Setting Window Maker root menu... "
78 if [ -z "$new_locale" ] ||
[ "$new_locale" == "en" ]; then
79 menu_list
="plmenu menu"
81 menu_list
="plmenu.$new_locale menu.$new_locale plmenu menu"
83 for new_menu
in $menu_list; do
84 for wm_dir
in $LOCALDIR $GLOBALDIR; do
85 if [ -f "$wm_dir/$new_menu" ]; then
86 if [ -n "$new_locale" ] && echo "$new_menu" |
grep "menu.$new_locale" &>/dev
/null
; then
89 echo "fail (copying default)"
91 if [ "${new_menu:0:4}" == "menu" ]; then # plain
92 echo "\"$wm_dir/$new_menu\"" >"$GSDIR/Defaults/WMRootMenu"
94 cp -f "$wm_dir/$new_menu" "$GSDIR/Defaults/WMRootMenu"
101 if [ -z "$any_found" ]; then
102 echo "fail (no menu found)"
105 echo -n "Setting Window Maker fonts... "
107 if [ -z "$new_locale" ] ||
[ "$new_locale" == "en" ]; then
108 args
="default $nodef"
110 args
="--locale=$new_locale $nodef"
112 if wsetfont
"$args" &>/dev
/null
; then
116 if wsetfont default
&>/dev
/null
; then
117 echo " (setting default)"