chooselocale doesn't work on X

This is for bugs in a version of Puppy 5.x that is still under development. If you have bugs for a released version of Puppy, please post them in the forum's main Bugs section, not here. Bugs are when a program does not function as intended. Usability issues are not bugs.
Post Reply
Message
Author
User avatar
shinobar
Posts: 2672
Joined: Thu 28 May 2009, 09:26
Location: Japan
Contact:

chooselocale doesn't work on X

#1 Post by shinobar »

see the next patch against chooselocale upup-476
# diff -u /usr/sbin/chooselocale.org /usr/sbin/chooselocale

Code: Select all

--- /usr/sbin/chooselocale.org	2009-05-14 18:36:15.000000000 +0900
+++ /usr/sbin/chooselocale	2009-06-11 19:02:47.000000000 +0900
@@ -5,6 +5,8 @@
 #w004 checkbox for utf8. w019 fixup.
 #w470 $1=composeonly option, when call from 3builddistro. 
 #w473 disable en_US.utf8 generation, hangs PC if low RAM (64MB system).
+# 11jun09 by Mayaki Shinomiya <shino@pos.to> : check the existing dialog_table usable or not
+# 11jun09 : 'utf8' can be 'UTF-8' 
 
 LANG=C #Xdialog seems to need this.
 export LANG
@@ -17,9 +19,9 @@
 CURRLANG="`grep '^LANG=' /etc/profile | cut -f 2 -d '='`"
 
 UTF8=''
-[ "`echo -n "$CURRLANG" | grep 'utf8'`" != "" ] && UTF8='.utf8'
+[ "`echo -n "$CURRLANG" | grep -i 'utf'`" != "" ] && UTF8='.utf8'
 
-BASELANG="`basename $CURRLANG .utf8`"
+BASELANG=$(echo $CURRLANG|cut -d'.' -f1)	# "`basename $CURRLANG .utf8`"
 CURRENTWM="`cat /etc/windowmanager`"
 XSTATUS="no"
 [ -z $DISPLAY ] || XSTATUS="yes"
@@ -34,10 +36,16 @@
  #[ ! -d /usr/lib/locale/en_US.utf8 ] && localedef -f UTF-8 -i en_US --no-archive en_US.utf8 >/dev/null
 fi
 
-LANGUAGEDESCR='aa:Afar ab:Abkhazian af:Africaans sq:Albanian ar:Arabic hy:Armenian az:Azeri eu:Basque be:Belarusian bn:Bengali bs:Bosnian pt:Brazilian bg:Bulgarian ca:Catalan zh:Chinese hr:Croatian el:Cypriotic cs:Czech da:Danish dv:Divehi nl:Dutch en:English et:Estonian fo:Faeroese fa:Farsi fi:Finnish fr:French mk:Fyrom gl:Galician de:German el:Greek gu:Gujarati he:Hebrew hi:Hindi hu:Hungarian is:Icelandic id:Indonesian ga:Irish it:Italian ja:Japanese kn:Kannada kk:Kazakh kok:Konkani ko:Korean ky:Kyrgyz lv:Latvian ms:Malay ml:Malayalam mt:Maltese mi:Maori mr:Marathi es:Mexican mn:Mongolian nb:Norgwegian nn:Norwegian pa:Pashto fa:Persian pl:Polish pt:Portuguese pa:Punjabi quz:Quechua ro:Romania ru:Russian smn:Sami smj:Sami se:Sami sms:Sami sma:Sami sa:Sanskrit rs:Serbian sr:Srpski sl:Slovenian es:Spanish sw:Swahili sv:Swedish syr:Syriac ta:Tamil tt:Tatar te:Telugu tr:Turkish uk:Ukrainian ur:Urdu uz:Uzbek vi:Vietnamese wa:Walloon cy:Welsh xh:Xhosa zu:Zulu'
+LANGUAGEDESCR='aa:Afar ab:Abkhazian af:Africaans sq:Albanian ar:Arabic hy:Armenian az:Azeri eu:Basque be:Belarusian bn:Bengali bs:Bosnian bg:Bulgarian ca:Catalan zh:Chinese hr:Croatian el:Cypriotic cs:Czech da:Danish dv:Divehi nl:Dutch en:English et:Estonian fo:Faeroese fa:Farsi fi:Finnish fr:French mk:Fyrom gl:Galician de:German el:Greek gu:Gujarati he:Hebrew hi:Hindi hu:Hungarian is:Icelandic id:Indonesian ga:Irish it:Italian ja:Japanese kn:Kannada kk:Kazakh kok:Konkani ko:Korean ky:Kyrgyz lv:Latvian ms:Malay ml:Malayalam mt:Maltese mi:Maori mr:Marathi mn:Mongolian nb:Norgwegian nn:Norwegian pa:Pashto fa:Persian pl:Polish pt:Portuguese pa:Punjabi quz:Quechua ro:Romania ru:Russian smn:Sami smj:Sami se:Sami sms:Sami sma:Sami sa:Sanskrit rs:Serbian sr:Srpski sl:Slovenian es:Spanish sw:Swahili sv:Swedish syr:Syriac ta:Tamil tt:Tatar te:Telugu tr:Turkish uk:Ukrainian ur:Urdu uz:Uzbek vi:Vietnamese wa:Walloon cy:Welsh xh:Xhosa zu:Zulu'
 REGIONDESCR='AA:ArabicCountries AE:UAE AL:Yugoslavia AR:Argentina AT:Austria AU:Australia BE:Belgium BG:Bularia BH:Bahrain BN:Brunei BO:Bolvia BR:Brazil BZ:Belize CA:Canada CH:Switzerland CL:Chile CN:PeoplesRepublicChina CO:Columbia CR:CostaRica CY:Cyprus CZ:CzechRepublic DE:Germany DK:Denmark DO:DominicanRepublic EC:Ecuador EE:Estonia ES:Spain DO:Dominican DZ:Algeria EC:Ecuador EG:Egypt FI:Finland FR:France GB:GreatBritain GR:Greece GT:Guatemalia HK:HongKong HN:Honduras HR:Croatia HU:Hungary ID:Indonesia IE:Ireland IL:Israel IN:India IQ:Iraq IS:Iceland IT:Italy JM:Jamaica JO:Jordan JP:Japan KR:Korea KW:Kuwait KZ:Kazakhstan LB:Lebanon LI:Liechtenstein LU:Luxembourg LY:Libya MA:Morocco MC:Monaco MK:Macedonia MO:Macau MY:Malasia MX:Mexico NI:Nicaragua NL:Netherlands NO:Norway NZ:NewZealand OM:Oman PA:Panama PE:Peru PH:Philippines PL:Poland PR:PuertoRico PT:Portugal PY:Paraguay QA:Qatar RO:Romania RU:Russia SA:SaudiArabia SE:Sweden SG:Singapore SK:Slovakia SY:Syria TH:Thailand TN:Tunisia TR:Turkey TW:Taiwan ZA:SouthAfrica TT:Trinidad US:USA PE:Peru SV:ElSalvador MX:Mexico NI:Nicaragua UY:Uruguay VE:Venezuela YE:Yemen YU:Yugoslavia ZA:SouthAfrica'
-
-if [ ! -f /usr/share/i18n/dialog_table ];then
+# 11Jun09: dialog_table is for Xdialog?
+DIALOGTABLE=/usr/share/i18n/dialog_table
+if [ -f $DIALOGTABLE ];then
+	grep -q "off" $DIALOGTABLE && FORX="yes" || FORX="no"
+	[ "$XSTATUS" = "yes" ] && [ "$FORX" != "yes" ] && rm $DIALOGTABLE
+	[ "$XSTATUS" != "yes" ] &&  [ "$FORX" = "yes" ] && rm $DIALOGTABLE
+fi
+if [ ! -f $DIALOGTABLE ];then
  CHOICES=""; ON=""; OFF=""
  [ "$XSTATUS" = "yes" ] && ON="on"
  [ "$XSTATUS" = "yes" ] && OFF="off"
@@ -75,7 +83,7 @@
 
 if [ "$XSTATUS" = "yes" ];then
  echo "#!/bin/sh
-Xdialog --left --stdout --wrap --title \"Country setup\" --check \"UTF-8 encoding (apps faster without)\" ${CHECKUTF8} --radiolist \"The locale setting provides money, date and font localization for your country. The current choice is ${BASELANG}. Make a choice to suit your country...\" 0 46 0 $CHOICES >/tmp/chooselocale-choice
+Xdialog --left --stdout --wrap --title \"Country setup\" --check \"UTF-8 encoding (apps faster without)\" ${CHECKUTF8} --radiolist \"The locale setting provides money, date and font localization for your country. The current choice is ${BASELANG}. Make a choice to suit your country...\" 0 46 10 $CHOICES >/tmp/chooselocale-choice
 exit \$?" > /tmp/xdialog-chooselocale
 else
  echo "#!/bin/sh
@@ -89,7 +97,7 @@
 LANGCHOICE="`cat /tmp/chooselocale-choice | head -n 1`"
 
 UTF8CHOICE="`cat /tmp/chooselocale-choice | tail -n 1`"
-UTF8=''
+[ "$XSTATUS" = "yes" ] && UTF8=''
 if [ "$UTF8CHOICE" = "checked" ];then
  UTF8='.utf8'
  #if the user has chosen something like nl_BE@euro, need to chop...
@@ -130,7 +138,7 @@
  fi
 
  if [ "$OLDLANG" != "$NEWLANG" ];then
-  langPATTERN="s/${OLDLANG}/${NEWLANG}/"
+  langPATTERN="s/^[ ]*${OLDLANG}/${NEWLANG}/"
   sed -e "$langPATTERN" /etc/profile > /tmp/profile
   cp -f /tmp/profile /etc/profile
  fi
Post Reply