Author |
Message |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Sun 14 Apr 2013, 14:58 Post subject:
QuickLocaleSwitcher for people who have more than 1 langpack Subject description: HOWTO make your langpack to NOT overwrite other languages |
|
If you have more than just English then his is for you.
If you have exactly one locale (and its langpack) other than English then this is for you.
If you have several locales (and their langpacks) other than English then this is for you.
_________________________________________________
EDIT
There is something better now
no yad needed
new button in jwm tray
http://www.murga-linux.com/puppy/viewtopic.php?p=769153
_________________________________________________
What is different from original Puppy?
When you change locale in Puppy then you must restart X: and all apps are away.
This new switcher is just restarting JWM and rox.
All utils and apps launched from desktop icon or from menu run in the new locale.
QuickLocaleSwitcher is in /usr/bin and desktop menu.
Translatable by momanger. -NLS.pet would follow if some translations were posted here.
[edit] Note,
GUI improved:
2 and more foreign languages: there are choices
1 foreign language: toggles languages without interaction
0 foreign language: see screenshot
[/edit]
Have fun
[edit]The emphasize ist not at "Quick" but at "change without restart of X"[/edit]
[edit]Version 0.4 improved
check for dependencies
some bugs fixed
[/edit]
 |
Description |
|

Download |
Filename |
quicklocaleswitch-0.4.pet |
Filesize |
4 KB |
Downloaded |
388 Time(s) |
Description |
|

Download |
Filename |
quicklocaleswitch-0.3.pet |
Filesize |
3.85 KB |
Downloaded |
507 Time(s) |
Description |
|
Filesize |
22.49 KB |
Viewed |
632 Time(s) |

|
Description |
|

Download |
Filename |
quicklocaleswitch-0.2.pet |
Filesize |
3.72 KB |
Downloaded |
491 Time(s) |
Description |
quick switch between Russian and German |
Filesize |
59.16 KB |
Viewed |
644 Time(s) |

|
Description |
|

Download |
Filename |
quicklocaleswitch-0.1.pet |
Filesize |
3.49 KB |
Downloaded |
560 Time(s) |
Description |
|
Filesize |
35.82 KB |
Viewed |
785 Time(s) |

|
Last edited by L18L on Fri 04 Apr 2014, 13:42; edited 15 times in total
|
Back to top
|
|
 |
Bert

Joined: 30 Jun 2006 Posts: 1106
|
Posted: Sun 14 Apr 2013, 15:29 Post subject:
|
|
This looks like a brilliant piece of work again, L18L!
I don't pretend to completely understand how it does what it does, but I've never seen anything lke it before...congrats!
Anyway, while I'm drinking a very good coffee and enjoying my first kernel panic ever -while translating with momanager-, I can only feel grateful for guys like you...
Is it correct to say this is "on-the-fly 're-localisation'", without losing the active apps?Or do you mean all apps traditionally default in Puppy are instantly available in the new language?
My innocent first impression is, this could be a great tool for translators too. I will ask The Little Grey Cells why this would be so
Thanks for this exciting development!.
_________________

|
Back to top
|
|
 |
vicmz

Joined: 15 Jan 2012 Posts: 1268
|
Posted: Sun 14 Apr 2013, 19:32 Post subject:
|
|
Cool
I'd like to learn German, Japanese, Chinese, and Korean.
_________________ Puppy Linux en español
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Mon 15 Apr 2013, 04:17 Post subject:
learning German Subject description: babbel.com |
|
vicmz wrote: | Cool
I'd like to learn German, ... |
Nivel principiante
http://lp.babbel.com/d/SPA_tutorial.html?l1=SPA&l2=DEU&autostart=beginner&ch=ORG
[edit] returning now from 1st lesson of learning Dutch for Espanols
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Mon 15 Apr 2013, 05:30 Post subject:
QuickLocaleSwitcher Subject description: what and how |
|
Thanks for the nice words, Bert.
Bert wrote: | I don't pretend to completely understand how it does what it does, but I've never seen anything lke it before...congrats! | How it does what it does
In Puppy you seem to have chosen activation of locale nl_NL
default is en_US, English is always there because English messages are used by the coders.
If you have no other locale there would be no GUI, the locale would just toggle to en_US or back to nl_NL.
But I hope that you have installed German langpack_de and chosen locale de_** once.
Then i.e. if you have more than 2 locales you have the GUI showed in 1st post.
It uses default fixmenus (a bit tuned for speed) and default fixdesk.
If you start it from command line (copy Code to a console anpress ENTER)
then you will see how many ( ) seconds it needs for what it does. Chosen new locale is updated in file /etc/profile.
Bert wrote: | Is it correct to say this is "on-the-fly 're-localisation'", without losing the active apps?
Or do you mean all apps traditionally default in Puppy are instantly available in the new language? |
It is "on-the-fly 're-localisation'", without losing the active apps
but only for the dault apps which are listed if you run:
Code: | ls /usr/local/bin/default* |
I have changed their code for example for defaultcalendar from
to Code: | #!/bin/sh
eval `grep '^LANG=' /etc/profile`
osmo $@ |
that is inserted 1 line wich is taking locale from (actualized) /etc/profile
Now you should be able to
start "plan" from desktop icon
switch locale
start "plan" from desktop icon in the new language
If you cannot then please report. version is just 0.1
Other apps stay with the old locale because they all are running under xwin. And restarting xwin would kill all apps.
But if you start from console (which is a defaultapp) then it is in new locale.
Description |
Exemple for One app in 2 different locales active |
Filesize |
8.99 KB |
Viewed |
819 Time(s) |

|
|
Back to top
|
|
 |
vicmz

Joined: 15 Jan 2012 Posts: 1268
|
Posted: Tue 16 Apr 2013, 17:32 Post subject:
|
|
Another Chinese lessons link with lots of downloads, recommended if you seriously plan to learn:
http://ocw.mit.edu/resources/res-21f-003-learning-chinese-a-foundation-course-in-mandarin-spring-2011/online-textbook/part-i-introduction-units-1-4-character-lessons-1-3/
_________________ Puppy Linux en español
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 4208 Location: Kiel,Germany
|
Posted: Thu 18 Apr 2013, 14:29 Post subject:
|
|
fixmenus looks good !
Will test it later cos i have LANG out of /etc/profile cos I am still experimenting on not to call /etc/profile from .bashrc all of the time .
Heres another snapshot of a chooselocale experiment of mine :
Description |
|
Filesize |
55.94 KB |
Viewed |
685 Time(s) |

|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 4208 Location: Kiel,Germany
|
Posted: Thu 18 Apr 2013, 18:09 Post subject:
|
|
First test in my messed up frugal Macpup529 works. Have en_US and de_DE (.URGS-EIGHT) and it switches kinda fine ( jwm ) .
I need some time to detect thingys .
Am missing the gui to choose another locale as the pic shows in your first post .
Cheers !
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 4208 Location: Kiel,Germany
|
Posted: Thu 18 Apr 2013, 19:08 Post subject:
|
|
Got it, when only two languages then comes no gui . gui missing ut8 or not utf8 mentioning .
Description |
|
Filesize |
21.13 KB |
Viewed |
734 Time(s) |

|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Fri 19 Apr 2013, 12:46 Post subject:
QuickLocaleSwitcher Subject description: utf8 |
|
Karl Godt wrote: | ... gui missing ut8 or not utf8 mentioning . |
That was intented to not confuse noobees.
Look into the script: there is a tail -n1 which would guarantee a result of utf8
What I really want is: just change language. (QuickLanguageSwitcher)
Example: Danish in north Schleswig-Holstein (that they exist we do know since last votes)
What is their locale?
da_DE or da_DK
They would have usage of switch from da to de and back....
But it is really just the language (LC_MESSAGES for GNU software)
fixdesk is without changes now. Quick enough.
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Fri 19 Apr 2013, 13:55 Post subject:
|
|
Karl Godt wrote: | ...Heres another snapshot of a chooselocale experiment of mine : |
I find these long lists very annoying (and difficult to select th right one sometimes)
Easier for the user would be 1- choose language
then 1 country out of some countries.
Very interesting that you are experimenting too!
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 4208 Location: Kiel,Germany
|
Posted: Fri 19 Apr 2013, 15:37 Post subject:
|
|
That code is much faster than the original chooselocale formatting loop and contains more info . Not a Nooby and dont want offered a head -n1 -> iso-8859-1 if i want iso-8859-2 if i would be a Tchechoslowakian .
Code: |
#!/bin/sh
# Karl Reimer Godt April 2013
Version=1.00
start_dir="$PWD"
tmpDir=/tmp/locale
mkdir -p $tmpDir/log
[ "$start_dir" ] || start_dir=$tmpDir
for i in $(ls -1 /usr/share/i18n/locales) ; do
AVAIL_LANGS="$AVAIL_LANGS
${i}| `grep -m1 '^title' /usr/share/i18n/locales/$i |sed 's%^title[[:blank:]]*%%'`"
done
echo "$AVAIL_LANGS" | grep -viE 'posix|translit|i18n|iso|^$' >/tmp/AVAIL_LANGS.lst
export ChooseLocaleMainWindow="
<window title=\"chooselocale\">
<vbox>
<hbox>
<text><label>Select the language</label></text>
</hbox>
<hbox>
<frame Language>
<table>
<label>Available Languages in i18n locales | Description</label>
<variable>MY_LANG</variable>
<input>cat /tmp/AVAIL_LANGS.lst</input>
<action>echo \$MY_LANG >/tmp/LANG_sel</action>
<width>700</width><height>180</height>
</table>
</frame>
</hbox>
<hbox>
<text><label>Select the char map</label></text>
</hbox>
<hbox>
<frame Charmap>
<table>
<label>Available Character Maps in i18n charmaps</label>
<variable>MY_MAP</variable>
<input>ls -1 /usr/share/i18n/charmaps</input>
<action>echo $MY_MAP >/tmp/MAP_sel</action>
<width>700</width><height>180</height>
</table>
</frame>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
"
eval `gtkdialog --program=ChooseLocaleMainWindow`
#: MY_LANG="de_DE"
#: MY_MAP="IBM1132.gz"
#: EXIT="OK"
[ "$EXIT" = OK ] || exit 0
[ "$MY_MAP" ] || exit 0
[ "$MY_LANG" ] || exit 0
MAP=`echo "$MY_MAP" | sed 's%\..*$%%'`
echo "MAP=$MAP'"
echo "MY_LANG=$MY_LANG'"
localedef --no-archive -f $MAP -i $MY_LANG "${MY_LANG}.${MAP}" > $tmpDir/log/${MAP}.${MY_LANG}.log 2>&1
RV=$?
echo "Return Value of localedef is < $RV >"
if [ "$RV" != 0 ] ; then
echo "$MY_LANG $MAP" >> /usr/share/i18n/UNSUPPORTED
ERROR_MSG=`tail -n 10 $tmpDir/log/"${MAP}.${MY_LANG}.log"`
xmessage -bg red "Failed to create correct Language
$ERROR_MSG"
cd /usr/lib/locale/
rmdir ${MY_LANG}*
cd "$start_dir"
exec $0
fi
grep "$MY_LANG" /usr/share/i18n/SUPPORTED | grep "$MAP" || echo "$MY_LANG $MAP" >> /usr/share/i18n/SUPPORTED
sed -i "s%^LANG=.*%LANG=${MY_LANG}\.${MAP}%" /etc/profile
[ $? = 0 ] || { xmessage -gb red "Sorry, probably /etc/profile corrupt."; exit 1; }
Xdialog --left --wrap --title "Glibc Locale setup" --ok-label "Restart X now" --cancel-label "Finished" --yesno "Ok, the change has been made and will take effect at next boot. However, if you click the 'Restart X now' button X will exit then restart and the new locale will immediately take effect -- however make sure that all other applications are closed first as restarting X will rudely kill them! Otherwise, just click 'Finished' for the new locale to take effect at next boot.\n\nTechnical details:\nLocale files have been generated in /usr/lib/locale (if not already) and LANG variable set to ${MY_LANG}.${MAP} in /etc/profile." 0 100
if [ $? -eq 0 ];then
rm -rf /tmp/.X0-lock
sync
exec restartwm $CURRENTWM
fi
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 3431 Location: www.eussenheim.de/
|
Posted: Sat 20 Apr 2013, 07:36 Post subject:
chooselocale Subject description: Version 1.01 |
|
Karl Godt wrote: | .. Not a Nooby and dont want offered a head -n1 -> iso-8859-1 if i want iso-8859-2 if i would be a Tchechoslowakian .
|
All right
..and i think utf8 is enogh for the rest of the century
Here is my contribution (playing version with endless loop):
Code: | #!/bin/sh
# Karl Reimer Godt April 2013
# L18L without @euro and just UTF-8 and locales for 1 language
Version=1.01
start_dir="$PWD"
tmpDir=/tmp/locale
mkdir -p $tmpDir/log
[ "$start_dir" ] || start_dir=$tmpDir
for i in $(ls -1 /usr/share/i18n/locales) ; do
AVAIL_LANGS="$AVAIL_LANGS
${i}| `grep -m1 '^title' /usr/share/i18n/locales/$i |sed 's%^title[[:blank:]]*%%'`"
done
echo "$AVAIL_LANGS" | grep -viE 'posix|translit|i18n|iso|eur|^$' >/tmp/AVAIL_LANGS.lst
[ -f /tmp/AVAIL_LANGUAGES.lst ] || cat /tmp/AVAIL_LANGS.lst | cut -d' ' -f2| cut -d'"' -f2 | sort -u >/tmp/AVAIL_LANGUAGES.lst
while true; do # endless loop
MY_LANGUAGE=`cat /tmp/LANGUAGE_sel 2>/dev/null` || MY_LANGUAGE=`grep -m1 '^language' /usr/share/i18n/locales/${LANG%.*} | cut -d'"' -f2`
export ChooseLocaleMainWindow="
<window title=\"chooselocale $Version\">
<vbox>
<hbox>
<text><label>Select the language</label></text>
</hbox>
<hbox>
<frame Language>
<table>
<label>Available Languages in i18n locales Description</label>
<variable>MY_LANGUAGE</variable>
<input>echo $MY_LANGUAGE; cat /tmp/AVAIL_LANGUAGES.lst</input>
<action>echo \$MY_LANGUAGE >/tmp/LANGUAGE_sel</action>
<width>700</width><height>135</height>
</table>
</frame>
</hbox>
<hbox>
<text><label>Select the locale</label></text>
</hbox>
<hbox>
<frame Locale>
<table>
<label>Available for $MY_LANGUAGE | Description</label>
<variable>MY_LANG</variable>
<input>cat /tmp/AVAIL_LANGS.lst | grep $MY_LANGUAGE</input>
<action>echo \$MY_LANG >/tmp/LANG_sel</action>
<width>700</width><height>220</height>
</table>
</frame>
</hbox>
<hbox>
<text><label>Select the char map</label></text>
</hbox>
<hbox>
<frame Charmap>
<table>
<label>Should not One and only Character Map be enough for this World?</label>
<variable>MY_MAP</variable>
<input>echo UTF-8.gz</input>
<action>echo $MY_MAP >/tmp/MAP_sel</action>
<width>700</width><height>60</height>
</table>
</frame>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
</window>
"
eval `gtkdialog --program=ChooseLocaleMainWindow`
#: MY_LANG="de_DE"
#: MY_MAP="IBM1132.gz"
#: EXIT="OK"
[ "$EXIT" = OK ] || continue
[ "$MY_MAP" ] || continue
[ "$MY_LANG" ] || continue
MAP=`echo "$MY_MAP" | sed 's%\..*$%%'`
echo "MAP=$MAP'"
echo "MY_LANG=$MY_LANG'"
localedef --no-archive -f $MAP -i $MY_LANG "${MY_LANG}.${MAP}" > $tmpDir/log/${MAP}.${MY_LANG}.log 2>&1
RV=$?
echo "Return Value of localedef is < $RV >"
if [ "$RV" != 0 ] ; then
echo "$MY_LANG $MAP" >> /usr/share/i18n/UNSUPPORTED
ERROR_MSG=`tail -n 10 $tmpDir/log/"${MAP}.${MY_LANG}.log"`
xmessage -bg red "Failed to create correct Language
$ERROR_MSG"
cd /usr/lib/locale/
rmdir ${MY_LANG}*
cd "$start_dir"
exec $0
fi
grep "$MY_LANG" /usr/share/i18n/SUPPORTED | grep "$MAP" || echo "$MY_LANG $MAP" >> /usr/share/i18n/SUPPORTED
sed -i "s%^LANG=.*%LANG=${MY_LANG}\.${MAP}%" /etc/profile
[ $? = 0 ] || { xmessage -gb red "Sorry, probably /etc/profile corrupt."; exit 1; }
Xdialog --left --wrap --title "Glibc Locale setup" --ok-label "Restart X now" --cancel-label "Finished" --yesno "Ok, the change has been made and will take effect at next boot. However, if you click the 'Restart X now' button X will exit then restart and the new locale will immediately take effect -- however make sure that all other applications are closed first as restarting X will rudely kill them! Otherwise, just click 'Finished' for the new locale to take effect at next boot.\n\nTechnical details:\nLocale files have been generated in /usr/lib/locale (if not already) and LANG variable set to ${MY_LANG}.${MAP} in /etc/profile." 0 100
if [ $? -eq 0 ];then
rm -rf /tmp/.X0-lock
sync
exec restartwm $CURRENTWM
fi
done |
No da_DE in i18n
Description |
try French or Spanish or English please |
Filesize |
24.71 KB |
Viewed |
697 Time(s) |

|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 4208 Location: Kiel,Germany
|
Posted: Sat 20 Apr 2013, 11:38 Post subject:
|
|
I don't think that da_DE or de_DK exists at this time .
Bonn-Kopenhagener Erklärungen
givt dat nich in inglisch .. Ick glööv dat jo nich !
Datts wegen die Englänners datt nich kennen, givt dat so veel Kriech inne Welt .
Jugoslawien wär jo een Exempel mit äner Vulksbefrugung ween west .. aver datt shall all so sien .
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 4208 Location: Kiel,Germany
|
Posted: Sat 20 Apr 2013, 11:48 Post subject:
|
|
LIDL wrote: | Code: | <input>echo $MY_LANGUAGE; cat /tmp/AVAIL_LANGUAGES.lst</input> |
|
Did not know that feature . Great
And with fixmenus : it is ok , I like the loop reordering on first short sight,
but have mine with debugging output and would have been overwritten .
Have backups but lazy me needs to find the hdd somewhere , dig it out and climb under the table to attach it to the pc .
And sorry, this time i could not withstand: l18l and lidl ( you know . have no lidl near my place, mostly penny market man ) .
Nevertheless you make good batch of work , LIBL !
|
Back to top
|
|
 |
|