3 # Change locale-dependent settings of WindowMaker.
5 # v0.1 by Jan "judas" Tomka <tomka@oalevice.sk> on Jan 28 2001
7 # v0.2 by Jan "judas" Tomka <tomka@oalevice.sk> on Feb 22 2001
8 # - removed --nodef option
9 # - better error recognizing
10 # - added --test switch like in wsetfont
12 # v0.3 by Jan "judas" Tomka <tomka@oalevice.sk> on May 04 2001
13 # - bad bugs with --test found and corrected
19 if [ "x$GNUSTEP_USER_ROOT" = "x" ]; then
22 GSDIR
="$GNUSTEP_USER_ROOT"
23 if [ ! -d "GSDIR" ]; then
24 echo "GNUSTEP_USER_ROOT variable does not contain path to valid directory..." >/dev
/stderr
28 GLOBALDIR
="#pkgdatadir#"
29 LOCALDIR
="$GSDIR/Library/WindowMaker"
33 "$PROGRAM, v$VERSION by Jan \"judas\" Tomka\n"\
35 " $PROGRAM [--auto] [--test] [<new-locale> | default]\n"\
37 "<new-locale> locale you want WindowMaker to move to (e.g. ja or default)\n"\
38 "--auto use current locale\n"\
39 "--test don't write anything\n"
54 if [ -z "$new_locale" ]; then
57 echo -e "\nUnrecognized command line argument, run without arguments to see help.\n"
62 if [ "$new_locale" = "default" ]; then
67 if [ -n "$auto" ] && [ -z "$new_locale" ]; then
69 if [ -z "$new_locale" ]; then
70 new_locale
="${LC_ALL%_*}"
74 if [ -z "$new_locale" ]; then
75 if [ -z "$default" ]; then
76 echo -e "\nNo locale is set, using default...\n" >/dev
/stderr
78 elif ! (locale
-a |
grep "^$new_locale$" &>/dev
/null
); then
79 if [ -z "$auto" ]; then
81 "Locale $new_locale is not supported on your system..."\
85 "Locale $new_locale currently set is not supported on your system...\n"\
86 "Check your LANG and LC_ALL variables or install your locale support\n"\
92 echo -n "Setting Window Maker root menu... "
94 if [ -z "$new_locale" ] ||
[ "$new_locale" = "en" ]; then
95 menu_list
="plmenu menu"
98 menu_list
="plmenu.$new_locale menu.$new_locale plmenu menu"
99 args
="--locale=$new_locale"
102 echo -n "Setting Window Maker root menu... "
104 for new_menu
in $menu_list; do
105 for wm_dir
in $LOCALDIR $GLOBALDIR; do
106 if [ -f "$wm_dir/$new_menu" ]; then
107 if [ -z "$new_locale" ] ||
( [ -n "$new_locale" ] && echo "$new_menu" |
grep "menu.$new_locale" &>/dev
/null
); then
110 echo "fail (copying default)"
112 new_menu_tmp
=$new_menu
113 # Set new_menu_tmp to first 4 letters of $new_menu.
114 while [ ${#new_menu_tmp} -gt 4 ]; do
115 new_menu_tmp
=${new_menu_tmp%?}
117 if [ "${new_menu_tmp}" = "menu" ]; then # plain
118 echo "\"$wm_dir/$new_menu\"" >"$GSDIR/Defaults/WMRootMenu"
120 cp -f "$wm_dir/$new_menu" "$GSDIR/Defaults/WMRootMenu"
127 if [ -z "$any_found" ]; then
128 echo "fail (no menu found)"
131 echo -n "Setting Window Maker fonts... "
133 if [ -z "$new_locale" ] ||
[ "$new_locale" = "en" ]; then
134 args
="default $nodef"
136 args
="--locale=$new_locale $nodef"
138 if wsetfont
"$args" &>/dev
/null
; then
142 if wsetfont default
"$test" &>/dev
/null
; then
143 echo " (setting default)"