Page 1 of 2
QuickLocaleSwitcher for people who have more than 1 langpack
Posted: Sun 14 Apr 2013, 18:58
by L18L
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]
Posted: Sun 14 Apr 2013, 19:29
by Bert
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!.
Posted: Sun 14 Apr 2013, 23:32
by vicmz
Cool
I'd like to learn
German,
Japanese,
Chinese, and
Korean.
learning German
Posted: Mon 15 Apr 2013, 08:17
by L18L
vicmz wrote:Cool
I'd like to learn
German, ...
Nivel principiante
http://lp.babbel.com/d/SPA_tutorial.htm ... ner&ch=ORG
[edit] returning now from 1st lesson of
learning Dutch for Espanols
QuickLocaleSwitcher
Posted: Mon 15 Apr 2013, 09:30
by L18L
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 l
angpack_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:
I have changed their code for
example for
defaultcalendar from
to
Code: Select all
#!/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.
Posted: Tue 16 Apr 2013, 21:32
by vicmz
Another Chinese lessons link with lots of downloads, recommended if you seriously plan to learn:
http://ocw.mit.edu/resources/res-21f-00 ... ssons-1-3/
Posted: Thu 18 Apr 2013, 18:29
by Karl Godt
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 :
Posted: Thu 18 Apr 2013, 22:09
by Karl Godt
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 !
Posted: Thu 18 Apr 2013, 23:08
by Karl Godt
Got it, when only two languages then comes no gui . gui missing ut8 or not utf8 mentioning .
QuickLocaleSwitcher
Posted: Fri 19 Apr 2013, 16:46
by L18L
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.
Posted: Fri 19 Apr 2013, 17:55
by L18L
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!
Posted: Fri 19 Apr 2013, 19:37
by Karl Godt
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: Select all
#!/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
chooselocale
Posted: Sat 20 Apr 2013, 11:36
by L18L
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: Select all
#!/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
Posted: Sat 20 Apr 2013, 15:38
by Karl Godt
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 .
Posted: Sat 20 Apr 2013, 15:48
by Karl Godt
LIDL :) wrote:Code: Select all
<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 !
Posted: Sat 20 Apr 2013, 17:55
by L18L
build de_DK and da_DE from /usr/share/i18n/locales
.. Ick glööv dat jo
Karl Godt wrote:Did not know that feature . Great
... and I did not know that:
Code: Select all
grep -viE 'posix|translit|i18n|iso|eur|^$'
QuickLocaleSwitcher
Posted: Sat 20 Apr 2013, 17:58
by L18L
AppInfo.xml in langpack has to be reorganized to enable multi-lingual use
bi-lingual is OK if one of the two is English
But I want real multi-lingual use.
example trash
Code: Select all
<?xml version="1.0"?>
<AppInfo>
<Summary>Trash</Summary>
<Summary xml:lang="ru">Корзина</Summary>
<Summary xml:lang="ja">ゴミ箱</Summary>
<Summary xml:lang="zh_CN">回收站</Summary>
<About>
<Purpose>Trash Can for Puppy Linux</Purpose>
<License>GPL: http://www.gnu.org/licenses/gpl.txt</License>
<Version>0.3.2 - September 04, 2008</Version>
<Homepage>http://murga-linux.com/puppy/viewtopic.php?t=27310/</Homepage>
</About>
<AppMenu>
<Item option="-look">
<Label>Look in the Trash</Label>
<Label xml:lang="ru">По
QuickLocaleSwitcher
Posted: Sun 21 Apr 2013, 09:13
by L18L
L18L wrote:...Solution,
- fix momanager
#130418 rename AppInfo.xml to AppInfo.xml.in for langpack to enable peaceful co-existences of langpacks for different languages L18L
- fix pinstall.sh
#130420 merge AppInfo.xml.in with AppInfo.xml to enable peaceful coexistence of multiple langpacks
.....coming tomorrow
Here it is in attached
create_langpack_for_multiple_languages.tar.gz
which contains
-momanager
-pinstall_hacks.sh
If you create a langpack after having installed this ( just expand it to / )
then this langpack does not overwrite the AppInfo.xml files
but merge the
xml:lang=..
I should create a new langpack_de soon
... and wait for others?
or if you do not have a fast and cheap ( zero cost ) connection
then tell me and I can switch your langpack for multilingual usage ....
QuickLocaleSwitcher
Posted: Sun 21 Apr 2013, 14:20
by L18L
L18L wrote:...I should create a new langpack_de soon....
Creation was quickly done.
But upload to ompl.org failed....
Try this one please: [edit] URL changed to official langpack [/edit]
http://distro.ibiblio.org/quirky/pet_pa ... 130528.pet
Posted: Sun 21 Apr 2013, 16:21
by L18L
Karl Godt wrote: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 !
dat givt in spanisch
vicmz is very busy